Skip to content

fix: cold-start persistently unreachable babysitters#179

Merged
kjgbot merged 6 commits into
mainfrom
fix/relay-authoritative-takeover-roster
Jul 21, 2026
Merged

fix: cold-start persistently unreachable babysitters#179
kjgbot merged 6 commits into
mainfrom
fix/relay-authoritative-takeover-roster

Conversation

@kjgbot

@kjgbot kjgbot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fence saved-session recovery for unreachable PR babysitters with durable lifecycle state
  • resume a saved babysitter session once, then cold-start from its persisted task if Relay still cannot address it
  • preserve pending PR events until the replacement accepts the wake

Live failure reproduced

During the 0.1.52 production acceptance run, the local fleet registry still contained ar-2777-babysit-cloud while Relay returned agent_not_found for every event wake. The previous recovery path repeatedly resumed the same unaddressable session after each cooldown, leaving the lifecycle occupied without processing review feedback.

This change keeps the supported no-MCP implementer fallback intact and scopes authoritative Relay recovery to babysitters, whose job requires successful event injection.

Exact-head validation (8070aebe2b21ac6ecbe205ddf82a76537dc6a0f0)

  • npm run build
  • npm test — 69 files, 1,308 tests
  • focused resume/cold-start/session-generation recovery tests — 3 passing
  • npm run featuremap:check — 24 categories, 300 features
  • npm run verify:e2e — 9 packed-install checks
  • actionlint
  • bash -n for repository shell scripts
  • git diff --check origin/main...HEAD

The PR stays unmerged until all hosted E2E workflows and review feedback are clean.

Live acceptance also exposed recursively growing recovery invocation IDs, which eventually exceeded the telemetry contract and produced progress reporter rejected an event / ZodError. Recovery IDs now always derive from the bounded logical-agent base, and the E2E forces two cold-start generations and asserts their exact bounded shape.

Hosted verification also reproduced a pre-existing PostgreSQL seed race twice: pg_isready accepted the image's temporary initialization server immediately before its intentional shutdown. The checked-in stack fixture now requires the final PID-1 PostgreSQL process before seeding, so the E2E validates the deployed server rather than relying on retries.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change records when an unreachable babysitter session resume has been used, falls back to a durable cold start when that session remains unreachable, preserves the tracking field during cloning, expands the feature requirements, and adds end-to-end coverage.

Changes

Babysitter recovery

Layer / File(s) Summary
Recovery state and cold-start fallback
src/orchestrator/batch-tracker.ts, src/orchestrator/factory.ts, .agentworkforce/features/manifest.yaml
TrackedAgent records the previously resumed unreachable session; FactoryLoop prevents repeated reuse, emits cold-start accounting, preserves the field when cloning, and documents the expanded wake guarantees.
Recovery fallback validation
src/orchestrator/factory.test.ts
A specialized harness and end-to-end test simulate failed wake delivery and verify resumed-session inheritance, cold-start behavior, counters, and cleanup.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IntegrationEvents
  participant FactoryLoop
  participant BabysitterHarness
  IntegrationEvents->>FactoryLoop: Emit PR or comment event
  FactoryLoop->>BabysitterHarness: Resume babysitter with continueFrom
  BabysitterHarness-->>FactoryLoop: Fail integration-event wake delivery
  FactoryLoop->>BabysitterHarness: Cold-start without continueFrom
Loading

Possibly related PRs

Suggested reviewers: khaliqgant, miyaontherelay

Poem

I resumed the wake, then found it gone,
So I tracked that trail till dawn.
No endless loops beneath the sky—
A cold start waits when retries die.
Hop, hop, the session state stays bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the main change: cold-starting persistently unreachable babysitters.
Description check ✅ Passed The description directly matches the PR’s babysitter recovery and cold-start behavior changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/relay-authoritative-takeover-roster

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.

❤️ Share

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a mechanism to durably cold-start a PR babysitter after a resumed session remains unreachable, preventing broken sessions from consuming slots indefinitely. It tracks whether a session has already been resumed using a dedicated recovery key stored in the state store. A new test case and harness have been added to verify this behavior. The review feedback highlights a bug where calling markResumed during a cold-start marks the recovery key as spent for the newly initialized session, which would prevent it from attempting a resume if it becomes unreachable in the future. It is recommended to clear or reset the resumed state for the recovery key when cold-starting instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/orchestrator/factory.ts Outdated
@kjgbot
kjgbot marked this pull request as ready for review July 21, 2026 14:18
@kjgbot

kjgbot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kjgbot
kjgbot merged commit 1f9ac60 into main Jul 21, 2026
6 of 7 checks passed
@kjgbot
kjgbot deleted the fix/relay-authoritative-takeover-roster branch July 21, 2026 14:44
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