⛔ DO NOT MERGE — feat: upgrade @agent-relay to 8.3.0, wire headless spawn routing and runtime tracking#139
⛔ DO NOT MERGE — feat: upgrade @agent-relay to 8.3.0, wire headless spawn routing and runtime tracking#139khaliqgant wants to merge 5 commits into
Conversation
Bumps all @agent-relay/* packages to ^8.3.0 which ships Codex app-server adapter, headless agent runtime, and SpawnCliInput. Pear now tracks each agent's runtime (pty | headless) from the agent_spawned event and skips PTY snapshot/resize in attachTerminal for headless agents. The terminal pane shows a placeholder for headless agents instead of an xterm instance. Also improves the xterm.js config: lineHeight 1.2, letterSpacing 0.5, bar cursor, 10k scrollback, alt fast-scroll, macOptionIsMeta, and replaces instant display:none tab switching with a 150ms opacity fade. Deferred (noted for follow-up): - Structured output rendering for Claude (--output-format stream-json) - Structured output rendering for Codex (app-server events) - Native approval-prompt UI cards (vs y/n in terminal) - Bundled monospace font (Geist Mono / Berkeley Mono) https://claude.ai/code/session_01KXU1uAUwx3L82TMLnAmU4z
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 10 minutes and 15 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks 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 |
There was a problem hiding this comment.
3 issues found across 6 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
✅ pr-reviewer applied fixes — committed and pushed Reviewed and fixed the PR checkout. Changes made:
Verification run locally:
I did not print |
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
✅ pr-reviewer applied fixes — committed and pushed Fixed the two live unresolved cubic findings:
Also removed local ignored install artifacts created during dependency setup: Verification run:
I’m not printing |
…red-output CLIs
Claude uses --output-format stream-json and Codex has its own app-server; neither
needs an interactive PTY. spawnAgentOnce now routes these two CLIs through
spawnCli({ transport: 'headless' }) (relay 8.3.0) while shells and unknown
executables continue to use spawnPty.
The resolved runtime is set on agentRuntimes immediately after spawn so
attachTerminal skips PTY-only operations (resize, snapshot) without a race
against the async agent_spawned event.
worker_stream chunks still flow through broker:pty-chunk → xterm, so the
headless placeholder that hid the terminal entirely is removed — V1 rendering
is unaffected.
https://claude.ai/code/session_01KXU1uAUwx3L82TMLnAmU4z
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
There was a problem hiding this comment.
1 issue found across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Three bugs caught in review: 1. SpawnCliInput was missing from the @agent-relay/harness-driver import block, causing a TypeScript compile error wherever it was referenced. 2. The immediate agentRuntimes.set() after spawnCli used a bare agent name, while every other read/write in the map (agent_spawned event, syncAgents, attachTerminal) used the composite "sessionKey:name" key from getAgentRuntimeKey(). The cache miss meant the early-set optimization — intended to prevent a race between spawnAgent returning and attachTerminal reading before agent_spawned fires — was always a no-op. 3. The broker test mock's listAgents/getStatus always returned runtime:'pty' for every agent, including those spawned via spawnCli. This would overwrite the correct headless runtime in agentRuntimes on the next listAgents poll. The mock now tracks runtimes per agent in a local Map, consistent with how spawnPty/spawnCli register them. https://claude.ai/code/session_01KXU1uAUwx3L82TMLnAmU4z
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
What this PR does
@agent-relay/*packages to^8.3.0which shipsSpawnCliInputand the headless runtime discriminator ('pty' | 'headless')spawnCli({ transport: 'headless' })instead ofspawnPty()— no PTY process is created for these agents'pty' | 'headless') per session inBrokerManager.agentRuntimes;attachTerminalskips PTY snapshot/resize for headless agentsBrokerListAgentandBrokerAttachTerminalResulttypes to'pty' | 'headless'; propagatesruntimethroughagent-storelineHeight: 1.2,letterSpacing: 0.5, bar cursor, 10k scrollback, alt fast-scroll,macOptionIsMetadisplay:noneto 150ms opacity fadeCritical gap — structured output rendering is NOT in this PR
Changing from
spawnPtytospawnClistops creating a PTY process, but the output pipeline is unchanged: relay still emitsworker_streamevents → broker forwards raw chunks to renderer viabroker:pty-chunk→ xterm renders them verbatim.For Claude headless agents, those chunks are raw NDJSON from
--output-format stream-json. xterm currently displays the raw JSON, not formatted text. This is not the intended end state.Blocker: relay 8.3.0 not installed
package.jsonhas been bumped to^8.3.0but the lockfile still pins@agent-relay/harness-driverat 8.1.2.spawnCli()does not exist at runtime untilnpm installis run and committed. This must be done before this PR is mergeable.V1 plan (next PR after this merges)
Intercept
broker:pty-chunkevents in the renderer for headless agents and parse the structured format before sending to xterm:content_block_delta.textfrom{ event: { type: 'content_block_delta', delta: { type: 'text_delta', text: '...' } } }; emit clean text onlyAgentMessageDelta,FileChangePatchUpdated,ApplyPatchApprovalParams)Result: xterm shows nicely formatted human-readable output with no raw JSON visible.
V2 plan
No xterm at all for headless agents. Replace the terminal pane with custom React components — message bubbles, file-diff cards, approval dialogs — rendering the same structured events as native Pear UI.
Deferred
npm install) — required before mergey/n?prompts and render as Pear dialog cardsGenerated by Claude Code