Skip to content

feat(observability): reason enums, label AST check, batch-stage env ratchet (lane 14 M1) - #22422

Merged
Git-on-my-level merged 25 commits into
integration/legacy-retirefrom
lr/14-reasons
Oct 19, 2026
Merged

Git-on-my-level merged 25 commits into
integration/legacy-retirefrom
lr/14-reasons

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

Summary

Lane 14 M1: closed reason enums with reason_label() (unknown counted in omi_reason_unknown_total, denominator omi_reason_total), live-STT / worker-validation / recovery-failure constants derived from the enums (label values unchanged), a shrink-only AST check that .labels(reason|outcome|provider|retry_class=) take closed vocabularies, the batch-stage env-read ratchet, and app_build on omi_listen_accepted_total (from X-App-Version through the existing sanitize_app_build cap).

Lane / contract

Lane 14, contracts (e) and (c) invariant 3. Sign-off for the one-line edit in routers/listen/runtime.py: lead, after #22397 (325b7e3) merged to main.

Product invariants affected

  • INV-DATA-1, INV-MEM-1, INV-MEM-4, INV-CAP-1: path match only. The gate diffs against main, so it sees other lanes' and main's changes that arrived through merged integration/main; this PR's own diff (reason enums, ratchet tests, listen app_build label) does not change those behaviours.

Verification

Targeted: reason-label, env-ratchet, monitoring-alert-contract, listen app_build / instrumentation / bootstrap, serving, live-health reconciliation, validation-disposition. Pre-push gate passed. Not run locally: the full suite (GitHub CI).

Rollback

Revert the PR; only counters and constants change, no label value changes. app_build falls back to unknown if the header is absent or malformed.

Failure-Class: none
UI-Evidence: none -- no UI source in this PR (backend counters/tests only); UI paths in the diff vs main come from merged integration/main
Line-Count-Exception: backend/routers/sync.py | 3820 -> 3857 | not touched by this PR; growth is integration-carried (gate diffs vs main)

Git-on-my-level and others added 5 commits October 19, 2026 13:23
…v ratchet (lane 14 M1)

Contract (e): utils/observability/reasons.py with ReasonFamily, per-family
enums, reason_label() and omi_reason_unknown_total. live_reason and
recovery_disposition now derive their frozensets from the enums
(behaviour-neutral; misses are also counted). Adds the shrink-only
label-argument AST check and the batch-stage env-read ratchet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nums (lane 14)

Values unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ebt list for workers/consumer.py

recovery_disposition.py is reverted to integration's version (freeze table);
re-add the enum-derived constants after #22368 lands. REASON_UNKNOWN_TOTAL
keeps the stub's name and both counters are pre-initialised per family.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
…importers land

The lane-1 stubs (#22420) are imported only by tests and by lanes' in-flight PRs. Whether
they pass the backend dead-code ratchet depended on incidental docstring mentions, so a lane
that rewrote reasons.py (#22422) made utils/rollout/runtime_percent.py dead and every lane push
failed. Allowlist all seven stub files explicitly. Each reason carries an expiry: delete at the
M3 merge.

Data allowlist only; no workflow change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
… ratchets (#22437)

Lead rulings 10-19 ~07Z (lane 9 question), contracts (a)/(b) amended in the KB:
- run_push maps a not-due claim_key (Outcome.DEFERRED, row already re-armed and woken by the
  outbox) to 200 {"status":"deferred","reason":"not_due"}; DISCARDED maps to 200 superseded.
- Result.available_at is required for RETRY and for a DEFERRED returned by process(); a
  deferring consumer without it raises before any row write.
- Outbox gains wake(row_id, wake_token), idempotent on the pair, for transactional enqueuers
  after commit; enqueue without tx, defer, and not-due claim_key create the wake themselves.

Test selection: changed backend Python selects test_reason_label_enums.py, and batch/enrichment/
workers/outbox modules select test_batch_stage_env_ratchet.py (lane 14, #22422), so a PR adding
a violation fails in its own CI. The lane-1 stub modules map to their own tests.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Git-on-my-level added a commit that referenced this pull request Oct 19, 2026
…ce on integration

#22446 (main) allowed the reason-ratio alert to land before its producers, with a test that
fails once a producer is declared. The lane-1 stub (#22420) already declares
omi_reason_unknown_total, so after the #22388 sync every integration PR failed
test_pending_backend_alert_metric_allowances_expire_when_the_producer_lands. Keep only
omi_reason_total pending; lane 14 (#22422) removes it when it lands the denominator.

Verified: pytest tests/unit/test_monitoring_alert_rule_contract.py, 60 passed (unit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git-on-my-level and others added 12 commits October 19, 2026 17:02
…App-Version (lane 14)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…kReason (#21932 landed)

Adds the nine reasons #21932 introduced; set unchanged (65 values).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
… and WorkerValidationReason (values unchanged)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ve to main; lane 14 is backend-only)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 19, 2026 15:20
@chatgpt-codex-connector

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 ⚠️ Failed 2026-10-19T15:20:54.343948Z 89b24d6 Draft marked ready
ℹ️ 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

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

…nnot break session start

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 1db3254 into integration/legacy-retire Oct 19, 2026
23 checks passed
@Git-on-my-level
Git-on-my-level deleted the lr/14-reasons branch October 19, 2026 17:40
ZhaZhaBei pushed a commit to ZhaZhaBei/omi that referenced this pull request Oct 22, 2026
…BasedHardware#22513 x BasedHardware#22422)

BasedHardware#22513 added CAP_HOLD_RESERVATIONS_RELEASED.labels(outcome=outcome) and BasedHardware#22422's
contract (e) label ratchet landed after it, so test_reason_label_enums fails on
the integration tip and in every lane PR. Route the value through a
_bounded_outcome() helper that folds non-members of OUTCOMES to 'unknown'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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