Repository navigation
opencode-claimant: migration-0024 — fix Codex P2s in live session-binding functions (#5393) - #5399
Conversation
|
Warning Review limit reachedYou'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 32 minutes. View limit details
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. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a355040c99
ℹ️ 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".
| if t.status <> 'claimed' or t.lease_until is null or t.lease_until <= now() then | ||
| raise exception 'bind_repo_task_lane_session: task % is not claimed with a live lease (status %, lease_until %)', | ||
| p_task_id, t.status, t.lease_until; | ||
| end if; |
There was a problem hiding this comment.
Preserve the guarded recovery mode from migration 0022
Applying this migration after the repository's migration-0022.sql replaces its guarded recovery implementation with a function that rejects expired leases and no longer handles either reserved recovery launched_by value. The claimant's prompt.md steps 1c–1d explicitly invoke those recovery operations after lease expiration, so both now raise instead of atomically clearing the bindings and recording the recovery attempt. This leaves deleted or vanished sessions bound and prevents the documented relaunch flow. Preserve migration 0022's recovery branch while applying the lock-order fix.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disposition: real defect, wrong migration — not fixed in this PR, filed as #5400 with the evidence.
Verified live during task 9348: the recovery branch was dropped by migration-0023, not by this migration. The migration-0023 record copy (PR #5349) contains zero recovery references, and the live pg_get_functiondef extracted before migration-0024 was applied matched the 0023 body exactly (live probe: has_recovery=false; single 4-arg overload). Migration-0024 was built byte-faithfully from that live body per #5393's acceptance ("fixes both findings against the current live function bodies") and changes only the lock order — restoring recovery inside 0024 after it was already applied live would make this record copy unfaithful to what is running.
The underlying problem is real: prompt.md steps 1c-1d recovery calls raise against the current live function. It is filed as #5400 with a fix shape (new migration merging the 0022 recovery branch + 0023 claim guard + 0024 lock order, exercised in a rolled-back transaction).
Fixes #5393
Record copy of migration-0024, already applied live to the fleet Supabase project (agent schema) with before/after verification, fixing the two Codex P2 findings raised on PR #5349 against the live session-binding functions:
bind_repo_task_lane_sessionnow locks the task rowFOR UPDATEin its first statement, before accessing the lane ledger — consistent with every binding-clearing transition in migration-0023 (expire_leases, fail_repo_task, park_task, claim_repo_task, revalidate_parked_tasks all take the task row before the ledger; verified by inspection of migration-0023.sql).task_id(PR opencode-claimant: migration-0022 — clear bound session_id on requeue + bind-time claim guard (#5001) #5349 comment 4465191807): the release branch ofrevalidate_parked_tasksnow aliasesagent.repo_task_lane_ledgerasland qualifiesl.task_id.Verification (2026-11-04, task 9348)
pg_get_functiondef(they matched the migration-0023 record copy exactly).progress.session_id—ERROR 42702: column reference "task_id" is ambiguousat the ledger update, aborting the whole sweep. No residue after rollback.pg_get_functiondefdiff before/after shows only the two intended statement changes; the same rolled-back exercise now completes — the synthetic task is released toqueuedand its ledgersession_idis cleared. No residue after rollback.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.