Skip to content

ci: release and CI reliability bundle (checkout stalls, mobile pin race, batch verify, local CPU cap, pusher probe) - #22936

Merged
Git-on-my-level merged 8 commits into
mainfrom
lane/ci-rel
Oct 20, 2026
Merged

Git-on-my-level merged 8 commits into
mainfrom
lane/ci-rel

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

David named this workflow change on 2026-10-20 (two-lane lead session): CI/release reliability

Summary

This PR fixes five CI and release reliability problems from 2026-10-20. It edits existing workflows and scripts only; it adds no new workflow files.

1. Checkout stall bound everywhere

  • Before: ci: abort stalled git fetches so checkout retries instead of hanging #22890 set GIT_HTTP_LOW_SPEED_LIMIT=1000 / GIT_HTTP_LOW_SPEED_TIME=60 on 6 workflows. The other 66 that use actions/checkout could still hang 7–10 minutes on a stalled fetch, until the TCP reset.
  • After:
    • All 72 checkout workflows set both variables in their workflow-level env. The edit was mechanical: the keys go at the top of an existing env: block, or a new block goes before jobs:.
    • A new guard, .github/scripts/check_workflow_checkout_stall_bounds.py, fails when a workflow checks out without them. It is registered in the manifest as workflow-checkout-stall-bounds (local + ci lanes) and modeled on workflow-apt-network-bounds.
    • A workflow that calls a local composite action which itself runs actions/checkout is held to the same rule (deploy-backend-stack, firestore-readiness). Otherwise moving a checkout into an action would hide the missing bound.
  • Verified: 9 guard self-tests, including the real tree (80 workflow files OK). actionlint on all 66 edited workflows reports no new non-shellcheck findings. The apt guard and the manifest tests still pass.

2. Codemagic source-pin race

  • Before: dispatch_mobile_internal_builds.py dispatches a branch with OMI_RELEASE_SOURCE_SHA. Codemagic's "Verify dispatcher source pin" failed whenever main moved during the roughly one minute before clone. Both the iOS and Android internal builds died that way on 10-20.
  • After: both internal workflows run app/scripts/checkout_release_source_pin.sh.
    • If HEAD equals the pin, the build continues unchanged.
    • If main moved and the cloned tip still contains the pin (merge-base --is-ancestor, fetching or unshallowing if needed), it checks out the pin detached and re-verifies HEAD. The build then uses exactly the evaluated commit, and build_provenance_dart_defines.sh's HEAD==pin check still holds.
    • Everything else fails closed: an invalid pin, a pin the tip does not contain, or a failed fetch or checkout.
    • The body runs as a single parsed function, so checking out a different commit cannot rewrite the script while it runs.
  • Why not a tag: dispatching a ci/mobile-internal/<sha> tag needs contents: write in the dispatcher, adds a tag to the public repo per build, and could fire Codemagic's tag_push workflows.
  • Known limit: Codemagic still reads codemagic.yaml from the tip. Only the step definitions are newer; the source being built is the pin.
  • Verified: 6 new tests run the script against temporary git repos: matching, moved tip, pin off the tip's history, invalid or unknown pin, unpinned, and both workflows wired. Not yet verified on a live Codemagic build; the next mobile internal build is the check.

3. Batch worker deploy false failure

  • Cause: run 39456573983, job 118744919919. Verify rollout started at 16:32:38Z and the job closed at 17:19:30Z. The only annotation is "The hosted runner lost communication with the server". The log is BlobNotFound, and the always() summary and notify steps stayed pending. So the runner died; it was not a hung kubectl or a timeout. rollout status --timeout=1800s must have returned by 17:02, and no job timeout was set (default 360 min).
  • Names are correct: the Deployment is {{ .Release.Name }} = prod-omi-batch-pipeline-worker, matching deploy/$TARGET_RELEASE.
  • Real gaps found:
    • Nothing except rollout status was bounded.
    • The 1800 s wait (and the chart's progressDeadlineSeconds: 1800) is shorter than Recreate's 1500 s old-pod drain plus GPU startup, so a healthy rollout could report failure.
    • The check never confirmed the built digest.
  • After:
    • Job timeout-minutes: 75 (healthy runs take ~14 min) and step timeout-minutes: 45.
    • rollout status waits 2400 s for batch-pipeline-worker, and the chart's progressDeadlineSeconds is raised to 2400 to match.
    • After rollout, the step asserts the Deployment template serves @$EXPECTED_DIGEST.
    • deploy_status_report.py is capped with timeout 120, and its kubectl get calls carry --request-timeout=30s.
    • A hang now ends as a failure, and the summary and Telegram steps still run. A lost runner still ends with no conclusion; the in-place comment says to re-run the job. Splitting verify into its own job would re-trigger the prod environment gate, so I left it out.
  • Verified: the updated and new tests in test_batch_pipeline_chart.py run the real step script with a stub kubectl. They cover the 2400 s/600 s budgets, digest match passes, digest mismatch fails, and the timeouts are present. 94 tests passed across the chart, deploy_status_report and workflow-contract files.

4. Local pre-push CPU cap

  • Before: backend/test.sh defaulted BACKEND_FAST_UNIT_FAIL_SECONDS to 0.30 s, against CI's 1.0 s. On 10-20 it failed lane 1's sync push twice on tests that pass alone and pass in CI.
  • After: the local default is 1.0 s, the same as backend/scripts/run-unit-ci.sh (unchanged). The 0.1 s warn target still reports anything over it. The README and allowlist header are updated.
  • Verified: test_fast_unit_duration_guard.py and test_backend_unit_ci_runner.py pass. CI's limit is untouched.

5. Pusher dev live probe listen_closed_early

  • Root cause: there were six failures, not three, all in gcp_backend_pusher_auto_deploy.yml on 10-19/20, including 5098bbc, ff9e323 and fbb197a. Each one came 15–17 s after a helm upgrade dev-omi-backend-listen, started by gcp_backend_auto_dev.yml or gcp_backend_listen_helm.yml, landed mid-probe.
    • Those workflows hold the deploy-backend-stack-development lock, not the pusher lock.
    • Dev listen runs one replica with preStop: sleep 15, so the pod the port-forward is pinned to terminates mid-probe.
    • The passing rerun had no listen rollout during it.
Pusher run (SHA) Probe start Listen upgrade (run) Probe FAIL
39328054517 (4981b47) 21:37:55 21:40:03 (39323936732) 21:40:19
39343445910 (bc5482c) 23:51:27 23:53:18 (39340357028) 23:53:35
39408703781 (ff9e323) 10:38:30 10:41:30 (39405193597) 10:41:46
39412650530 (5098bbc) 11:32:24 11:34:24 (39409319664) 11:34:40
39464841497 a1 (fbb197a) 17:28:10 17:28:33 (39464841503) 17:29:12
39472466605 (3383bc6) 18:18:06 18:20:30 (39466434123) 18:20:45
  • Fix: a bounded retry with the reason logged. Sharing the backend-stack lock would make the probe and queued backend deploys cancel each other, because GitHub keeps only one pending run per group.

    • The probe receipt and status line now carry listen_close_code. Only the code is recorded, never the reason text.
    • The step waits for any in-flight listen rollout, records the listen Deployment's metadata.generation, and runs the attempt.
    • It retries once, and only when the stage is listen_closed_early and the generation changed during the attempt. It then emits a ::warning with the stage, close code and generation change, and keeps the first receipt as pusher-dev-semantic-probe.attempt1.json (uploaded).
    • Setup failures, any other stage, an unchanged generation, or an unreadable generation are final.
  • Verified: 5 new tests run the real step script with stubbed kubectl, python3 and curl:

    • retry then pass;
    • no retry when the generation is unchanged;
    • no retry for another stage;
    • at most one retry;
    • the attempt receipt is uploaded.

    The probe tests assert close code 1006 in the receipt and the status line. All 26 tests in test_pusher_deployment_control_workflow.py pass, including the bash-5 parse check.

6. Main-red Windows CLI job (found while merging)

  • Before: python-cli-ci "Windows ACL / Python 3.12" has been red on main since 2026-10-20 (run 39442884972). It fails test_conversation_from_segments_rejects_directory and ..._file_parent_is_not_a_directory. The job runs on this PR only because python-cli-ci.yml gained the stall env.
  • After: from_segments recognizes both cases. The is_dir/is_file probes are wrapped so they cannot raise a second error.
  • Verified: 2 new tests simulate the Windows exceptions on every OS. The full CLI suite passes locally on macOS (922 passed, 1 skipped). The real Windows job is verified by this PR's CI.

Review (Grok, via agentctl)

The first pass returned REQUEST_CHANGES with three findings, all fixed in 96a3564:

  1. Blocker: the pinned Codemagic build would still fail later, in build_provenance_dart_defines.sh, because HEAD != CM_COMMIT (the cloned tip).
    • The pin script now writes OMI_RELEASE_PIN_CLONED_TIP to $CM_ENV, and fails closed if CM_ENV is unset inside Codemagic.
    • Provenance accepts the mismatch only when HEAD is the pin, the recorded tip equals CM_COMMIT, and the pin is an ancestor of it.
    • Tests cover the accept case and three reject cases in build_provenance_dart_defines_test.sh, plus the CM_ENV record in the dispatcher tests.
  2. Major: the pusher retry could fire when the after-read of the generation failed (unknown != numeric). Both reads must now be integers and must differ; two test cases were added.
  3. Minor: the guard missed staged action paths (./.github/firestore-workflow/.github/actions/firestore-readiness). It now matches by suffix; a test was added.

Lane / contract

Lane ci-rel (P4), CI/release reliability; owner sign-offs for edits to other lanes' files: none

Product invariants affected

  • INV-DATA-1: path match only. The workflow-level GIT_HTTP_LOW_SPEED_* env lines were added to production-family deploy workflows (and the batch-worker Verify rollout bounds). No routing or data-plane behavior changes.
  • INV-AUTH-1: path match only. The checkout stall env was added to a desktop workflow; no auth/session code is touched.
  • INV-BETA-1: path match only. The checkout stall env was added to a desktop release workflow; no Beta promotion logic changes.
  • INV-MEM-4: path match only. The checkout stall env was added to memory-maintenance job workflows; no memory pipeline code is touched.

Verification

  • Layer measured: unit and contract tests plus static lint only. No workflow ran live; no deploy.
  • Targeted tests:
    • backend/test.sh with test_batch_pipeline_chart, test_deploy_status_report and test_workflow_contracts: 94 passed.
    • test_pusher_deployment_control_workflow: 26 passed.
    • test_pusher_semantic_probe, test_fast_unit_duration_guard and test_backend_unit_ci_runner: passed.
    • .github/scripts: checkout-stall guard (9), apt guard, test_run_checks (one environment-only failure, test_new_marker_requires_tracking_issue, unrelated), and the new dispatcher pin tests (15 incl. existing).
  • Not run locally: TestPendingCommits.test_a_non_ancestor_baseline_counts_as_pending, which already hangs in a local partial clone. It is unchanged by this PR; CI uses a full clone.

Rollback

Revert this PR. Each item is independent, and no data or runtime state changes. The chart's progressDeadlineSeconds takes effect only on the next batch-worker deploy.

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 4 commits October 21, 2026 02:04
…ce, batch verify, local CPU cap, pusher probe)

David named this workflow change on 2026-10-20 (two-lane lead session): CI/release reliability

- Checkout stall bound everywhere: GIT_HTTP_LOW_SPEED_LIMIT/TIME at workflow
  level in the 66 workflows #22890 did not cover, plus a manifest-registered
  guard (workflow-checkout-stall-bounds) that fails when a workflow checks out,
  directly or through a local composite action, without them.
- Codemagic source-pin race: the internal iOS/Android pin step now runs
  app/scripts/checkout_release_source_pin.sh, which checks out the evaluated
  SHA when main moved past it between dispatch and clone, and fails closed on
  an invalid pin, a pin the tip does not contain, or a failed fetch/checkout.
- Batch worker deploy: Verify rollout is bounded at every layer (job 75 min,
  step 45 min, kubectl request timeouts, status report capped), its wait covers
  Recreate's 1500 s drain plus GPU startup (2400 s, chart progress deadline to
  match), and it asserts the deployment serves the built digest. The 10-20 run
  lost its runner; that still needs a job re-run, now documented in place.
- Local pre-push CPU cap: test.sh's default fail limit 0.30 s -> 1.0 s, same as
  CI's runner (unchanged). Warn target stays 0.1 s.
- Pusher dev probe: all six listen_closed_early failures on 10-19/20 landed
  15-17 s after a dev listen helm upgrade under the other deploy lock. The
  probe now records the WebSocket close code, and the step retries once, only
  for listen_closed_early and only when the listen Deployment's generation
  changed during the attempt; the first receipt is kept as attempt1.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checkout step

Only the document-level raw and semantic digests move; the desktop release
and preview workflow digests are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Codemagic pin: build_provenance_dart_defines.sh compared HEAD with CM_COMMIT
  (the cloned tip) and would have failed the pinned build one step later. The
  pin script now records OMI_RELEASE_PIN_CLONED_TIP in $CM_ENV (fails closed
  inside Codemagic if CM_ENV is unset), and provenance accepts HEAD != CM_COMMIT
  only when HEAD is the pin, the recorded tip is CM_COMMIT, and the pin is its
  ancestor.
- Pusher probe retry: an unreadable generation after the attempt ("unknown")
  differed from the numeric before-read and allowed a retry. Both reads must
  now be integers and differ.
- Checkout stall guard: match staged copies of checkout actions
  (./.github/firestore-workflow/.github/actions/firestore-readiness) by suffix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T21:40:09.452077Z da5e7ad New commits
ℹ️ 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 chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7da7b51f70

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

return 1
fi

git checkout --quiet --detach "$pin"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Record the cloned tip before checking out the pin

When main advances between dispatch and clone—the exact race this script handles—this detaches HEAD to OMI_RELEASE_SOURCE_SHA while Codemagic leaves CM_COMMIT set to the cloned branch tip. Both internal workflows later invoke app/scripts/build_provenance_dart_defines.sh, whose lines 42-44 require HEAD to equal CM_COMMIT, so the build still deterministically fails after the checkout succeeds. Persist the original tip through CM_ENV and teach the provenance check to accept the verified pin/ancestor relationship.

Useful? React with 👍 / 👎.

if not isinstance(document, dict):
return []
checks_out = any(
_is_checkout(uses) or (isinstance(uses, str) and uses.rstrip("/") in checkout_actions)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recognize staged checkout-action paths

For the required staged Firestore action, workflows use ./.github/firestore-workflow/.github/actions/firestore-readiness, while checkout_action_refs() records only ./.github/actions/firestore-readiness; this exact-membership test therefore does not recognize the staged action as containing checkout. A caller whose only checkout is inside that staged composite can omit both bounds and still pass this new guard, so match the known action reference by normalized suffix as well.

AGENTS.md reference: .github/AGENTS.md:L33-L33

Useful? React with 👍 / 👎.

stage="$(jq -r '.failure_stage // "unknown"' pusher-dev-semantic-probe.json 2>/dev/null || echo unknown)"
close_code="$(jq -r '.listen_close_code // "none"' pusher-dev-semantic-probe.json 2>/dev/null || echo none)"
generation_after="$(listen_generation)"
if [[ "$stage" != listen_closed_early || "$generation_before" == unknown || "$generation_after" == "$generation_before" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject an unreadable post-probe generation

If the first generation read succeeds but the post-probe kubectl get fails, listen_generation returns unknown; because unknown differs from the numeric pre-probe value, this condition incorrectly treats the failed read as proof of a rollout and retries. A transient Kubernetes API failure can therefore mask an unrelated listen_closed_early result and produce misleading qualification evidence; require both generation values to be integers before comparing them.

Useful? React with 👍 / 👎.

rollout_timeout=600s
if [[ "$SERVICE" == "batch-pipeline-worker" ]]; then
rollout_timeout=1800s
rollout_timeout=2400s

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover the full Recreate rollout budget

When the old batch worker uses most of its 1500-second termination grace and the replacement takes more than 900 seconds to become ready, this 2400-second wait fails a rollout that is still within the chart's healthy envelope: backend/charts/batch-pipeline-worker/templates/deployment.yaml lines 106-109 allow up to 1200 seconds for the startup probe alone, before accounting for scheduling, image pull, or readiness. The chart's matching progressDeadlineSeconds: 2400 has the same under-budget problem, and the 45-minute step ceiling leaves no room for verification at the full 1500+1200-second bound, so all three limits need headroom above the derived Recreate budget.

AGENTS.md reference: .github/AGENTS.md:L26-L26

Useful? React with 👍 / 👎.

Git-on-my-level and others added 4 commits October 21, 2026 03:47
…Windows

python-cli-ci "Windows ACL / Python 3.12" has been red on main since
2026-10-20 (run 39442884972), and it blocked this PR because the workflow
edit selects the job. #22271 opened the segments file directly and relied
on POSIX errors: Windows raises PermissionError for a directory (not
IsADirectoryError) and FileNotFoundError for a path under a regular file
(not ENOTDIR). Recognize both, with probes that cannot raise a second
error, and cover them on every OS by simulating the Windows exceptions.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…is branch

The workflow-checkout-stall-bounds guard flagged it on the merge ref.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Grok review of 5067480: Win32 collapses `..` before lookup, so
notes.txt\..\missing.json is a missing file, not a path under notes.txt.
Normalize before scanning parents (except \\?\ and \\.\ paths).

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 97e974e into main Oct 20, 2026
77 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/ci-rel branch October 20, 2026 22:27
MichaelC001 pushed a commit to MichaelC001/omi that referenced this pull request Oct 21, 2026
…ace-package ImportError

BasedHardware#22936 added a repo-root scripts/ namespace package; from scripts import export_openapi
now raises plain ImportError (unknown location) which ModuleNotFoundError did not catch.
Widens the direct-CLI fallback to ImportError. Unblocks every branch off tonight's main
in the backend-route-policy-baseline pre-push check (loop: firestore-reads, WQ2 carrier PR).
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