Skip to content

fix(claimant): fail closed on HTTP errors in supervision recovery (#7367) - #7960

Closed
dezren39 wants to merge 1 commit into
mainfrom
queue/14229-7367-claimant-delete-gate
Closed

dezren39 wants to merge 1 commit into
mainfrom
queue/14229-7367-claimant-delete-gate

Conversation

@dezren39

@dezren39 dezren39 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Fixes the #7367 residual (queue task 14229): claimant supervision treated HTTP errors as session absence in two places.

Session GET (supervision_step): the GET now carries curl -w "\n%{http_code}" and the status decides: only 404 is a genuinely gone session; 401/403/5xx, a transport failure, or a 200 with no session object is unknown state and the binding is left alone. Previously any error body parsed as "session gone".

Recovery DELETE gate: the zero-message recovery DELETE now uses curl -f, so an HTTP error (e.g. 401 → rc 22) no longer satisfies the returncode == 0 gate for the recovery bind. A failed delete records the failure (with rc) and never binds — closing the duplicate-execution shape #7367 forbids: clearing/replacing a binding while the session still exists.

Tests (oracle: an HTTP error is unknown state, never absence): the stub harness appends the -w status line and models DELETE return codes; new tests pin that a 401 session GET produces no candidate/delete/bind and that a simulated 401 DELETE never binds. Existing gone-session recovery still passes.

  • python3 -m unittest pm-stack/opencode-claimant/test_claimant.py — 12/12 OK (laptop)
  • python3 -m unittest pm-stack/opencode-claimant/test_poll.py — 50/50 OK (laptop)

Scope is exactly the packet's: supervision delete gate + session-get error handling in pm-stack/opencode-claimant/claimant.py. The two launch-path cleanup DELETEs (wrong-location / bind-failed, results ignored, nothing gated on them) are unchanged. Refs #7367.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

)

supervision_step session GET: read the HTTP status via curl -w - only a 404 is a genuinely gone session; 401/403/5xx, transport failure, or a 200 with no session object is unknown state and the binding is left alone. Previously an error body was parsed as session-gone regardless of status.

Recovery DELETE: add curl -f so an HTTP error (e.g. 401, rc 22) no longer satisfies the returncode==0 gate for the recovery bind - a failed delete records the failure and never binds, closing the duplicate-execution shape #7367 forbids.

Tests: stub harness now appends the -w status line and models delete rc; new tests pin that a 401 session GET leaves the binding alone and a 401 DELETE never binds. Oracle: an HTTP error is unknown state, never absence. test_claimant 12/12, test_poll 50/50 on the laptop.
@dezren39
dezren39 requested a review from a team as a code owner November 9, 2026 05:08
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-09T05:08:51.808646Z
We couldn’t complete this review. Comment @codex review to try again.
e423ba3 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

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 36 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: 751155fd-3162-4bd5-bd30-d651530b833d
Commits

Reviewing files that changed from the base of the PR and between 1cd22df and e423ba3.

Files selected for processing: 2

  • pm-stack/opencode-claimant/claimant.py
  • pm-stack/opencode-claimant/test_claimant.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

@dezren39

Copy link
Copy Markdown
Member Author

agent-note:v1
state: superseded
task: 17262
lane: code-b
worker: repo-worker-code
note: Closing as SUPERSEDED in task 17262. Both halves of this PR are already on main in a stronger, refactored form, and issue #7367 is CLOSED:

  • Session GET: main routes every server call through one verified transport (commit 892f5f8, fix(claimant): one verified-read server transport for every server call, Act only on a verified read — one seam contract for the opencode-claimant #7770 Phase 2). claimant.py on main: gone is a 404 verdict from the per-id GET, never a body-shape guess; a 401/transport failure is UNKNOWN and the binding is left alone.
  • Recovery DELETE gate: main DELETE goes through the same verified transport and counts only on a 2xx (claimant.py: a non-2xx delete did not happen), which subsumes this PR curl -f gate.
  • Tests: main test_claimant.py already pins the same oracle, including test_session_get_401_is_unknown_not_gone and test_create_401_skip_names_the_transport_failure (opencode-claimant(claimant.py): every OpenCode server call is unauthenticated — session create always 401s, and the delete gate trusts curl's exit status #7367). Fresh verification at main c1f5866: python3 -m unittest pm-stack.opencode-claimant.test_claimant — Ran 24 tests, OK.
    Salvage analysis: nothing unique remains to port; the main-side implementation covers the PR behavior with a single transport for all calls instead of per-call-site handling. No Codex/CodeRabbit findings existed on this PR (Codex review failed to run on usage limits; CodeRabbit rate-limited).

@dezren39 dezren39 closed this Nov 14, 2026
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