GeezerVison is showing github.com — opencode-claimant: recovery rule for bound sessions that never received their prompt (#4758) by dezren39 · Pull Request #5338 · developing-today/code
Conversation
dezren39
commented
Nov 4, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #4758
Phase 3 of design #4912 (claimant session contract): a bound session that never received its prompt previously had no recovery path — not a launch candidate, resend already spent, gone-session rule inapplicable while the empty session existed.
poll.py (read-only discovery)
- New
stuck_bound output (top-level + per-queue): claimed opencode-lane tasks bound to a root session with no terminal marker (time.idle/outcome), NOT in the server's active set, silent for at least ACTIVE_WINDOW_MS (the existing 30-minute zombie window — one threshold, not two), and with the task's lease expired. Every unknown fails closed (unreadable active set, missing session, unparseable lease all veto). Entries carry attempts/max_attempts so the claimant can pick the branch. Zero-message verification is deliberately NOT claimed from the session list — the claimant must verify it before acting.
is_candidate now accepts stage launch_failed alongside handed_off as a recorded yield, so a task reclaimed by the recovery rule becomes a launch candidate again instead of being stranded by its own recovery checkpoint.
prompt.md (claimant contract)
- Step 1 gains the recovery rule: verify zero messages (any message/marker/activity vetoes — a live, progressing session is never reclaimed) → DELETE the verified zero-message session per-id FIRST (a failed or unverifiable delete keeps the binding, fail closed) → attempts remain: checkpoint
launch_failed as the task's worker, clearing session_id (explicit null) and keeping the prior id in the audit field launch_failed_session_id; attempts exhausted: terminally fail with the bound session id in --execution. The checkpoint/fail progress record is the notification Tend's fleet-watchdog reads — no new channel.
Tests — python3 -m unittest pm-stack/opencode-claimant/test_poll.py: 36 pass (15 new: stuck-bound classifier vetoes, lease parsing, launch_failed candidacy). Live poll.py run from this branch emits stuck_bound correctly (0 rows at run time).
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
…ed their prompt (#4758)
Phase 3 of design #4912. poll.py now surfaces stuck_bound candidates (bound root session, no terminal marker, not in the server active set, silent >= ACTIVE_WINDOW_MS, task lease expired; fail closed on any unknown) and accepts the launch_failed yield stage so a reclaimed task becomes a launch candidate again. prompt.md gains the operative rule: verify zero messages, DELETE the empty session first (failed delete keeps the binding, fail closed), then reclaim to unbound via a launch_failed checkpoint that clears session_id and keeps the prior id in launch_failed_session_id, or terminally fail at the attempts cap with the session id in --execution. The task progress record is the watchdog notification. 36 unittest cases pass (15 new).
coderabbitai
Bot
commented
Nov 4, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 13 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5391a448-f2b2-4f7a-ae0a-ebe44c81759b
Commits
-
Reviewing files that changed from the base of the PR and between 62aba6b and c55557f.
Files selected for processing: 6
-
pm-stack/opencode-claimant/README.md
pm-stack/opencode-claimant/migration-0022.sql
pm-stack/opencode-claimant/poll.py
pm-stack/opencode-claimant/prompt.md
pm-stack/opencode-claimant/test/install.test.mjs
pm-stack/opencode-claimant/test_poll.py
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-04T08:24:03.379656Z |
c55557f |
New commits |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05d887df71
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+89
to
+93
|
|
`worker_id` — `checkpoint <id> --worker <worker_id> --stage
|
|
|
launch_failed` with progress that CLEARS `session_id`
|
|
|
(an explicit `"session_id": null`) and
|
|
|
keeps the prior id in the audit field `launch_failed_session_id`
|
|
|
(plus `launch_failed_at` and the reason). Stage `launch_failed`
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear the ledger binding before making recovered tasks launchable
For a stuck task with attempts remaining, this recovery clears progress.session_id but leaves the deleted session's ID in agent.repo_task_lane_ledger.session_id. The normal launch path calls bind_repo_task_lane_session, whose guard in pm-stack/opencode-claimant/migration-0021.sql:83–84 rejects a different existing ledger binding. Consequently, the next fire creates a replacement session but cannot bind or prompt it, leaving the task stranded and potentially creating additional empty sessions on subsequent fires. Recovery needs to clear both binding stores safely before restoring launch eligibility.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in c55557f. Migration 0022 adds a recovery mode to bind_repo_task_lane_session that locks the task and ledger rows, compares the prior session ID in both stores, and atomically clears both while recording launch_failed/audit data and consuming an attempt. The claimant calls it only after the prior session is verified absent (or verified empty and deleted); mismatches fail closed. Normal binding remains guarded, and the contract test covers the two-store compare-and-clear.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…queue/9309-4758-claimant-recovery
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|