Skip to content

🪪 fix: Fence Stale Quarantine Receipts on Workspace Reuse - #407

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/fence-late-quarantine
Nov 17, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/fence-late-quarantine

Conversation

@danny-avila

@danny-avila danny-avila commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

I prevented late cleanup or quarantine receipts from a rejected assignment from changing a workspace after a successor is admitted.

  • Increment the workspace ownership epoch atomically on each admission and store that epoch in the assignment receipt.
  • Invalidate older receipts even after the successor completes and releases its fence.
  • Preserve quarantine and idempotent retries for the current owner, reset fencing, worker identity checks, and receipt/epoch lifetimes.
  • Test active, completed, and quarantined successors with both current and legacy receipts.

Closes #404. Follow-up to #401 and #402.

Change Type

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • Reproduce all three successor-state failures before the fix.
  • Pass 86 workspace request and concurrent store tests.
  • Pass nine focused tests against disposable real Redis, including all six new transitions, reset invalidation, and uncertain-outcome quarantine.
  • Build the service successfully with bun run build.
  • Confirm standalone tsc --noEmit -p tsconfig.json diagnostics exactly match origin/main; that command currently reports existing module/configuration and type errors, with no new diagnostics.
  • Pass git diff --check.

Reproduce from service: bun install --frozen-lockfile, bun test src/workspace-tools/requests.test.ts src/bridge/concurrent-store.test.ts, and bun run build. Set BRIDGE_TEST_REDIS_URL only to a disposable Redis instance to run the workspace request cases against real Redis; these tests flush that database.

Compatibility

The existing receipt format and endpoints are unchanged. A receipt becomes stale when ownership moves, so late reports receive the existing ASSIGNMENT_FENCED response; the worker treats that definite refusal as terminal. Legacy epoch-zero receipts are rejected once a new-version server admits a successor. Complete the API rollout to protect admissions handled by every replica; old replicas retain the previous admission behavior during a mixed-version rollout.

All 24 GitHub checks passed on exact head 36e1d486ee15ea292593ae8a4c0111613ceec94d; Codex review is clean with no inline findings. Independent approval is required before merge.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 36e1d48. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads. Audit the receipt authority from admission through rejection, cleanup/quarantine, successor admission and completion, and reset. Check legacy-receipt and mixed-version behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T12:08:19.638671Z 36e1d48 Manual request
ℹ️ 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

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 36e1d486ee

ℹ️ 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".

@danny-avila
danny-avila merged commit f565d0a into main Nov 17, 2026
24 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.

bug: fence late quarantine reports after rejected lane reuse

1 participant