fix(orchestrator): verify remote agent placement - #392
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 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 |
|
@coderabbitai review Requested for exact head |
There was a problem hiding this comment.
3 issues found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/orchestrator/factory.ts">
<violation number="1" location="src/orchestrator/factory.ts:10694">
P1: `#rollbackUnregisteredRemoteDispatch` clears the durable dispatch-lifecycle claim and abandons the batch record, but it never persists a reaper handoff for agents that were already spawned earlier in this same dispatch (unlike the generic failure path a few lines below, which calls `#persistDispatchFailureReaperHandoff` first). If an implementer spawn already succeeded before the reviewer spawn throws `FleetPlacementUnavailableError`/`RemoteAgentRegistrationTimeoutError`, that already-live remote agent is left running with no lifecycle row and no handoff record, so nothing will ever release it. Persist a failure-reaper handoff for `spawnedForReaperHandoff`/`record.agents` (or explicitly release each of them) before clearing the claim and abandoning the batch entry.</violation>
</file>
<file name="src/fleet/relay-fleet-client.test.ts">
<violation number="1" location="src/fleet/relay-fleet-client.test.ts:837">
P2: Case 2 returns false from the node-mismatch `find`, not from the live/offline-host gate, so it never exercises the new `node.live && capabilities` rejection that this PR is meant to guard. To actually test offline-host refusal, report an agent on node 'beta' and query it there, e.g. add a third agentRow `{ name: 'ar-offline-host-impl', status: 'online', node: 'beta' }` and assert `isAgentRegistered({ name: 'ar-offline-host-impl', node: 'beta', capability: 'spawn:codex' })` rejects because beta.live is false.</violation>
</file>
<file name="src/orchestrator/factory.test.ts">
<violation number="1" location="src/orchestrator/factory.test.ts:1108">
P2: This test cannot detect the regression it targets. When the orchestrator fails to pin a node and spawns with node 'self' (the pre-fix 'Received node self' behavior), the fake's spawn override falls back to `result.node`, which the base RemoteLifecycleFleetClient.spawn hardcodes to 'sf-mini', so `fleet.spawns` still reports 'sf-mini' and the assertion passes. Return the requested node directly (preserving 'self') so the node-pinning assertion actually fails when pinning regresses.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
@coderabbitai review Requested for exact head |
Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263 Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263
Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263 Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263
a09a1d0 to
a4b2984
Compare
|
@coderabbitai review Requested for exact head |
Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263
|
@coderabbitai review Requested for exact head |
Session-Id: 01a03e13-5b3b-7473-a480-53403c8df263
|
@coderabbitai review Requested for exact head |
Summary
This is the upstream complement to #391: this PR stops creating hostless/unregistered agents; #391 bounds and hands off failures already in downstream release.
Red → green
Before implementation, the production-shaped remote suite failed all three cases:
Received node "self" instead of expected "sf-mini"; no-eligible dispatch resolved instead of rejecting; and unregistered dispatch resolved instead of rejecting.After implementation:
Additional validation:
npm run buildnpm run featuremap:checksrc/fleet/relay-fleet-client.test.ts+src/state/file-state-store.test.ts: 122/122 passThe bounded full suite exceeded 15 minutes under host load. Its unrelated timing failures were baselined in a detached unmodified
origin/mainworktree: main reproduced the load-harness timing failure and five 5-second worktree timeouts. No assertion was weakened or skipped.