Skip to content

Wait for container rollout completion before deployment success - #2722

Merged
simple-agent-manager[bot] merged 9 commits into
mainfrom
sam/wait-for-container-rollout
Nov 14, 2026
Merged

simple-agent-manager[bot] merged 9 commits into
mainfrom
sam/wait-for-container-rollout

Conversation

@simple-agent-manager

@simple-agent-manager simple-agent-manager Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Production release evidence — 2026-11-14

Merged with coordinator-approved exact-head guard at a7f8f665c5346d9be00a7d4bb82edb3c1d7fdc32. Main CI43589298206 SUCCESS. Actual Deploy Production43592048272 SUCCESS, including successful deployment marker132443031098.

Production job132438810421 logs and step receipts confirm:

  • Snapshot container rollout identities: PASS,11:53:44–11:53:46 UTC.
  • Wait for container rollout completion: PASS,12:03:51–12:09:46 UTC. Sandbox application a03f4baa-0853-4e9a-ab80-9d86a65a61df pinned rollout 9e7acfcd-1146-4677-a4e6-4f04a8307a5f, active1618→target1619; agent application a03c21ef-2854-49e4-b082-d014a063c2aa pinned rollout d04a895a-5b58-407d-8a5c-2f2cc004d6a1, active1138→target1139. The gate continued waiting after completed status while an active version remained old, then passed with both active targets.
  • Health Check: PASS12:10:32 UTC; API healthy. No production fixtures or user-flow tests.
  • Independent read-only Cloudflare receipt12:12:10 UTC: sam-api-prod deployment 6ac62fd6-2a68-4f53-9005-f10ae8894e1f, version ecb99b59-3c67-4fc8-860b-4c81d7f886e8 at100%, annotated with full merge commit above.

Earlier production43590134932 rejected obsolete target6ce953a before mutation; it is not release proof. Separate unexplained binary discrepancy remains open in idea01M7BQJ14BKVMPMKRA2GCSP8MJ. Archive owner retains its separate24-hour read-only observation. All release fallback waits are cancelled; original accepted R2 retention cleanup remains scheduled.

Current release gate: approved source 5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 is unchanged. Refreshed CI43585844985 attempt2 is SUCCESS, including Test132425129478; E2E43585844884 also SUCCESS. Attempt1 timed out in the unrelated compact-archive compatibility case (30s); the coordinator-authorized single job-only retry passed. No source fix, second retry or additional refresh. Incident remains tracked separately: 01M7CTAXZ79SAZCR2DSDMVCF7D. Corrective PR2726 is verified in production. Final reviews and inline comments are empty. Latest Sonar report passes with zero new issues/hotspots. Coordinator exact-head merge approval is recorded below; main CI and actual production snapshot/wait proof follow after merge.

Summary

Wrangler can return successfully while a gradual container rollout is still replacing instances. The shared staging/production workflow now snapshots container applications and rollout identities before deployment, pins the unique new rollout afterward, and waits for completed100% steps plus the active target version. Multiple new rollouts, supersession, unreadable/API errors and bounded timeout fail the gate. First creation and metadata/no-op deployments remain supported; an existing pending rollout is still awaited.

This closes the deploy reported success mid-rollout window. It does not prove every running instance's binary. Authenticated /ready callbacks now log expected/reported Instant agent-version mismatches without rejecting readiness. The unexplained post-rollout old→expected callback transition remains open in SAM idea 01M7BQJ14BKVMPMKRA2GCSP8MJ; this PR does not claim that root cause is solved.

Gradual rollouts are preserved. The gate uses only the Cloudflare API on both deployment paths, without a Wrangler dependency patch or console-output inference. Deploy-runner settings CONTAINER_ROLLOUT_TIMEOUT_MS and CONTAINER_ROLLOUT_POLL_INTERVAL_MS default to1200000 and10000 milliseconds.

Coordinator approval: event e7e3d880-011f-4cbc-9cdb-8cd890f98ea6 explicitly approves PR #2722 at full head 5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 for merge after fresh checks pass. Any new commit voids approval. Coordinator directed removal of the hold, readiness, one close/reopen to refresh evidence, then squash merge with an exact-head guard. Production rollout snapshot/wait logs will be verified after merge.

Validation

  • pnpm lint —22/22 tasks passed.
  • pnpm typecheck —36/36 tasks passed.
  • pnpm build —18/18 tasks passed.
  • Full repository Test job and all three Durable Object worker shards passed in fresh CI43562283957; local ceilings remain disclosed below.
  • Deployment engine/workflow/rollout tests:114 across9 files passed; includes HTTP snapshot→pending target with old active version→completed target, first-poll ambiguity, metadata/no-op and both workflow paths.
  • Ready callback route:20 tests passed, including log-only mismatch and a projection-aware database mock.
  • Deployment-script TypeScript, modified-script ESLint, agent-context budget and diff checks passed.
  • Nineteen completed package suites passed across the bounded broad run and remaining-package run.

Local ceilings and retries

All commands were foreground and bounded; there are no local jobs still running.

Attempt Observed result Follow-up
Initial concurrent full build/lint/typecheck 540s ceilings Lower-concurrency full retries passed18/22/36 tasks respectively.
Initial ready-route setup 120s setup ceiling under load After dependency build, route suite passed20/20; revised projection mock also passed20/20.
Root full test run 540s ceiling,13 package suites completed successfully Six remaining non-web/API package suites passed separately; API/web attempted separately below.
Full API test run 540s ceiling, no final summary Split attempts below; no assertion-green claim for the full suite.
API shard1/4 540s ceiling, no final summary No repeated broad retry.
API shard2/4 540s ceiling; one deployment-error-recovery case failed under concurrent load One isolated rerun of that file passed34/34 in25.33s.
Full web suite 540s ceiling; known Comments-button case failed One isolated rerun:17/18 passed; same case still failed while rendering Loading comments.

The Comments case is already tracked in SAM idea 01M7C1Z68PR1AST8TW6PXJQSZZ from another unchanged main-based branch. This PR has no apps/web or packages diff. Evidence was appended there; no unrelated UI patch is included. Report if CI fails on this exact case.

Coordinator event 822f36fe-69c0-45ff-bb1c-f5137d1badd6 accepts the local workspace ceilings, assigns full-suite verification to CI, accepts the known Comments failure as unrelated, and explicitly directs opening this draft before staging. CI43560307614 passed the main repository Test job and every applicable functional check except the known archive-cursor shard3 failure on the old merge ref. Coordinator directed one close/reopen after completion. Fresh CI43562283957 completed with every applicable functional check PASS (including full repository Test, all three DO shards and aggregate); its sole failure is the intentional needs-human-review Specialist hold. E2E43562283981 PASS. It tested merge58636f834fae01b26c252299d76cd0afbfc338a6 against main8409636ec3c6cba704d7c5b322ab48b49139505f, which includes upstream #2720 archive-test fix. Source head5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 stays unchanged; draft/needs-human-review preserved. No old-job retry or unrelated source patch was performed.

Staging Verification (REQUIRED for all code changes — merge-blocking)

  • Staging deployment green at the exact final head.
  • Live app verified via Playwright.
  • Existing workflows confirmed working.
  • New rollout-wait and authenticated version callback verified.
  • Infrastructure verification: one small Claude Code VM heartbeat/access, then one Claude Instant callback, strictly sequential.
  • Physical termination, immediate cleanup and five-minute late audit verified before releasing staging.

Staging Verification Evidence

Exact-head Deploy Staging43565598890 and smoke tests PASS. Worker version2366e7c3-a4f9-454e-8bd9-14e50043150d serves head5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 at100%. The gate stayed pending while agent application1616 targeted1617, then observed completed100% and active1617 at06:35:19 UTC. Independent Cloudflare read confirms rollout453b13c8-d109-49cd-9cb4-bd3f1002d1ed completed100% at06:35:03 and image SHA cad615af80bc292962514b5b208bf1791b9f76f5e08ed31042e0c4187a74c3a6; sandbox1902 also completed100%.

Sanitized consolidated evidence: SAM library 01M7CDNWSQ6T1ZS89ENE3J6HEZ, pr2722-staging-proof.json. Explicit Shepherd grant0725b5b8, TAKEN channel162, actual FREE channel163/a6792944 at06:59:21 UTC. One deployment and strictly sequential one VM then one Instant; no setting/profile/pool/default changes, build_and_publish, shadow enablement or extra admitted fixtures. Both ran under10 minutes, conservative total<=US$2.

Trial Runtime evidence Cleanup
VM task01M7CCGDQWG10N97V61D6PE6JC / node01M7CCGVE6KY1BN2F891906YP3 / Hetzner176076693 / incarnation5fd667f2-bb49-46f2-a791-1fd9fe1bbf59 Existing Claude Code profile, reservation200mCPU/512MiB; task placement owns the exact node. Heartbeat06:42:26.742 and authenticated owned-node container access200/count1. Task remained node_agent_ready with no workspace/assistant start; no agent-command execution claimed. Task cancelled and chat stopped before node deletion; pre-delete D1 nonattested physical termination06:43:21.735 (attestedNULL), owned node delete200, immediate06:43:44 and late06:49:18 globalnodes0/workspaceabsent. Separate direct Hetzner API absence receipt was not retained; SAM strict nonattested termination proof is preserved.
Instant task01M7CD55PPPBQHTJA1B9N63VXX / node01M7CD56YG1G86KX7N7A0NDVKB / workspace01M7CD576T0RB8BJV095D7G0XT / incarnationa1980315-a2a9-4c3e-931f-4194024d78a7 Admitted only after VM late audit. Authenticated heartbeat06:50:52.270; Claude Code executed printf marker. Initial provider instanceaeb2bf2394f31fbd3c74c75085153af6e6e7fa4a3d144bf4cce54c22533f39ad running receipt06:52:16 captured expected image before cleanup; started_at06:29:06.598 reflects the warm rollout instance. Task cancelled06:52:32 before chat stop200; D1 nonattested termination06:52:45.076/attestedNULL plus independent provider inactive06:52:45. Immediate06:53:13 and final late06:59:19 taskcancelled/workspaceabsent/globalnodes0. Subsequent node DELETE404 already absent; no force operation.

Both reported the deployment-required agent build ba3ba01, immutable binary SHA c0cb821048dc0526633a2168e4619df5bf0114099f81e640d542027aff1a9ce5. This is expected reuse because Go sources are unchanged; Worker source head remains5b86. Browser login/dashboard PASS; final signout200 and sensitive auth storage removed. Final VM/Instant D1 audits06:59:18–19 found zero nondeleted nodes and no owned workspaces. R206:59 retained exactly the same four historical context objects (three baseline plus accepted131470-byte retention object); no new context object and no deletion claimed. Shadow remained OFF.

Harness corrections: initial Instant request400 rejected VM resource overrides before task effects; corrected intent hit409 when reusing that key, then the corrected payload with a new key admitted exactly one Instant. Signout415 from missing JSON body corrected to200. No runtime retry or extra fixture occurred.

The read-only compatibility check against existing completed staging applications passed, but is not exact-head deployment proof. Another owner's rollout1616 was complete before admission yet D1 recorded old6d797 then expectedba3 after recovery; sanitized evidence library 01M7C6AWCAGTM75XQY2Y1E2JH0. Initial instance image/incarnation was not captured, so precise causality remains unproven. Require actual agent-reported version evidence independently of rollout metadata.

UI Compliance Checklist

N/A: no app UI or shared UI changes. Documentation wording only in the public website.

UI Screenshot Evidence

N/A: no changed UI surface.

End-to-End Verification (Required for multi-component changes)

  • Data flow traced below.
  • HTTP-backed capability test covers snapshot/pending/completed behavior.
  • Version source verified: authenticated callback carries compiled sysinfo.Version; /health reports liveness only.
  • Exact-head staging lifecycle proof completed with limitations below.

Data Flow Trace

deploy-reusable.yml snapshot before either engine → wait-container-rollout.ts:containerApplicationNames and container-rollout.ts:snapshotApplications save safe identities → Wrangler deploy → waitForContainerRollouts compares pre/post IDs, pins the unique target and polls API state → workflow proceeds only after completion. Staging/production entrypoints serialize through deploy-staging / deploy-production concurrency groups with cancel-in-progress:false.

VM agent internal/server/health.go sends compiled version in /ready → node-lifecycle.ts reads runtime with status → logs mismatch for Instant while retaining normal ready response/persistence.

Untested Gaps

Exact-head coordinator approval is recorded above; refreshed checks and postmerge production monitoring remain pending. CodeRabbit request/wait completed with a rate-limit outcome and no findings. The VM Claude-session-start limitation and absence of a separately retained direct Hetzner absence receipt are disclosed above. Functional CI passed at the exact source head on the refreshed merge ref. API-only no-op inference assumes successful rollout creation is visible to subsequent list requests; no concrete consistency failure has been established. Rollout completion is not an independent measurement of every running binary.

Post-Mortem (Required for bug fix PRs)

What broke

An Instant verification began after deployment success but before the container rollout reached100%, and ran an older agent.

Root cause

The existing workflow treated Wrangler deploy returning as runtime rollout completion. The authenticated ready path accepted reachability and did not expose version mismatches in structured logs. No single introducing commit is established.

Class of bug

Asynchronous deployment completion mistaken for runtime readiness.

Why it wasn't caught

Worker success and callback availability were treated as sufficient evidence without correlating the exact container rollout and actual reported agent version.

Process fix included in this PR

Shared workflow completion gate, HTTP-boundary regression, and .agent-instructions/reference/rules/13-staging-verification-full.md require separate rollout and reported-version evidence.

Post-mortem file

tasks/active/2026-11-14-container-rollout-completion.md; remaining post-rollout case stays open in idea01M7BQJ14BKVMPMKRA2GCSP8MJ.

Specialist Review Evidence

  • All local reviewers completed and findings addressed.
Reviewer Status Outcome
rollout_review PASS Re-reviewed full head5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 after Sonar refactor. Cloudflare, environment, security and constitution. Earlier first-poll supersession, metadata-only and shared-engine gaps fixed; API-only identity inference reviewed.
completion_review PASS Re-reviewed full head5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 after Sonar refactor. Task implementation, tests and docs. HTTP-boundary regression and projection-aware readiness mock resolve previous findings. Operational gates remain open.

Sonar finding review

Initial analysis at a01a061 reported six findings despite Quality Gate PASS. All six addressed in5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1, with no suppressions:

  • S3776 AaHYcRNIMioAmihIkuW-: split history validation, target pinning and completion helpers.
  • S9382 AaHYcRNIMioAmihIkuW_ / AaHYcRNIMioAmihIkuXB: independent application reads now overlap, with bounded async polling instead of await-in-loop sites.
  • S4624 AaHYcRNIMioAmihIkuXA: format rollout identifiers separately from the outer diagnostic.
  • S2699 AaHYcRK8MioAmihIkuW9: explicit first-install resolution assertion.
  • S7785 AaHYcRNJMioAmihIkuXC: top-level await with structured error handling.

114 deployment tests, script TypeScript and ESLint pass. Both specialists re-reviewed the new head and found no regressions. Fresh Sonar analysis at5b86fdd85 confirms all six issue IDs CLOSED/FIXED, with zero new issues and zero security hotspots: #2722 (comment). New exact-head CI supersedes the initial run; no old-SHA evidence is claimed as final.

CodeRabbit Review Evidence

  • Requested through trusted workflow after CI/staging gates.
  • Waited about15 minutes; no review findings arrived.
  • Observed review outcome recorded.

CodeRabbit Notes

Trusted manual request 43569040822 completed successfully after the draft label-triggered run43569038738 skipped. Request posted07:00:47 UTC. CodeRabbit reported review rate limited at07:00:55 in comment6873492125, with no findings. Observed through07:16 UTC (over15 minutes after request); no reviews or inline findings arrived. No re-trigger. The rate-limit notice is the recorded best-effort outcome. The coordinator subsequently approved the exact head and authorized readiness and hold removal; this is independent of the CodeRabbit rate limit.

Exceptions (If any)

Coordinator event822f36fe permits draft creation before staging and accepts bounded local test ceilings / known unrelated Comments failure. CI remains authoritative; staging and exact-head coordinator merge approval remain mandatory. Coordinator approval for PR2722 at full5b86fdd85ad6a2451c0671532abf4afd7ae7c8f1 is recorded above.

Agent Preflight (Required)

  • Preflight completed before code changes

Classification

  • external-api-change
  • cross-component-change
  • business-logic-change
  • public-surface-change
  • docs-sync-change
  • security-sensitive-change
  • ui-change
  • infra-change

External References

Official documentation: Cloudflare Containers rollouts, prior live application/rollout receipts and pinned Wrangler implementation inspected during research. These are read-only API calls; no external API contract is changed.

Codebase Impact Analysis

Shared deployment workflow and scripts/deploy API gate; authenticated node ready route logging and unit tests. No scheduler, container rollout strategy, session veto or app UI behavior changes.

Documentation & Specs

Self-hosting guide and staging-verification reference updated for timing variables, completion scope and log-only mismatch observability.

Constitution & Risk Check

Principles X/XI: existing Containers API, no dependency fork, bounded configurable timing, safe identity/status diagnostics without credentials/configurations. Fail closed on ambiguous identities. Availability preserved through nonblocking mismatch logging; unexplained post-rollout binary discrepancies remain open.

@simple-agent-manager simple-agent-manager Bot added the needs-human-review Agent could not complete all review gates — human must approve before merge label Nov 14, 2026
@coderabbitai

coderabbitai Bot commented Nov 14, 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 15 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

Commits

Reviewing files that changed from the base of the PR and between fb2cb3a and 5b86fdd.

Files selected for processing: 11

  • .agent-instructions/reference/rules/13-staging-verification-full.md
  • .github/workflows/deploy-reusable.yml
  • apps/api/src/routes/node-lifecycle.ts
  • apps/api/tests/unit/routes/node-lifecycle-byo.test.ts
  • apps/www/src/content/docs/docs/guides/self-hosting.mdx
  • scripts/deploy/container-rollout.test.ts
  • scripts/deploy/container-rollout.ts
  • scripts/deploy/installer-engine-workflow.test.ts
  • scripts/deploy/installer-engine.vitest.config.ts
  • scripts/deploy/wait-container-rollout.ts
  • tasks/active/2026-11-14-container-rollout-completion.md
  • 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

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@simple-agent-manager simple-agent-manager Bot removed the needs-human-review Agent could not complete all review gates — human must approve before merge label Nov 14, 2026
@simple-agent-manager
simple-agent-manager Bot marked this pull request as ready for review November 14, 2026 07:18
@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@raphaeltm

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
staging — 5b86fdd8 Deployed Nov 14, 2026 by simple-agent-manager[bot] via smoke-tests #2801
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coderabbit-review Trigger CodeRabbit review for opt-in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant