Skip to content

Harden Codex GPT-5.5 worker spawning#856

Merged
khaliqgant merged 8 commits into
mainfrom
skill/running-headless-orchestrator-nohup
May 15, 2026
Merged

Harden Codex GPT-5.5 worker spawning#856
khaliqgant merged 8 commits into
mainfrom
skill/running-headless-orchestrator-nohup

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

Summary

  • add GPT-5.5 as the Codex registry default and regenerate TypeScript/Python model metadata
  • add GPT-5.5 pricing entries and update cost expectations
  • guard Codex worker spawning by probing the local codex debug models catalog and falling back to GPT-5.4 when GPT-5.5 requires a newer CLI
  • extend the guard to explicit --model/-m args and update workflow launchers to use the registry constant

Validation

  • cargo check --bin agent-relay-broker
  • cargo test worker::tests
  • npx vitest run src/cost/tracker.test.ts
  • cd packages/sdk && npx vitest run src/__tests__/models.test.ts

@khaliqgant khaliqgant requested a review from willwashburn as a code owner May 15, 2026 11:10
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Review Change Stack

Warning

Rate limit exceeded

@khaliqgant has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 30 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d9291fd2-5942-47e7-8551-f16f4879bc10

📥 Commits

Reviewing files that changed from the base of the PR and between b15fcdd and f1fa7cd.

📒 Files selected for processing (19)
  • .trajectories/completed/2026-05/traj_0o6gb2wvk59t.json
  • .trajectories/completed/2026-05/traj_0o6gb2wvk59t.md
  • .trajectories/completed/2026-05/traj_4vucir4qvqa2.json
  • .trajectories/completed/2026-05/traj_4vucir4qvqa2.md
  • .trajectories/completed/2026-05/traj_7uznwzoxbao6.json
  • .trajectories/completed/2026-05/traj_7uznwzoxbao6.md
  • .trajectories/completed/2026-05/traj_9fdv7hxm0b60.json
  • .trajectories/completed/2026-05/traj_9fdv7hxm0b60.md
  • .trajectories/completed/2026-05/traj_erzd7j9nto9r.json
  • .trajectories/completed/2026-05/traj_erzd7j9nto9r.md
  • .trajectories/completed/2026-05/traj_hfkww5z7trxn.json
  • .trajectories/completed/2026-05/traj_hfkww5z7trxn.md
  • .trajectories/completed/2026-05/traj_wzzboitm85ee.json
  • .trajectories/completed/2026-05/traj_wzzboitm85ee.md
  • .trajectories/index.json
  • CHANGELOG.md
  • packages/config/src/cli-registry.generated.ts
  • packages/sdk/src/__tests__/models.test.ts
  • packages/shared/cli-registry.yaml
📝 Walkthrough

Walkthrough

Promotes GPT-5.5 across registries and SDKs, implements local Codex CLI catalog probing and model-arg rewrite in worker spawn (spawn now returns enriched AgentSpec), updates CI/workflows/dependency pins/pricing/tests, adds CLI spawn flags and broker readiness polling, and records trajectory artifacts.

Changes

GPT-5.5 Model Promotion and Codex Fallback Hardening

Layer / File(s) Summary
CI and Dependency Setup
.github/workflows/build-broker-binary.yml, .github/workflows/publish.yml, .github/workflows/rust-ci.yml, .github/workflows/test.yml, Cargo.toml
Disable Rust binary caching (cache-bin: false) in Swatinem/rust-cache@v2 steps across workflows and bump relaycast to =1.0.2.
Model registry & generated constants
packages/config/src/cli-registry.generated.ts, packages/sdk-py/src/agent_relay/models.py, packages/shared/cli-registry.yaml, packages/sdk/src/__tests__/models.test.ts, .prettierignore
Bump Codex CLI version to 0.130.0; add gpt-5.5/openai/gpt-5.5 identifiers and metadata; set Codex default to gpt-5.5; update UI options and tests; ignore generated registry in Prettier.
Codex model fallback & worker spawn
src/worker.rs
Change WorkerRegistry::spawn to return AgentSpec; detect explicit --model/-m flags, probe local codex debug models (1.5s timeout), parse JSON (ignore upgrade-required), rewrite args to a fallback when needed, set spec.model, and add unit/async tests covering detection, replacement, and JSON shapes.
CLI spawn wiring & broker readiness
src/cli/commands/agent-management.ts, src/cli/commands/agent-management.test.ts
Add --skip-relay-prompt flag passed to spawnPty; createSdkClient waits/polls broker readiness tolerating warmup responses; waitForBrokerClient uses readiness polling helper; tests updated to assert skipRelayPrompt behavior.
Telemetry & spawn propagation
src/main.rs
Use spawn-returned effective_spec throughout HTTP API, relaycast WS, and JSON-fallback spawn paths to populate telemetry, persisted agent spec, events, and API replies (includes runtime, provider, cli, and model).
Pricing and cost-tracker updates
src/cost/pricing.ts, src/cost/tracker.test.ts
Add gpt-5.5 and openai/gpt-5.5 pricing entries; increase gpt-5.4 outputPer1M values; update "Last verified" date and cost-tracker tests to use gpt-5.5.
Workflow agent model updates
workflows/cloud-connect/*, workflows/relay-e2e-meta-workflow.ts
Replace CodexModels.GPT_5_4 with CodexModels.GPT_5_5 in multiple workflow agent definitions.
Tests & small housekeeping
src/auth.rs, src/routing.rs, src/swarm.rs
Allow clippy lint in auth test module, adjust mock expectation ownership, convert Vec fixtures to array literals in routing tests, and move #[cfg(test)] mod tests in swarm.
Trajectory artifacts
.trajectories/completed/2026-05/*, .trajectories/index.json
Add many completed trajectory JSON/MD/trace artifacts documenting GPT-5.5 promotion, fallback hardening, relay CLI bootstrap, broker headless reliability, SDK bump, and update index timestamp/entries.

Sequence Diagram

sequenceDiagram
  participant Client
  participant WorkerRegistry
  participant Resolver
  participant CodexCLI
  participant BrokerMain
  Client->>WorkerRegistry: spawn(spec, args)
  WorkerRegistry->>Resolver: resolve_model_flag_for_cli(provider, args)
  Resolver->>CodexCLI: `codex debug models` (1.5s timeout)
  CodexCLI-->>Resolver: JSON models list / timeout
  Resolver-->>WorkerRegistry: Some(model) or None
  WorkerRegistry->>WorkerRegistry: rewrite args if unsupported, set spec.model
  WorkerRegistry-->>Client: Ok(effective_spec)
  Client->>BrokerMain: persist effective_spec, emit telemetry/event
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • willwashburn

Poem

"🐰 I hopped through config, docs, and code,
Peeked a catalog where new models goad.
A rewrite here, a readiness try,
Now 5.5 leads and tests pass by.
Pipelines hum — the meadow glows."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.19% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: hardening Codex GPT-5.5 worker spawning with fallback logic and registry updates.
Description check ✅ Passed The PR description covers all key changes (registry default, pricing, fallback logic, workflow updates) and includes comprehensive validation steps, though the template sections are not explicitly labeled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch skill/running-headless-orchestrator-nohup

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.trajectories/completed/2026-05/traj_2yicjxgajt0a.json:
- Line 47: Replace the absolute local path stored in the JSON key "projectId"
with a repo-stable identifier (e.g., a repo slug, relative path, or remove the
key entirely) to avoid leaking user-specific filesystem details; update the
"projectId" value in this trajectory JSON and apply the same scrub to all other
new trajectory JSON files added in this PR so none contain absolute /Users/...
paths.

In @.trajectories/index.json:
- Around line 406-433: The index entries (e.g., objects
"traj_n8duofq5vq1a","traj_7zu7et53ph3l","traj_2yicjxgajt0a","traj_hrsndfzk0qay")
currently store machine-local absolute paths in their "path" fields; change them
to repository-relative paths (for example
".trajectories/completed/2026-05/traj_*.json") so the index is portable across
machines/CI, and update whatever writer that emits these entries to build paths
relative to the repo root (use the same relative format used elsewhere in the
repo) instead of using process-specific absolute paths.

In `@packages/shared/cli-registry.yaml`:
- Around line 33-45: The CLI registry YAML changes (new/edited model entries
gpt_5_5 and gpt_5_4 in packages/shared/cli-registry.yaml) are not reflected in
the generated artifacts causing CI failures; run the model codegen task (npm run
codegen:models), review the generated outputs for the models referenced
(gpt_5_5, gpt_5_4), and commit all updated generated files produced by that
command so the generated-model artifacts stay in sync with the registry edits.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 43f1fad9-6620-41e0-9329-9452e7d8084c

📥 Commits

Reviewing files that changed from the base of the PR and between a7ef2fc and 12ee113.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • .github/workflows/build-broker-binary.yml
  • .github/workflows/publish.yml
  • .github/workflows/rust-ci.yml
  • .github/workflows/test.yml
  • .trajectories/completed/2026-05/traj_2yicjxgajt0a.json
  • .trajectories/completed/2026-05/traj_2yicjxgajt0a.md
  • .trajectories/completed/2026-05/traj_7zu7et53ph3l.json
  • .trajectories/completed/2026-05/traj_7zu7et53ph3l.md
  • .trajectories/completed/2026-05/traj_hrsndfzk0qay.json
  • .trajectories/completed/2026-05/traj_hrsndfzk0qay.md
  • .trajectories/completed/2026-05/traj_n8duofq5vq1a.json
  • .trajectories/completed/2026-05/traj_n8duofq5vq1a.md
  • .trajectories/index.json
  • Cargo.toml
  • packages/config/src/cli-registry.generated.ts
  • packages/sdk-py/src/agent_relay/models.py
  • packages/sdk/src/__tests__/models.test.ts
  • packages/shared/cli-registry.yaml
  • src/cost/pricing.ts
  • src/cost/tracker.test.ts
  • src/worker.rs
  • workflows/cloud-connect/fix-agent-relay-utils-bundling.ts
  • workflows/cloud-connect/fix-cloud-connect-claude-hang.ts
  • workflows/cloud-connect/validate-cloud-connect-e2e.ts
  • workflows/relay-e2e-meta-workflow.ts

},
"commits": [],
"filesChanged": [],
"projectId": "/Users/khaliqgant/Projects/AgentWorkforce/relay",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove absolute local path from committed trajectory metadata.

Line 47 stores an absolute machine path (/Users/...) including a local username. That leaks environment-specific identifier data into VCS. Use a repo-stable identifier (or omit projectId) and apply the same scrub to the other new trajectory JSON files in this PR.

Suggested change
-  "projectId": "/Users/khaliqgant/Projects/AgentWorkforce/relay",
+  "projectId": "AgentWorkforce/relay",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"projectId": "/Users/khaliqgant/Projects/AgentWorkforce/relay",
"projectId": "AgentWorkforce/relay",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.trajectories/completed/2026-05/traj_2yicjxgajt0a.json at line 47, Replace
the absolute local path stored in the JSON key "projectId" with a repo-stable
identifier (e.g., a repo slug, relative path, or remove the key entirely) to
avoid leaking user-specific filesystem details; update the "projectId" value in
this trajectory JSON and apply the same scrub to all other new trajectory JSON
files added in this PR so none contain absolute /Users/... paths.

Comment thread .trajectories/index.json
Comment on lines +33 to 45
version: '0.130.0'
install: 'npm install -g @openai/codex'
models:
gpt_5_5:
id: 'gpt-5.5'
label: 'GPT-5.5 — Frontier model for complex coding, research, and real-world work.'
default: true
reasoning_efforts: ['low', 'medium', 'high', 'xhigh']
default_reasoning_effort: 'xhigh'
gpt_5_4:
id: 'gpt-5.4'
label: 'GPT-5.4 — Frontier model for complex coding, research, and real-world work.'
default: true
label: 'GPT-5.4 — More affordable model for complex coding and professional work.'
reasoning_efforts: ['low', 'medium', 'high', 'xhigh']
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Codegen outputs are still out of sync with this registry source.

CI is currently failing on Codegen Models / codegen with generated-model drift after these YAML edits. Please run npm run codegen:models and commit all regenerated artifacts before merge.

Also applies to: 534-536

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/shared/cli-registry.yaml` around lines 33 - 45, The CLI registry
YAML changes (new/edited model entries gpt_5_5 and gpt_5_4 in
packages/shared/cli-registry.yaml) are not reflected in the generated artifacts
causing CI failures; run the model codegen task (npm run codegen:models), review
the generated outputs for the models referenced (gpt_5_5, gpt_5_4), and commit
all updated generated files produced by that command so the generated-model
artifacts stay in sync with the registry edits.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.trajectories/index.json (1)

406-488: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use repository-relative paths for trajectory records.

At Line 411, Line 418, Line 425, Line 432, and throughout Lines 439-488, path values are machine-local absolute paths. This makes the index non-portable and leaks local environment details.

💡 Proposed fix
- "path": "/Users/khaliqgant/Projects/AgentWorkforce/relay/.trajectories/completed/2026-05/traj_n8duofq5vq1a.json"
+ "path": ".trajectories/completed/2026-05/traj_n8duofq5vq1a.json"

Apply the same normalization to all added entries in this block.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.trajectories/index.json around lines 406 - 488, The trajectory index
entries (e.g., keys "traj_n8duofq5vq1a", "traj_7zu7et53ph3l",
"traj_2yicjxgajt0a", "traj_hrsndfzk0qay", "traj_4t07itef99ug" and the other
traj_* entries in this block) contain machine-local absolute paths in their
"path" fields; change each "path" value to the repository-relative path (for
example ".trajectories/completed/2026-05/<filename>.json") so all records are
portable and do not leak local environment details, applying this normalization
consistently across the whole block shown.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.trajectories/completed/2026-05/traj_fh8oosbijpwc.md:
- Around line 20-23: Replace all machine-local absolute paths in the trajectory
doc entries with repo-relative or generic references: remove occurrences of
"/Users/..." and instead say something like "sibling relaycast repo" or "sibling
repo containing `@relaycast/sdk` source"; update the lines that contain the
sentence starting "Relaycast Track A implementation belongs in sibling repo ..."
and any other occurrences (e.g., the mentions at lines where the absolute path
is embedded) so no user-home paths remain and references point to the sibling
repo or package name instead.

---

Duplicate comments:
In @.trajectories/index.json:
- Around line 406-488: The trajectory index entries (e.g., keys
"traj_n8duofq5vq1a", "traj_7zu7et53ph3l", "traj_2yicjxgajt0a",
"traj_hrsndfzk0qay", "traj_4t07itef99ug" and the other traj_* entries in this
block) contain machine-local absolute paths in their "path" fields; change each
"path" value to the repository-relative path (for example
".trajectories/completed/2026-05/<filename>.json") so all records are portable
and do not leak local environment details, applying this normalization
consistently across the whole block shown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8df0e7df-bf59-4163-9115-c2724ff94afc

📥 Commits

Reviewing files that changed from the base of the PR and between 12ee113 and 9a4f10f.

📒 Files selected for processing (20)
  • .trajectories/completed/2026-05/traj_4t07itef99ug.json
  • .trajectories/completed/2026-05/traj_4t07itef99ug.md
  • .trajectories/completed/2026-05/traj_6sjeohtm3php.json
  • .trajectories/completed/2026-05/traj_6sjeohtm3php.md
  • .trajectories/completed/2026-05/traj_947wzpddsg9j.json
  • .trajectories/completed/2026-05/traj_947wzpddsg9j.md
  • .trajectories/completed/2026-05/traj_fh8oosbijpwc.json
  • .trajectories/completed/2026-05/traj_fh8oosbijpwc.md
  • .trajectories/completed/2026-05/traj_fh8oosbijpwc.trace.json
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.json
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.md
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.trace.json
  • .trajectories/completed/2026-05/traj_tgism98me5na.json
  • .trajectories/completed/2026-05/traj_tgism98me5na.md
  • .trajectories/completed/2026-05/traj_v1wexlfur5zr.json
  • .trajectories/completed/2026-05/traj_v1wexlfur5zr.md
  • .trajectories/completed/2026-05/traj_whd40oxptlhn.trace.json
  • .trajectories/completed/2026-05/traj_zfa6skfr32vy.json
  • .trajectories/completed/2026-05/traj_zfa6skfr32vy.md
  • .trajectories/index.json
✅ Files skipped from review due to trivial changes (16)
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.json
  • .trajectories/completed/2026-05/traj_4t07itef99ug.json
  • .trajectories/completed/2026-05/traj_6sjeohtm3php.md
  • .trajectories/completed/2026-05/traj_6sjeohtm3php.json
  • .trajectories/completed/2026-05/traj_v1wexlfur5zr.json
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.trace.json
  • .trajectories/completed/2026-05/traj_tgism98me5na.md
  • .trajectories/completed/2026-05/traj_fh8oosbijpwc.trace.json
  • .trajectories/completed/2026-05/traj_947wzpddsg9j.json
  • .trajectories/completed/2026-05/traj_zfa6skfr32vy.json
  • .trajectories/completed/2026-05/traj_tgism98me5na.json
  • .trajectories/completed/2026-05/traj_v1wexlfur5zr.md
  • .trajectories/completed/2026-05/traj_gh05rj5gwsap.md
  • .trajectories/completed/2026-05/traj_947wzpddsg9j.md
  • .trajectories/completed/2026-05/traj_fh8oosbijpwc.json
  • .trajectories/completed/2026-05/traj_whd40oxptlhn.trace.json

Comment on lines +20 to +23
### Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because @relaycast/sdk source lives there

- **Chose:** Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because @relaycast/sdk source lives there
- **Reasoning:** The relay repo only re-exports RelayCast from @relaycast/sdk; package source is in the sibling repo.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove machine-local absolute paths from committed trajectory docs.

Line 20, Line 22, and Line 43 embed /Users/... paths. Please replace with repo-relative or generic references (e.g., “sibling relaycast repo”) to avoid leaking local environment details.

💡 Proposed fix
- ### Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because `@relaycast/sdk` source lives there
+ ### Relaycast Track A implementation belongs in sibling relaycast repo because `@relaycast/sdk` source lives there

- - **Chose:** Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because `@relaycast/sdk` source lives there
+ - **Chose:** Relaycast Track A implementation belongs in sibling relaycast repo because `@relaycast/sdk` source lives there

- - Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because `@relaycast/sdk` source lives there: Relaycast Track A implementation belongs in sibling repo /Users/khaliqgant/Projects/AgentWorkforce/relaycast because `@relaycast/sdk` source lives there
+ - Relaycast Track A implementation belongs in sibling relaycast repo because `@relaycast/sdk` source lives there: Relaycast Track A implementation belongs in sibling relaycast repo because `@relaycast/sdk` source lives there

Also applies to: 43-43

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.trajectories/completed/2026-05/traj_fh8oosbijpwc.md around lines 20 - 23,
Replace all machine-local absolute paths in the trajectory doc entries with
repo-relative or generic references: remove occurrences of "/Users/..." and
instead say something like "sibling relaycast repo" or "sibling repo containing
`@relaycast/sdk` source"; update the lines that contain the sentence starting
"Relaycast Track A implementation belongs in sibling repo ..." and any other
occurrences (e.g., the mentions at lines where the absolute path is embedded) so
no user-home paths remain and references point to the sibling repo or package
name instead.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli/commands/agent-management.ts`:
- Around line 93-108: When waitForReadyBrokerClient(client) throws a non-warmup
error while autoStart is true, the existing client connection is left open;
modify the inner catch (the one that currently checks !autoStart ||
isBrokerWarmupError(err)) to explicitly shut down the partially-initialized
client before falling through to auto-start logic: call and await the client's
close/shutdown method (e.g., await client.close()) and swallow/log any close
errors, then allow the flow to continue so a new broker/client can be created;
reference connect(), waitForReadyBrokerClient, isBrokerWarmupError, autoStart
and the client/AgentManagementClient variable when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2bf7729-9362-4a9c-b670-23b2fee08b28

📥 Commits

Reviewing files that changed from the base of the PR and between 9a4f10f and 1b917eb.

📒 Files selected for processing (14)
  • .prettierignore
  • .trajectories/completed/2026-05/traj_3gjtcykvybt5.json
  • .trajectories/completed/2026-05/traj_3gjtcykvybt5.md
  • .trajectories/completed/2026-05/traj_o251whkvy9rl.json
  • .trajectories/completed/2026-05/traj_o251whkvy9rl.md
  • .trajectories/index.json
  • packages/config/src/cli-registry.generated.ts
  • src/auth.rs
  • src/cli/commands/agent-management.test.ts
  • src/cli/commands/agent-management.ts
  • src/main.rs
  • src/routing.rs
  • src/swarm.rs
  • src/worker.rs
✅ Files skipped from review due to trivial changes (9)
  • .trajectories/completed/2026-05/traj_3gjtcykvybt5.md
  • .prettierignore
  • .trajectories/completed/2026-05/traj_3gjtcykvybt5.json
  • .trajectories/completed/2026-05/traj_o251whkvy9rl.json
  • src/auth.rs
  • src/routing.rs
  • .trajectories/index.json
  • src/swarm.rs
  • packages/config/src/cli-registry.generated.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/worker.rs

Comment thread src/cli/commands/agent-management.ts Outdated
Comment on lines 93 to 108
try {
await waitForReadyBrokerClient(client);
return client as unknown as AgentManagementClient;
} catch (err) {
if (!autoStart || isBrokerWarmupError(err)) {
throw err;
}
}
} catch (err) {
if (!autoStart) {
if (err instanceof Error && err.message !== '') {
throw err;
}
throw new Error('No running broker found. Start one with: agent-relay up');
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Potential resource leak: connected client not cleaned up on non-warmup error.

When autoStart=true, connect() succeeds, but waitForReadyBrokerClient throws a non-warmup error (e.g., auth failure), the inner condition !autoStart || isBrokerWarmupError(err) evaluates to false. Control falls through without shutting down the first client, then proceeds to start a new broker and create another client—leaking the original connection.

🛡️ Suggested fix: shut down client before falling through
   try {
     const client = AgentRelayClient.connect({ cwd });
     try {
       await waitForReadyBrokerClient(client);
       return client as unknown as AgentManagementClient;
     } catch (err) {
       if (!autoStart || isBrokerWarmupError(err)) {
         throw err;
       }
+      // Non-warmup error with autoStart: clean up before falling through to start new broker
+      await client.shutdown?.().catch(() => undefined);
     }
   } catch (err) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/commands/agent-management.ts` around lines 93 - 108, When
waitForReadyBrokerClient(client) throws a non-warmup error while autoStart is
true, the existing client connection is left open; modify the inner catch (the
one that currently checks !autoStart || isBrokerWarmupError(err)) to explicitly
shut down the partially-initialized client before falling through to auto-start
logic: call and await the client's close/shutdown method (e.g., await
client.close()) and swallow/log any close errors, then allow the flow to
continue so a new broker/client can be created; reference connect(),
waitForReadyBrokerClient, isBrokerWarmupError, autoStart and the
client/AgentManagementClient variable when making the change.

@khaliqgant khaliqgant force-pushed the skill/running-headless-orchestrator-nohup branch from 1b917eb to 5e1e108 Compare May 15, 2026 12:26
@khaliqgant khaliqgant force-pushed the skill/running-headless-orchestrator-nohup branch from 5e1e108 to b15fcdd Compare May 15, 2026 12:46
@khaliqgant khaliqgant merged commit cbe2934 into main May 15, 2026
49 checks passed
@khaliqgant khaliqgant deleted the skill/running-headless-orchestrator-nohup branch May 15, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant