Repository navigation
feat(server): route delegated work through spawn_thread roles - #104
Merged
Merged
Conversation
The tool-instruction block now tells every coordinating thread to delegate with spawn_thread roles, start a dispatcher for one-PR jobs, and recover a failed child with interrupt_thread, retry, then escalation. prism_submit stays only as the fallback until #97 removes it. spawn_thread and interrupt_thread descriptions carry the mechanics; a test pins that Prism role kits ship no default instructions. Refs #96 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Independent review of d2bea2e: request changes
|
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 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.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
2 tasks
Contributor
Author
|
Independent review of 6d52607: approve |
This was referenced Oct 1, 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.
What: Every coordinating thread's launch prompt and the
spawn_thread/interrupt_threaddescriptions now carry the routing rules: delegate with roles, start a dispatcher for one-PR jobs, recover a failed child by interrupting it and, once settled, starting retry, then escalation.Why: With the runner retiring, whoever coordinates decides lane, recovery order and review; the planner is never spawned, so only the tool-instruction block reaches it.
So what: The planner reviews and merges this PR, stages the build, then runs the two live tasks in #96 (planner dispatches itself; planner starts a dispatcher).
Refs #96
New instruction text (
apps/server/src/mcp/toolInstructions.ts, 1,606 characters)The three routing sentences come right after the shell rule. The
prism_submitsentence now applies only when no dispatcher can start; #97 removes it and the defect paragraph after the live tasks.Tool descriptions (
apps/server/src/mcp/toolkits/threads/tools.ts)spawn_thread: > Use when another agent should do work: a bounded task, a review, or a whole job that ends in one PR (role: dispatcher). Use it instead of codex exec, claude -p, opencode run or grok in the shell: the user cannot see those runs. role applies that Prism role's kit and first eligible model, skipping providers at a usage limit: worker with a lane by difficulty, reviewer, and retry then escalation to replace a failed child. Or name instance, model and effort. Each finished turn of the child reports its final reply here unless reportBack is false. Follow up with read_thread and message_thread.interrupt_thread: "Use it before replacing a stalled, failed or usage-limit-hit child with role retry, then escalation, so two threads never write to the same branch."These match the current code:
pickRoleModelskips providers thatisProviderBlockedmarks as limit-hit, andreportBackdefaults to true.Default Prism role instructions
None ship.
DEFAULT_PRISM_ROLE_KITSisSchema.decodeSync(PrismRoleKits)({}), and every kit'sinstructionsdefaults to""andskillsto[](packages/contracts/src/prism.ts). Settings has no other default. A new test inpackages/contracts/src/prism.test.tspins this for all six roles.Proof (head 6d52607, Node 24.13.1)
vp test run apps/server/src/mcp/toolInstructions.test.ts apps/server/src/mcp/alwaysLoad.test.ts packages/contracts/src/prism.test.ts apps/server/src/mcp/toolkits/threads: 10 files, 71 tests passed (includes the Codex 3,000-character runtime cap test).tsc --noEmitinapps/serverandpackages/contracts: exit 0, no errors.vp lintandvp fmt --checkon the 5 changed files: clean.bash scripts/fork-check.sh --upstream upstream:fork-features: OK (19 features). fork-check: OK.interruptedorno_active_run), never oninterrupt_requested;spawn_threadnotesreportBack: false.handlers.tsis untouched (PR feat(server): direct child threads resume on their own after a usage limit #72 rebase owns it).Elon record
spawn_thread, and the dispatcher-versus-planner comparison must still be measured, so the dispatcher stays the default with a comparison-job escape.prism_submit-first rule (it is now the fallback, removed fully in Remove the Model Router runner hooks from Chromeria #97); restating AgentsMD briefs, proof and review.buildRuntimeInstructionsappends the block for all six harnesses (tests); the picker skips limit-hit providers inroles.ts;DEFAULT_PRISM_ROLE_KITSdecodes to empty instructions; the block stays under Codex's cap.🤖 Generated with Claude Code