Skip to content

Add provider-backed Side Quest conversations#8282

Open
gatsby74 wants to merge 3 commits into
stablyai:mainfrom
gatsby74:gatsby74/side-quests
Open

Add provider-backed Side Quest conversations#8282
gatsby74 wants to merge 3 commits into
stablyai:mainfrom
gatsby74:gatsby74/side-quests

Conversation

@gatsby74

@gatsby74 gatsby74 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Side Quests, a way to ask questions about terminal output in a separate native-chat pane without interrupting the terminal or its active agent.

  • Select terminal output and choose Add Selection to Side Quest, or start a blank Side Quest from the terminal context menu.
  • Open a right-hand split with a removable quoted-context card and independent conversation.
  • Reuse one warm codex app-server process for local Codex Side Quests instead of launching a hidden TUI for every question.
  • Persist the provider thread reference so conversations survive app/process restarts while the provider remains the transcript owner.
  • Keep compatibility fallbacks for Claude and SSH worktrees, and reject runtime-owned workspaces until the host API can return a bindable tab identity.

The product inspiration is Cursor's Side Chat feature: Cursor announcement on X. Orca's implementation uses its existing worktree split model and a provider-backed native conversation, under the name Side Quests.

The performance motivation was the previous 22–25 second hidden-TUI/MCP startup path. A real local provider smoke test for this implementation produced a thread in 241 ms, the first response delta at 3.0 seconds, and turn completion at 3.9 seconds.

Contributor X: @gatsby74

Screenshots

Side.Quest.mp4

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — Node 24: 2,690 files / 28,185 tests passed; 5 files / 39 tests skipped
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, including app-server protocol/process failure behavior, warm-session configuration, streaming, persistence/hydration, context fencing, selection actions, launch rollback, first-message materialization, and view-mode gating

AI Review Report

The AI review traced terminal selection through split creation, provider-thread persistence, IPC/preload transport, live message reconciliation, interruption, cleanup, and restored-session reads.

  • Cross-platform: verified shared process spawning uses Orca's Windows command wrapper, macOS/Linux direct spawning, and WSL path conversion. No hardcoded metaKey, separator, or platform-specific shortcut label was introduced.
  • Local/SSH/runtime: local Codex uses app-server; ordinary SSH and Claude retain explicit read-only terminal fallbacks; runtime-owned web/paired/headless workspaces fail closed until host-created tabs return identities.
  • Agents/integrations: Codex is the only direct provider in this slice. Claude remains supported through plan mode. MCP servers and built-in apps are disabled for direct research threads; git-provider behavior is untouched.
  • Performance: one lazy app-server is reused across Side Quests; concurrent connection/resume work is coalesced; stderr and renderer caches are bounded; subscriptions and child processes have explicit teardown.
  • UI quality: the quote card, composer, empty/error/working states, split placement, and selection action use the existing native-chat components, shadcn primitives, and documented Orca tokens. The first-message materialization error found during manual testing was fixed and regression-tested.

No blocking review issue remains. Interactive validation was performed on macOS; Linux/Windows behavior is covered by shared code paths, typecheck, unit tests, and production builds rather than manual UI runs.

Security Audit

  • Selected terminal text is cleaned, bounded, fenced, and explicitly labeled as untrusted reference context before being sent to the provider.
  • Direct Codex threads use sandbox: read-only and approvalPolicy: never; inherited MCP servers and built-in apps are disabled.
  • Terminal fallbacks ignore configured command overrides so an override cannot silently replace the read-only launch flags.
  • App-server JSONL is parsed and shape-checked; malformed output or request timeout fails closed and terminates the owned process. Stderr retention is bounded.
  • IPC transports plain typed data, subscriptions are scoped per renderer/webContents and provider thread, and destroyed renderers release their subscriptions.
  • No secrets, dependencies, release metadata, or provider credentials are added or persisted. Workspace state stores only Side Quest/provider identifiers and lifecycle metadata, not message content.

Follow-up security work is only needed when enabling direct provider transport on SSH/runtime hosts; that should preserve the same sandbox, capability-disable, and ownership boundaries.

Notes

  • Local Codex Side Quests are the fast provider-backed path in this PR.
  • Claude and ordinary SSH worktrees use the existing read-only TUI compatibility path.
  • Runtime-owned web, paired, and headless workspaces remain intentionally unsupported until the host create-tab API returns the created terminal/unified-tab IDs.
  • Future work includes @-mentioning a Side Quest back into the main conversation, persisted unsent quote context, history/rename/archive UI, and direct-provider parity beyond local Codex.

@gatsby74 gatsby74 marked this pull request as ready for review July 11, 2026 13:13
@gatsby74 gatsby74 force-pushed the gatsby74/side-quests branch from f37a030 to 64adb45 Compare July 11, 2026 13:13
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 293b4c97-a5f6-47b2-aa82-4a9ca62b53a7

📥 Commits

Reviewing files that changed from the base of the PR and between 9c0a558 and ba4b79a.

📒 Files selected for processing (1)
  • src/main/ipc/side-quest.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/ipc/side-quest.test.ts

📝 Walkthrough

Walkthrough

This change introduces “Side Quest,” enabling provider-owned Codex conversations alongside terminal sessions. It adds app-server communication, session orchestration, IPC and preload APIs, renderer chat views and composers, terminal selection and launch flows, quoted context handling, session persistence, transcript retry behavior, localization, and supporting tests.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding provider-backed Side Quest conversations.
Description check ✅ Passed The description matches the required template and includes summary, screenshots, testing, AI review, security audit, and notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (5)
docs/reference/plans/2026-07-11-side-quests.md (1)

88-92: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider varying sentence beginnings in Phase 3 bullets.

Three consecutive bullets begin with "Add". Consider rewording for readability, e.g., "Include keyboard access…" or "Introduce telemetry…".

Source: Linters/SAST tools

src/main/side-quest/codex-app-server-jsonl-client.test.ts (1)

59-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Second rejection assertion is a substring match.

toThrow('exited with code 7') at line 72 would also match 'exited with code 7: startup failed', so it doesn't strictly verify that subsequent requests exclude the stderr payload. Consider using a stricter matcher if distinguishing that behavior matters.

Otherwise, the test suite is solid — init ordering, routing, exit rejection, invalid JSONL, and timeout termination are all well-covered.

src/main/side-quest/codex-side-quest-manager.ts (1)

85-94: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document why Side Quests force read-only, non-interactive execution.

These policy values are a security and product boundary; add a brief rationale so future changes do not silently enable writes or approval prompts.

Proposed comment
     const result = await connection.request('thread/start', {
       cwd,
+      // Why: Side Quests answer questions about workspace state but must
+      // never mutate it or block the conversation on approval prompts.
       approvalPolicy: 'never',
       sandbox: 'read-only',

As per coding guidelines, “When code is driven by a design document or non-obvious constraint, add a brief one- or two-line comment explaining why it behaves that way.”

Source: Coding guidelines

src/renderer/src/components/native-chat/SideQuestQuoteCard.tsx (1)

77-77: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use approved typography tokens for the quote-card header.

text-[11px] and tracking-[0.05em] introduce arbitrary typography values in renderer UI. Replace them with the documented main.css/styleguide tokens, or add a named token if this size is intentional.

As per coding guidelines, renderer UI must use documented tokens instead of invented font sizes and styling values.

Source: Coding guidelines

src/renderer/src/lib/start-terminal-side-quest.test.ts (1)

31-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test case for the provider transport path.

All three tests invoke beforeOpenChat?.('side-tab') with a single argument, so transport is always undefined and only the non-provider branch is exercised. The provider path (transport === 'provider') where seedNativeChatSideQuestReadiness is intentionally skipped is never verified — and this is the primary path for Codex Side Quests per the PR objectives.

🧪 Suggested test for provider transport
   it('surfaces a specific runtime-host limitation', () => {
     mocks.launchSideQuest.mockReturnValue({ status: 'runtime-unsupported' })

     startTerminalSideQuest({
       worktreeId: 'worktree',
       sourceGroupId: 'source-group',
       agent: 'codex',
       capturedText: 'context',
       sourceLabel: 'Terminal'
     })

     expect(mocks.toastError).toHaveBeenCalledWith(
       'Side Quests are not available in runtime-hosted workspaces yet.'
     )
   })
+
+  it('skips readiness seeding for provider transport but still seeds context', () => {
+    mocks.launchSideQuest.mockReturnValue({
+      status: 'started',
+      groupId: 'side-group',
+      terminalTabId: 'side-tab'
+    })
+
+    startTerminalSideQuest({
+      worktreeId: 'worktree',
+      sourceGroupId: 'source-group',
+      agent: 'codex',
+      capturedText: 'context',
+      sourceLabel: 'Terminal'
+    })
+
+    mocks.launchSideQuest.mock.calls[0][0].beforeOpenChat?.('side-tab', 'provider')
+    expect(mocks.seedNativeChatSideQuestReadiness).not.toHaveBeenCalled()
+    expect(mocks.seedNativeChatSideQuestContext).toHaveBeenCalledWith('side-tab', expect.anything())
+  })
 })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7b3d2efd-c50a-4e45-9b36-63330cdae801

📥 Commits

Reviewing files that changed from the base of the PR and between ff8192a and 64adb45.

📒 Files selected for processing (74)
  • docs/reference/plans/2026-07-11-side-quests.md
  • src/main/ipc/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers.ts
  • src/main/ipc/side-quest.ts
  • src/main/native-chat/transcript-read-cache.ts
  • src/main/native-chat/transcript-reader.ts
  • src/main/side-quest/codex-app-server-jsonl-client.test.ts
  • src/main/side-quest/codex-app-server-jsonl-client.ts
  • src/main/side-quest/codex-app-server-process.ts
  • src/main/side-quest/codex-app-server-protocol.ts
  • src/main/side-quest/codex-app-server-test-process.ts
  • src/main/side-quest/codex-side-quest-manager.test.ts
  • src/main/side-quest/codex-side-quest-manager.ts
  • src/main/side-quest/codex-side-quest-native-chat.test.ts
  • src/main/side-quest/codex-side-quest-native-chat.ts
  • src/main/side-quest/codex-side-quest-thread-config.ts
  • src/preload/api-types.ts
  • src/preload/index.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/native-chat/NativeChatComposerField.tsx
  • src/renderer/src/components/native-chat/NativeChatView.tsx
  • src/renderer/src/components/native-chat/ProviderSideQuestComposer.tsx
  • src/renderer/src/components/native-chat/ProviderSideQuestView.tsx
  • src/renderer/src/components/native-chat/SideQuestQuoteCard.test.tsx
  • src/renderer/src/components/native-chat/SideQuestQuoteCard.tsx
  • src/renderer/src/components/native-chat/native-chat-composer-target.ts
  • src/renderer/src/components/native-chat/native-chat-side-quest-context-cache.test.ts
  • src/renderer/src/components/native-chat/native-chat-side-quest-context-cache.ts
  • src/renderer/src/components/native-chat/native-chat-side-quest-readiness-cache.test.ts
  • src/renderer/src/components/native-chat/native-chat-side-quest-readiness-cache.ts
  • src/renderer/src/components/native-chat/native-chat-working-suppression.test.ts
  • src/renderer/src/components/native-chat/native-chat-working-suppression.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts
  • src/renderer/src/components/native-chat/use-native-chat-side-quest-context.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-side-quest-context.ts
  • src/renderer/src/components/native-chat/use-native-chat-toggle-shortcut.ts
  • src/renderer/src/components/native-chat/use-provider-side-quest-session.ts
  • src/renderer/src/components/tab-bar/TabBar.tsx
  • src/renderer/src/components/terminal-pane/TerminalContextMenu.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalContextMenu.tsx
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneOverlayLayer.tsx
  • src/renderer/src/components/terminal-pane/TerminalSideQuestMenuItem.tsx
  • src/renderer/src/components/terminal-pane/TerminalSideQuestSelectionAction.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalSideQuestSelectionAction.tsx
  • src/renderer/src/components/terminal-pane/terminal-side-quest-selection.test.ts
  • src/renderer/src/components/terminal-pane/terminal-side-quest-selection.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab.ts
  • src/renderer/src/lib/launch-side-quest.test.ts
  • src/renderer/src/lib/launch-side-quest.ts
  • src/renderer/src/lib/side-quest-agent.test.ts
  • src/renderer/src/lib/side-quest-agent.ts
  • src/renderer/src/lib/side-quest-context.test.ts
  • src/renderer/src/lib/side-quest-context.ts
  • src/renderer/src/lib/start-terminal-side-quest.test.ts
  • src/renderer/src/lib/start-terminal-side-quest.ts
  • src/renderer/src/lib/workspace-session.test.ts
  • src/renderer/src/store/slices/terminal-side-quest-session.test.ts
  • src/renderer/src/store/slices/terminals-hydration.test.ts
  • src/renderer/src/store/slices/terminals.ts
  • src/shared/side-quest-runtime-types.ts
  • src/shared/side-quest-types.ts
  • src/shared/types.ts
  • src/shared/workspace-session-schema.test.ts
  • src/shared/workspace-session-schema.ts

Comment thread src/main/ipc/side-quest.ts
Comment thread src/renderer/src/components/terminal-pane/TerminalPane.tsx
Comment thread src/renderer/src/components/terminal-pane/TerminalPane.tsx
Comment thread src/renderer/src/components/Terminal.tsx
Comment thread src/renderer/src/lib/agent-paste-draft.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e12a273a-1072-4694-b77c-bbbadee705f3

📥 Commits

Reviewing files that changed from the base of the PR and between 64adb45 and 9c0a558.

📒 Files selected for processing (15)
  • docs/reference/plans/2026-07-11-side-quests.md
  • src/main/ipc/side-quest.test.ts
  • src/main/ipc/side-quest.ts
  • src/main/side-quest/codex-app-server-jsonl-client.test.ts
  • src/main/side-quest/codex-side-quest-manager.ts
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/agent-paste-draft.test.ts
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/renderer/src/lib/start-terminal-side-quest.test.ts
✅ Files skipped from review due to trivial changes (1)
  • docs/reference/plans/2026-07-11-side-quests.md
🚧 Files skipped from review as they are similar to previous changes (11)
  • src/renderer/src/components/Terminal.tsx
  • src/renderer/src/lib/agent-paste-draft.ts
  • src/main/side-quest/codex-app-server-jsonl-client.test.ts
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/components/terminal-pane/TerminalPane.tsx
  • src/main/ipc/side-quest.ts
  • src/renderer/src/i18n/locales/en.json
  • src/main/side-quest/codex-side-quest-manager.ts
  • src/renderer/src/i18n/locales/zh.json

Comment thread src/main/ipc/side-quest.test.ts
@AmethystLiang AmethystLiang self-assigned this Jul 11, 2026
@AmethystLiang AmethystLiang self-requested a review July 11, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants