feat(session): amicode_session tool — spawn sessions as background tabs - #641
Draft
aarontrowbridge wants to merge 1 commit into
Draft
Conversation
…bs (#639) A session can now spawn new sessions that surface as background tabs in the parent's pane. Three pieces: - plugin (amicode_session): the pack's FIRST server-mutating tool. Uses the engine-provided PluginInput.client (server-bound SDK) to create and immediately prompt 1-4 children; mode=fork seeds from this session's history via /session/{id}/fork + a metadata PATCH. Children stamp metadata {spawned_by, spawned_depth}. Policy (count cap 4, soft depth cap 2 overridable with force, model precedence) lives in session_spawn.ts, unit-tested (20 tests). - app (session route): an effect in ResolvedTargetSessionRoute watches the server session store for sessions stamped spawned_by == this route's session and opens each as a background tab via tabs.addSessionTab — never navigates, never steals focus; idempotent via an opened-set. Selection logic extracted to session/spawn-tabs.ts (8 bun tests). - app-bundle manifest: hashes for the modified session.tsx + the two new overlay files (drift gate green). Test notes: the 7 failing tests in the extension suite are pre-existing on main (environmental: vendored binary, pin fixtures, staged bins) — this branch adds none. The overlay app typecheck is not a CI lane (composition proof remains the pre-cutover gate); session.tsx passes esbuild parse and review, consistent with current overlay-PR practice. Closes #639
7 tasks
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Aug 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #639
What
A session can now spawn new sessions that surface as background tabs beside the parent — fan-out for parallel work, fork-mode for branching a thread mid-conversation.
amicode_sessiontoolPluginInput.client(first server-mutating tool in the pack), posts the prompt immediately (explicit model bypasses draft-readiness retries), stampsmetadata {spawned_by, spawned_depth}.mode: "fork"seeds from this session's history via the native fork endpoint + metadata PATCH.session_spawn.ts)force, model precedence (arg > parent's model > server default), hey-api unwrap, honest summaries.spawned_by == this route's session; opens each child as a background tab (tabs.addSessionTab— never navigates, no focus steal); idempotent via opened-set. Selection logic insession/spawn-tabs.ts(bun tests).session.tsx+ the two new overlay files — drift gate green locally.Design decisions (from #639 discussion)
addSessionTabnever navigates; spawning cannot steal focus.promptAsyncwith explicit model; children churn from birth (cost noted in the tool description).force: trueoverrules; depth is derived from the session's OWN stamp, not the caller's claim, so the cap is enforced by construction.Test evidence
test/session_spawn.test.ts— 20 tests, green.spawn-tabs.test.ts— 8 tests, green (bun).tsc --noEmitclean;agents_md+amicode_toolssuites green.drift_gate.mjs: PASS (556 files) — including the Complete the .18 pin: re-extract the app-bundle overlay + re-record the service-contract fixtures (unblocks #622 and main) #636-re-extracted state this branch rebased onto.session.tsxpasses esbuild parse + review, consistent with current overlay-PR practice.Sequencing note
Rebased onto the post-#636 main — the app-bundle-gate red that #639 was originally sequenced behind is resolved on this base.