Skip to content

feat(server): spawn threads into another project - #126

Merged
lukemaj merged 2 commits into
mainfrom
feat/114-spawn-into-project
Oct 1, 2026
Merged

lukemaj merged 2 commits into
mainfrom
feat/114-spawn-into-project

Conversation

@lukemaj

@lukemaj lukemaj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What: Agents can spawn child or top-level threads in another project in the same environment.
Why: Spawning inherited the caller's project and workspace, preventing Drafters from working in a target Satrapy.
So what: This PR closes #114 when merged; the coordinator reviews it and performs the remaining installed desktop acceptance. No merge is authorized here.

Closes #114. Parent #113. Advances the Objective's requirement that Drafters start in any project as children or top-level threads.

spawn_thread accepts optional projectId, mode: child | top-level, and runtimeMode. Explicit target placement resolves the target's local/worktree preference, including non-repository and unborn-HEAD fallback. New worktrees reuse the project setup runner with sync/async semantics and visible failure activities. Caller Prism kits remain the routing source. Cross-project child reportback and interruption remain available through children scope. Top-level threads use ordinary sidebar-visible IDs and no parent/reportback; follow-up tools accept projectId with scope: project. Calls without selectors keep existing behavior.

Elon record

Requirements and who asked: The user and #114 require target project placement/instructions, child reportback/interrupt, top-level sidebar/read/message, runtime mode and target workspace preference.
Deleted: Cross-environment placement, per-target Prism policy, creator-access metadata, extra dispatchers, parallel writers, and #122 parent-stop expansion.
Bottleneck: Spawn placement and follow-up project scope, plus setup behavior before actual provider launch.
Checked myself: Read #114/#113 and full inherited diff, inspected real provider cwd resolution and sidebar subagent filters, verified clean base/live origin/main; focused tests exercise real engine/projections/provider reactor at a fake provider boundary.

Current delivery state

Ready for human review: current-head CI and cumulative independent review passed. Installed acceptance remains coordinator-owned. The original Test Server 2 run exposed src/mcp/alwaysLoad.test.ts:35:32, AssertionError: expected 776 to be less than 600. Commit e740c6c7cc4357573d5af3bb2f56a4049c22240c shortens only the description to 509 characters, retaining required wording and field documentation without relaxing the test. pnpm exec vp test run apps/server/src/mcp/alwaysLoad.test.ts: 2 passed; touched vp lint and server tsc --noEmit exited 0; git diff --check passed. Prior backend behavior and its proof inputs are unchanged. Current-head CI passed Check, Test, all three server shards, Rust, Release Smoke and Fork Stack Model. No failed or pending checks remain; optional jobs skipped.

Proof and review

  • Candidate: e740c6c7cc4357573d5af3bb2f56a4049c22240c; base 0db8b3f19549ef369a611883e111ae20760364c8.
  • pnpm exec vp test run apps/server/src/mcp/toolkits/threads/spawnIntoProject.test.ts apps/server/src/orchestration/ThreadSettlementReactor.test.ts -t 'spawn into another project|settled cross-project child': 16 passed, 59 skipped. Covers 15 spawn cases and cross-project settlement.
  • Earlier combined run across spawn, childReportState, roles, interruptThread, childUsageLimitResume, childThreads and ProjectSetupScriptRunner passed 62 and failed four new fixtures. Those reused caller workspace roots and hit OrchestrationCommandInvariantError: Orchestration command invariant failed (project.create): Active project 'project-threads' already exists for workspace root .... Distinct target roots fixed the fixtures and the final 16-case command proves them; 51 passing tests in the six unchanged files remain valid.
  • pnpm exec tsc --noEmit --project apps/server/tsconfig.json --pretty false: exit 0 on final commit, two existing suggestions.
  • pnpm exec vp lint apps/server/src/mcp/toolkits/threads/handlers.ts apps/server/src/mcp/toolkits/threads/tools.ts apps/server/src/mcp/toolkits/threads/spawnWorkspace.ts apps/server/src/mcp/toolkits/threads/spawnSetup.ts apps/server/src/mcp/toolkits/threads/spawnIntoProject.test.ts apps/server/src/mcp/toolkits/threads/handlers.testFixtures.ts apps/server/src/mcp/toolkits/threads/roles.test.ts apps/server/src/mcp/toolkits/threads/childUsageLimitResume.test.ts apps/server/src/orchestration/ThreadSettlementReactor.test.ts: exit 0.
  • git diff --check: passed. node scripts/fork-features.mjs check: fork-features: OK (19 features).
  • Earlier interrupt fixture error Error: All fibers interrupted without error was corrected by keeping the fiber in the surrounding scope through settlement. Earlier message fixture error AssertionError: expected 'Independent reply.' to contain 'Follow up.' was corrected by requiring the delivered message to exist without assuming timestamp order.
  • Targeted lint, server typecheck and fork provenance passed. No repo-wide checks.
  • Independent reviewer sub.sub.sub.46b03420-8643-4703-8756-8602f14b39fb.dispatcher-b307e728dc20.dispatcher-cf11ceba5ed3.reviewer-e026cb63c976 (Prism-selected GPT-6-Luna / Codex): no blockers on current head. review/independent: success posted by lukemaj; compatibility with live main 93bcc9b57fd1520cddc3944952d6a8fea1beaec3 checked, no material interaction. The cumulative ten-file diff is reviewed against intended main; live-base movement from original 0db8b3f to 93bcc9b came from fix(web): open Issue links beside their thread #124, with only disjoint feature entries sharing docs/fork-features.md. No rebase was needed or performed. Prior original-base full review and unchanged backend proof reused; fresh prompt regression/lint/typecheck prove the one-line repair.
  • Worker: sub.sub.sub.46b03420-8643-4703-8756-8602f14b39fb.dispatcher-b307e728dc20.dispatcher-cf11ceba5ed3.worker-e5b9f300c5aa.

Agent Observer sync and publish succeeded: cost comment. Measurement attribution gap: 0 attributed responses and 67 unbound sessions despite 2,733 excluded responses. This is missing task attribution, not a measured $0 task cost; no Observer repair is in scope.

Assumptions and remaining acceptance

  • Explicit project selectors extend the existing project scope within one environment; no creator metadata or target Prism policy is introduced.
  • The target's HEAD is the worktree base; omission of a target selector on child spawn retains caller checkout behavior.
  • Setup failure stays visible and the agent still starts, matching normal bootstrap semantics.
  • Only backend proof ran with isolated temporary SQLite state and a fake provider boundary. Actual target AGENTS.md transcript, installed desktop child reportback/interrupt and top-level sidebar/read/message remain for the fleet coordinator after merge. Browser/computer use was not authorized; no pairing token or live app/state was touched.
  • New helpers/tests are registered in fork provenance; upstream settlement test changes are two lines in an existing allowlisted file.
  • Website/SEO impact: none; server MCP capability only, no public website or URLs changed.
  • No versioning by design. No merge, installation or release performed.

Implemented and coordinated with GPT-6.1-Sol through the Codex harness; independently reviewed with GPT-6-Luna through the Codex harness, selected by Prism.

@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 1, 2026
@lukemaj

lukemaj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Agent work on this PR

Estimated cost $0.00 · 0 responses · 70 sessions · 4.1 h wall time

Model Responses Tokens Estimated cost

Flags: 34 human corrections · 51 large tool outputs · 3 permission requests · 11 repeated commands · 2 repeated failures · 16 repeated reads · 9 repeated skill loads · 70 sessions with usage bound to no task

Details: snapshot, prices, coverage, counters
  • Task toolboxmd/chromeria#114: outcome unknown (recorded acceptance only; a finished process never implies it).
  • Proof: Start threads in another project, as a child or top-level #114
  • Snapshot 90e2741bd0e26f63736668410eed530558efadd08f270646329d5bac88142788, records up to 2026-10-01 19:54 UTC.
  • 70 sessions on claude, codex; AgentsMD 14.4.1, 14.6.0.
  • Not counted: 2,851 responses (at least $106.34) in sessions shared with other PRs that worked in no single PR's checkout.
  • 580 responses in these sessions worked on other PRs and are counted there.
  • Totals reconcile with the measured sessions: yes. Evidence complete: yes.
  • Prices: list-price estimate from T3 local rate table (path withheld) as of 2026-09-28, schedule 696aae45933d0a684a015d3f08cfb6f1aa2fef02e7d272b4689e3a692ea04fff. Unknown prices stay unknown, never zero.
    • T3 LiteLLM rate table when present; bundled schedule covers the rest.
  • Harness-reported cost: none reported.
  • Usage totals are not billing. Subscription spending is separate and is never posted as spend.
  • Crashed runs are counted separately: 0.

Token counters by model (native counter semantics; never added across semantics):

Selected rates (USD per million tokens). These rates value the report at the selected schedule date; they do not establish historical prices or subscription spending.

Model Input tier Input Cache read Cache write Other output Reasoning

Other output and reasoning are priced without double counting inclusive native output. Missing rates remain unknown.

Local measurement from native records; usage totals are not billing. Updated in place by agent-observer publish.

@lukemaj

lukemaj commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

What: Independent review found no blocking issue in PR #126.
Why: The exact candidate implements same-environment cross-project child and top-level spawning through the target project context and scope.
So what: The coordinator can complete installed desktop acceptance and decide merge.

Independent review verdict: no blockers on exact head a16aa9d0099841102d71039e66f919b7bfc7ba02, against base 0db8b3f19549ef369a611883e111ae20760364c8. Reviewer thread: sub.sub.sub.46b03420-8643-4703-8756-8602f14b39fb.dispatcher-b307e728dc20.dispatcher-cf11ceba5ed3.reviewer-e026cb63c976 (GPT-6-Luna, Codex harness).

Reviewed the complete ten-file candidate diff and relevant consumers. Confirmed the provider launch resolves cwd from the spawned thread's target project/worktree; the target project settings drive local/worktree placement and setup scripts run with the target project root and worktree; Prism kit selection remains sourced from the caller project; default runtime mode remains full access and explicit runtimeMode is preserved; child reportback and interruption retain parent-linked IDs across projects and restart restoration; top-level IDs are not classified as subagents and are sidebar-visible; list/read/message/interrupt support explicit project scope while omitted selectors preserve existing behavior.

Proof inspected: reported exact-head focused run passed 16 cases (15 spawn cases plus cross-project settlement; 59 skipped), server TypeScript check, targeted lint, diff check and fork provenance check all passed. I did not rerun those already-valid checks. Actual target AGENTS.md transcript and installed-desktop child/top-level acceptance remain coordinator-owned; no browser or live app was used.

@github-actions github-actions Bot added the size:L label Oct 1, 2026
@lukemaj
lukemaj marked this pull request as ready for review October 1, 2026 19:49
@lukemaj
lukemaj marked this pull request as draft October 1, 2026 19:50
@lukemaj

lukemaj commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor Author

What: Independent review found no blocking issue on PR #126's current head.
Why: The full cumulative spawn change and its one-line prompt-budget repair remain compatible with the live-main changes inspected.
So what: The coordinator can continue installed desktop acceptance and make the merge decision.

Cumulative verdict: no blockers for PR head e740c6c7cc4357573d5af3bb2f56a4049c22240c relative to intended live main 93bcc9b57fd1520cddc3944952d6a8fea1beaec3 (original common base 0db8b3f19549ef369a611883e111ae20760364c8). Reviewer thread: sub.sub.sub.46b03420-8643-4703-8756-8602f14b39fb.dispatcher-b307e728dc20.dispatcher-cf11ceba5ed3.reviewer-e026cb63c976 (GPT-6-Luna, Codex harness).

Cumulative scope checked: GitHub compare reports the original base as merge base, with the PR two commits ahead and one commit behind live main. Its cumulative candidate contains ten paths: the nine server/test paths plus docs/fork-features.md. All ten were covered by the full review of a16aa9d0099841102d71039e66f919b7bfc7ba02; the only subsequent candidate delta is the one-line spawn_thread description change in tools.ts, reviewed at e740c6c7cc4357573d5af3bb2f56a4049c22240c. There is no unreviewed candidate path or diff beyond those.

For live-main compatibility, #124's web changes do not touch the server spawn, setup, project-scope or provider-launch paths. The shared docs/fork-features.md edits are separate feature-entry hunks; #124's scripts/fork-upstream-edits.txt additions list web files absent from this candidate. I found no material interaction. This review covers the cumulative PR changes and their compatibility with the inspected main changes; it is not a rebased/merged-candidate check.

Proof reuse: the candidate's reported focused spawn/settlement tests and typecheck/lint remain applicable to unchanged backend code; the reported alwaysLoad.test.ts (2 passed), touched-file lint, server TypeScript check and diff check cover the one-line repair. No proof was rerun. New-head CI is pending. Installed desktop acceptance and the target AGENTS.md transcript remain coordinator-owned.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.5 KiB +38 B (+0.3%) 15.1 KiB ✅
Codex Thread snapshot wire 7.1 KiB 7.1 KiB −1 B (−0.0%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.4 KiB 6.5 KiB +39 B (+0.6%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 56.2 KiB 56.3 KiB +44 B (+0.1%) 66.4 KiB ✅
Codex Live turn messages 9 10 +1 (+11.1%) 21 ✅
Claude Total thread wire 13.5 KiB 13.5 KiB +17 B (+0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.1 KiB 7.1 KiB 0 B (0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.4 KiB 6.4 KiB +17 B (+0.3%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 57.0 KiB 57.0 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: 93bcc9b · PR result: e740c6c · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@lukemaj
lukemaj marked this pull request as ready for review October 1, 2026 20:00
@lukemaj
lukemaj merged commit 6f56eb9 into main Oct 1, 2026
27 of 28 checks passed
@lukemaj
lukemaj deleted the feat/114-spawn-into-project branch October 1, 2026 20:05
@lukemaj

lukemaj commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged by the coordinator as 6f56eb9 (squash) at verified head e740c6c: diff read, CI green on that head, review/independent success by lukemaj on that head. Worktree and branch retired. Installed-desktop checks (child and top-level in another project, target AGENTS.md loaded) follow with the next Chromeria build install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start threads in another project, as a child or top-level

1 participant