Skip to content

Qualify an unwired durable admission wait with a fixed cutoff - #1264

Merged
sidneyswift merged 12 commits into
mainfrom
codex/pack-admission-wait
Nov 18, 2026
Merged

sidneyswift merged 12 commits into
mainfrom
codex/pack-admission-wait

Conversation

@sidneyswift

@sidneyswift sidneyswift commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Adds an unwired durable admission wait for the existing Packs read path. The engineering candidate uses a 30-second admission cutoff and schedules polls at the earliest of one second, the original cutoff or hold expiry. Only a missing saved workflow ID on the same authorized running job is waitable; other identity/status/expiry/read failures reconcile with the original job/run context. No production caller, factory activation, admission write, lease change or second dispatch is added.

The compiled fixture uses the actual coordinator and durable steps with a synthetic read RPC, verifies original-clock restart and terminal replay, and is required by CI. The cutoff is not a wall-clock completion guarantee; pre-journal clock crashes and production authority/continuation policy remain unqualified.

Fixture reliability resolution candidate

An earlier combined-head CI run recorded an extra wait without sufficient IDs to classify it. Deterministic controls now prove that startup recovery plus the fixture's explicit startup reenqueue produces two SDK queue messages, and a separate source-verified storage overlap probe reproduces duplicate stored event IDs for one wait correlation. Neither retrospectively attributes the historical failure.

The fixture removes the redundant startup reenqueue while preserving explicit terminal replay. A passive, fixture-local observer records actual queue messages, per-delivery async context and create/list operations before startup; it preserves original SDK promises/results. Timeout-safe capture retains incremental operations, raw events/waits and pre-crash evidence before cleanup. Strict wake/effect assertions remain unchanged; no deduplication or delivery serialization is introduced. General SDK concurrency and hosted fencing remain unqualified.

Validation

  • 35 focused Node tests and seven actual compiled scenarios pass locally, with zero network attempts and exact startup/completion-hook/terminal-replay trace checks.
  • Deterministic fixed-snapshot queue controls and controlled actual SDK absence-check overlap probes pass; installed files are unchanged.
  • Scoped lint/format pass; all nine runtime bindings and all 26 accepted Sites Add unwired exact-selected Sites publication orchestration #1265 paths are preserved.
  • Current head 58d73dc3b3a2ad5a0f4f12404b4c8432c3821e93 normally incorporates accepted main 37b5a07572e182429e3fc44baf24706ded292f7c. Exact-head CI and independent review are required.

Merge hold remains with the coordinating reviewer until this source-bound resolution and successor qualification are accepted. A prior green retry alone is not acceptance. CodeRabbit's function-length advisory is acknowledged as non-blocking for the cohesive admission state machine.

Normal integration of accepted Sites #1266 preserves all22 incoming bridge/capture paths, all34 admission paths and all9 runtime bindings. No SDK/package/lock change. Final combined-head CI and independent composition remain required.

Successor58d73dc3 fixes the independent P2: start readiness and post-SDK-close success both require a fully drained immutable trace; last-append failure controls prevent success and preserve primary errors. Byte-bounded reads and local WebSocket/HTTP2 guards address review follow-ups. All35 focused tests and7 compiled scenarios pass. Root routes focused successor review and owns merge; final exact-head CI remains required.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Nov 18, 2026 12:48am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Pre-merge checks: Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Solid & Clean Code Warning The check fails on the SRP rule. It states: "Look for functions longer than 20 lines." Evidence: - PR #1264 adds lib/content/packs/foundation/pollPackAdmission.ts. `git diff --name-status origin/mai… 1. Split pollPackAdmission into small units. Put each unit in its own file named after its exported function. Suggested units: a start-clock and run-ID validator, an observation-clock monotonicity checker, a scope and owner checker, a hol…
Full details: Solid & Clean Code

Explanation

The check fails on the SRP rule. It states: "Look for functions longer than 20 lines." Evidence: - PR #1264 adds lib/content/packs/foundation/pollPackAdmission.ts. git diff --name-status origin/main...HEAD lists it as A, so the PR introduces the file. - Current head is 58d73dc3b3a2ad5a0f4f12404b4c8432c3821e93. The exported pollPackAdmission runs from line 8 to line 65 (58 lines). The file has 65 lines in total. - The function combines several responsibilities in one body: - start-clock and run-ID validation (lines 27–29); - read error handling (lines 33–36); - observation-clock monotonicity (lines 38–40); - scope and owner checks (lines 41–46); - run, status and hold-expiry checks (lines 47–55); - deadline and admission decisions (lines 56–58); - sleep scheduling and wait-failure handling (lines 59–63). - reconcile(...) exits the function on many separate return paths. Exit handling is not in one place. - Line 25 repeats the inline type Extract<PackAdmissionResult, { status: "needs-reconciliation" }>["reason"]. The reason union has no named alias. - The literals 30_000 (line 15) and 1000 (line 60) are inline. They are not named constants. Points that pass: - The file name matches its single exported function, so the file-function name rule holds. - Dependencies enter through services. The PR description says the CodeRabbit function-length advisory is non-blocking. That statement does not change the check criteria. The 58-line function still violates the explicit 20-line limit. Prior failure disposition: The standing FAIL holds. The current head still contains the 58-line pollPackAdmission function. No later change splits it. The violation comes from this PR because the file is new. Author context: the provider-reported PR author is sidneyswift. Author identity does not apply to this check.

Resolution

  1. Split pollPackAdmission into small units. Put each unit in its own file named after its exported function. Suggested units: a start-clock and run-ID validator, an observation-clock monotonicity checker, a scope and owner checker, a hold-expiry evaluator, and a next-wait scheduler. 2. Reduce the pollPackAdmission body to about 20 lines or fewer. The loop should call these units and map their results to PackAdmissionResult. Keep all reconcile exit values in one place. 3. Define the reason union once in packAdmissionTypes.ts as a named type alias. Use that alias in function signatures instead of repeating Extract<...>["reason"]. 4. Move 30_000 and 1000 into a named constants object, such as ADMISSION_WINDOW. Use the same constants in the implementation and in packAdmissionWait.test.ts. 5. Add focused tests for each extracted unit. Keep packAdmissionWait.test.ts passing without changes.
  • 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

@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-17T23:14:59.291627Z b3fe553 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.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found and verified against the latest diff

Confidence score: 4/5

  • runWorker.mjs can pass without proving the pre-crash read was replayed from the durable journal. Load before-crash.json on resume and assert the trace is unchanged after replay delivery.
  • runScenario.mjs duplicates the restart and cleanup lifecycle, so future fixes can drift across fixture runners. Extract the shared lifecycle.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/pack-admission-workflow-fixture/runScenario.mjs">

<violation number="1" location="scripts/pack-admission-workflow-fixture/runScenario.mjs:7">
P3: This runner duplicates the full restart and cleanup lifecycle already present in the scheduler and foundation fixture runners. Extract the shared lifecycle so future timeout, process-failure, or cleanup fixes cannot diverge across fixtures.</violation>
</file>

<file name="scripts/pack-admission-workflow-fixture/runWorker.mjs">

<violation number="1" location="scripts/pack-admission-workflow-fixture/runWorker.mjs:62">
P2: The restart scenario does not verify that the pre-crash read was replayed from its durable journal. Load `before-crash.json` in the resume path and assert the trace is unchanged after the replay delivery, before the next scheduled poll; otherwise duplicate read effects during restart remain undetected.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread .github/workflows/test.yml Resolved

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Auto-approval blocked by 8 unresolved issues from previous reviews.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 17 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

cubic-dev-ai[bot]
cubic-dev-ai Bot previously approved these changes Nov 17, 2026

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 2 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds an unwired durable admission-wait candidate with a 30-second cutoff, plus a compiled restart/replay fixture, documentation, and CI wiring. No production caller or factory wiring exists, so the change is bounded and has no production behavior effect.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai
cubic-dev-ai Bot dismissed their stale review November 18, 2026 00:14

Dismissed because Cubic found issues in a newer review.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 15 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai 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.

0 issues found across 13 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds an unwired durable admission-wait candidate with a fixed 30-second cutoff, restart/replay fixture diagnostics, docs, and CI wiring. No production caller/factory activation exists, so the change is bounded with no production behavior change.

View guided diff | Turn on auto-fix | Re-trigger cubic

@sidneyswift
sidneyswift merged commit e0dfed0 into main Nov 18, 2026
14 checks passed

This branch was successfully deployed

1 active deployment
Preview — 58d73dc3 Deployed Nov 18, 2026 by vercel[bot]
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