Two ships shipped the queue-into-prompt path: e6bd03b added the queue
field to OrchestrationTaskRequest + renderQueueBlock in
src/lib/orchestration/renderers.ts; 1cacfd2 plumbed it through home/'s
render.ts + /api/dispatch. Neither was covered by the existing
home/render self-tests (which only verified that all 12 intents
produce non-empty strings).
A future change to renderQueueBlock — different header wording, item
ordering, overflow threshold — would silently break both stacks
without any regression signal. Four new cases pin the contract:
• queue items render under 'User's prompt queue for this project'
and are 1-indexed
• empty queue → no block (suppression for the trivial case)
• undefined queue → no block (back-compat for callers that don't
plumb queue yet)
• queue > 10 items → first 10 + '…and N more' overflow indicator
home/render: 16 tests (was 12); full home/ suite total: 89/89.
tsc clean.
home/render.ts gained an optional queue field (mirroring
OrchestrationTaskRequest.queue from e6bd03b); home/server.ts's
/api/dispatch now sources the queue from caller-supplied body OR
falls back to /tmp/agent-queue-<tab> (the file mirror cloud's
/api/beacon/queue/[tab] writes for cross-stack visibility). Either
source threads through buildPromptForDispatch → renderPromptForDispatch
→ renderQueueBlock, so a home/-dispatched prompt now carries the
same 'User's prompt queue for this project' block the cloud path
already had. Closes the asymmetry: home/ and cloud both surface
queue context to the agent now.
Queue items added after the drained head still render — the agent
sees both what they're currently working on (the dispatch prompt
itself) and what's queued behind it.
tsc clean, npm run test:home 85/85.
Seventh milestone of the greenfield rewrite. home/render.ts is now a thin
adapter over src/lib/orchestration/renderers.ts:renderTaskForAdapter — the
existing SSOT for prompt text. The home/ Brain produces full, agent-ready
prompts for every canonical intent instead of the M6 placeholder string.
home/render.ts renderPromptForDispatch({project, projectPath?,
intent, adapter?, customInstructions?}) → string
Reuses renderTaskForAdapter; no duplication of
the per-intent bodies. Inline self-test covers all
12 canonical intents (next_best, test_and_fix,
quality, full_audit, product, ux_review,
deploy_check, commit_push, close_session,
hard_stop, continue, custom) — 12/12 pass.
home/server.ts buildPromptForDispatch now uses the new renderer.
The queue-drain case (decision.action.prompt is
set) collapses to intent="custom" with the queue
item as customInstructions — matches today's
flip in /api/orchestration/run when a queueHead
exists.
POST /api/dispatch body now accepts an optional projectPath so the renderer
can produce "Work on the project at /home/g/dev/<x>" instead of falling
back to the project name. Missing path is harmless — agents are already
in the right cwd.
What this commit deliberately does NOT do:
- write a worker that consumes bridge.dispatch (next session — the new
M8 milestone, since M7 split cleanly into render + dispatch consumer)
- retire /api/control/dispatch on Vercel (parity check first)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>