|
| 1 | +# Side Quests: viability and delivery plan |
| 2 | + |
| 3 | +## Outcome |
| 4 | + |
| 5 | +Side Quests are viable on Orca's existing terminal-group and native-chat foundations. The delivered |
| 6 | +vertical slice opens a durable provider-owned Codex conversation beside the source terminal, |
| 7 | +optionally carries selected terminal output into the native composer as quoted context, and leaves |
| 8 | +the original process running and interactive. |
| 9 | + |
| 10 | +Local Codex Side Quests use one warm `codex app-server` process and do not create a hidden PTY. |
| 11 | +Claude and SSH worktrees retain the read-only terminal-backed compatibility path. Runtime-owned web, |
| 12 | +paired, and headless worktrees need a host API improvement before they can bind context safely. |
| 13 | + |
| 14 | +## User flow |
| 15 | + |
| 16 | +1. Select terminal output and choose **Add Selection to Side Quest** from the floating action, or |
| 17 | + right-click the terminal and choose the same action. |
| 18 | +2. To start without context, right-click and choose **New Side Quest**. |
| 19 | +3. Orca creates a split to the right and starts a durable, read-only Codex provider thread for local |
| 20 | + worktrees. Compatibility environments launch the matching/default terminal agent. |
| 21 | +4. The new pane opens directly in native chat and is labeled **Side Quest**. |
| 22 | +5. Selected output appears as a removable quote card. The user adds a question and sends both as one |
| 23 | + bounded prompt with an explicit untrusted-context boundary. |
| 24 | +6. The original terminal continues without receiving input, focus, or an interrupt. |
| 25 | + |
| 26 | +## Architecture |
| 27 | + |
| 28 | +| Concern | Existing Orca primitive | Side Quest behavior | |
| 29 | +| --- | --- | --- | |
| 30 | +| Side-by-side layout | terminal split groups | create an empty right split beside the source group | |
| 31 | +| Independent agent | Codex app-server manager | reuse one warm process and create a provider-owned thread per Side Quest | |
| 32 | +| Agent choice | detected leaf, launched tab, default-agent settings | prefer the detected source agent, then launch metadata, then default | |
| 33 | +| Chat surface | experimental native chat | force the created unified terminal tab to chat mode | |
| 34 | +| Context | bounded session transcript cleaner | strip terminal control data and cap context at the existing transcript budget | |
| 35 | +| Prompt safety | native chat send path | fence output as untrusted quoted text and append the user's question | |
| 36 | +| Pending handoff | bounded renderer cache keyed by terminal tab ID | seed before chat's first render and clear after send/removal | |
| 37 | +| Durability | terminal-tab workspace state | persist only the Side Quest/provider thread reference; the provider owns messages | |
| 38 | +| Live updates | preload IPC subscription | stream agent deltas, completed items, turn completion, errors, and interrupts | |
| 39 | + |
| 40 | +Codex app-server threads use `sandbox: read-only` and `approvalPolicy: never`. Inherited MCP servers |
| 41 | +and apps are disabled for these research conversations, avoiding both unwanted capabilities and the |
| 42 | +startup delay that motivated the direct provider transport. Claude launches with |
| 43 | +`--permission-mode plan` on the compatibility path. Terminal fallbacks intentionally bypass |
| 44 | +configured command overrides because an override can embed unrestricted flags that would defeat |
| 45 | +the shared-worktree guarantee. |
| 46 | + |
| 47 | +## Platform viability |
| 48 | + |
| 49 | +| Environment | Status | Notes | |
| 50 | +| --- | --- | --- | |
| 51 | +| macOS, Linux, Windows local worktrees | Supported | cross-platform process spawning plus the existing split/chat UI | |
| 52 | +| WSL worktrees | Supported by provider manager | converts renderer UNC paths to the selected distro's Linux path | |
| 53 | +| Ordinary SSH worktrees | Compatibility path | existing terminal launch routing keeps process creation on the SSH target | |
| 54 | +| Runtime-owned web/paired/headless worktrees | Blocked on host API | renderer receives no created tab ID, so context cannot be bound to a specific chat safely | |
| 55 | + |
| 56 | +The runtime fix should make host terminal creation awaitable and return the created terminal and |
| 57 | +unified-tab identities. The same transaction should accept the target group, initial view mode, |
| 58 | +label, and pending Side Quest context. Until then the UI reports this limitation and avoids creating |
| 59 | +an orphan local split. |
| 60 | + |
| 61 | +Local provider creation is asynchronous after tab allocation, so the composer remains draftable |
| 62 | +while the provider thread starts. The vertical slice rolls back tab-registration and split-creation |
| 63 | +failures, surfaces provider startup errors inline, and treats an app-server thread as an empty |
| 64 | +conversation until its first user turn materializes it. |
| 65 | + |
| 66 | +## Delivery phases |
| 67 | + |
| 68 | +### Phase 1 — vertical slice |
| 69 | + |
| 70 | +- Selection floating action and terminal context-menu entry. |
| 71 | +- No-selection context-menu entry. |
| 72 | +- Right split, independent read-only provider thread, native chat mode, and Side Quest label. |
| 73 | +- Bounded removable quote card and safe first-question composition. |
| 74 | +- Unit coverage for agent choice, launch rollback, context fencing, composer handoff, and UI actions. |
| 75 | + |
| 76 | +### Phase 2 — durable product model (partially delivered) |
| 77 | + |
| 78 | +- Persist a `sideQuest` provider-thread reference rather than relying on terminal labels. |
| 79 | +- Reuse one warm Codex app-server and resume durable threads after process/app restart. |
| 80 | +- Persist unsent quoted context across app restarts. |
| 81 | +- Add Side Quest history, rename, close/archive, and source-conversation metadata. |
| 82 | +- Add `@side-quest` mention/search so a main conversation can import a bounded summary or selected |
| 83 | + messages without coupling the two live sessions. |
| 84 | + |
| 85 | +### Phase 3 — runtime parity and polish |
| 86 | + |
| 87 | +- Extend the runtime host create-tab API and enable web/paired/headless worktrees. |
| 88 | +- Add an awaited agent-readiness result so late local/SSH startup failures can close the tab and |
| 89 | + collapse its split automatically. |
| 90 | +- Add keyboard access and command-palette launch. |
| 91 | +- Add telemetry for launch, first question, context removal, and return-to-main-thread behavior. |
| 92 | +- Run interaction QA on macOS, Linux, Windows, local SSH, and high-latency SSH. |
| 93 | + |
| 94 | +## Acceptance criteria |
| 95 | + |
| 96 | +- Launching never writes to or interrupts the source terminal. |
| 97 | +- The Side Quest agent runs in the same worktree and execution environment as the source. |
| 98 | +- The created surface is native chat, not the TUI, when experimental native chat is enabled. |
| 99 | +- Selected output is visibly quoted, removable, bounded, cleaned of terminal escape data, and treated |
| 100 | + as untrusted input. |
| 101 | +- Slash commands remain valid and do not accidentally consume pending quote context. |
| 102 | +- A failed launch collapses the empty split and shows a user-facing error. |
| 103 | +- Platform-specific behavior stays behind existing runtime checks. |
0 commit comments