Skip to content

Resume the parent when the fleet goes dry with open tasks - #852

Merged
TheGreatAxios merged 6 commits into
mainfrom
cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry
Sep 10, 2026
Merged

Resume the parent when the fleet goes dry with open tasks#852
TheGreatAxios merged 6 commits into
mainfrom
cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • A session with todo/doing tasks does not idle just because the fleet went dry
  • Fleet-dry with open tasks re-enters the parent with collected reports
  • Live fleet plus open tasks still allows idle-with-fleet

Verification

  • bun run typecheck, bun run build, and bun run test pass

Fixes CL-7540

@linear-code

linear-code Bot commented Sep 9, 2026

Copy link
Copy Markdown

CL-7540

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

CL-7540 happy path holds at 83a6c65b. Dry fleet + open tasks fires one occupancy shot; a missed wentDry while processing latches and drives from settle; stale connector.reply is held until continuation inference.start; mailbox reports are taken only after TUI send succeeds; idle-with-live-fleet stays.

Two should-fix items:

  1. Occupancy send failure: latch is consumed and awaitingContinuationInference is set, then TUI send returns false and handleSendFailure idles without settleRunToIdle, so there is no second shot, replies stay skipped, and queued follow-ups are undrained (src/tui/runtime-bridge.ts / src/subagent/fleet-dry-drive.ts / src/tui/runner/submit.ts).
  2. Occupancy send never writes lastSentMessage, so a continuation 429 quota-retries the previous operator prompt (beginSystemContinuation vs the operator send path).

Happy-path tests to keep. Please add send-failure re-arm and occupancy quota-replay cases.

Merge note: overlaps PR 841 on runtime-bridge / wiring / submit and PR 853 on agent-fleet.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verdict: comment.

CL-7540 happy path holds at 83a6c65b. Dry fleet + open tasks fires one occupancy shot; a missed wentDry while processing latches and drives from settle; stale connector.reply is held until continuation inference.start; mailbox reports are taken only after TUI send succeeds; idle-with-live-fleet stays.

Two should-fix items:

  1. Occupancy send failure: latch is consumed and awaitingContinuationInference is set, then TUI send returns false and handleSendFailure idles without settleRunToIdle, so there is no second shot, replies stay skipped, and queued follow-ups are undrained (src/tui/runtime-bridge.ts / src/subagent/fleet-dry-drive.ts / src/tui/runner/submit.ts).
  2. Occupancy send never writes lastSentMessage, so a continuation 429 quota-retries the previous operator prompt (beginSystemContinuation vs the operator send path).

Happy-path tests to keep. Please add send-failure re-arm and occupancy quota-replay cases.

Merge note: overlaps PR 841 on runtime-bridge / wiring / submit and PR 853 on agent-fleet.

@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from bb203f8 to e81662a Compare September 9, 2026 22:29
@TheGreatAxios
TheGreatAxios changed the base branch from main to cl-7524-wake-parents-for-parked-director-questions September 9, 2026 22:29
@TheGreatAxios
TheGreatAxios added this pull request to stack #856 September 9, 2026 22:29
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from 14a6a10 to 4f142f1 Compare September 10, 2026 00:47
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from 4f142f1 to 2fc35f9 Compare September 10, 2026 00:48
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from 2fc35f9 to fae6b49 Compare September 10, 2026 00:50
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from fae6b49 to 6227841 Compare September 10, 2026 00:53
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from 6227841 to 3e43573 Compare September 10, 2026 00:56
Base automatically changed from cl-7524-wake-parents-for-parked-director-questions to main September 10, 2026 00:59
A session with todo/doing tasks was settling idle just because the
fleet printed nothing running. Re-enter with collected reports on
the wentDry edge. Idle-with-live-fleet stays.
A last-lane terminal while the parent is still processing dropped the wentDry edge, then settle idled with open tasks. Occupancy now latches that edge and drives once from settle. Send failure no longer consumes mailbox reports.
The occupancy shot re-arms processing during inference.done, so the
same turn's connector.reply settled idle and drained queued follow-ups.
Hold until the continuation's inference.start. Take mailbox reports
only after send actually succeeds on the TUI path.
A failed occupancy send consumed the dry-open latch and left the
turn running. Abort now re-arms, drains, and resets cadence so a
later settle can retry; a successful occupancy stamps lastSentMessage
so quota retry resends the continuation.
beginSystemContinuation queues the occupancy string on pendingEchoes. Abort without a matching message.received left that echo in place, so a later inbound with the same text could be swallowed. Pop that continuation echo on abort without wiping unrelated operator echoes.
The occupancy collector is the wait_agents JSON shape. Dropping
stopReason there made interrupt and incomplete-report waits look
clean after collection.
@TheGreatAxios
TheGreatAxios force-pushed the cl-7540-keep-driving-open-tasks-after-the-fleet-goes-dry branch from 3e43573 to 459fff4 Compare September 10, 2026 00:59
@TheGreatAxios
TheGreatAxios merged commit 2c67dac into main Sep 10, 2026
5 checks passed
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