Skip to content

SCA-2918: Export conversations v3 builder metrics from backend-sync - #26307

Merged
Git-on-my-level merged 6 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/v3-sync-gate-metrics-2
Nov 25, 2026
Merged

Git-on-my-level merged 6 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/v3-sync-gate-metrics-2

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Replaces #26299: GitHub stopped syncing that PR's head (stuck at 9980247 while the branch moved to 8197954 with panel fixes). Same commits.

Summary

SCA-2918. Export the six existing conversations-v3 builder families through the backend-sync Cloud Run GMP profile. The profile is shared with sync-backfill and integration, so filter by service when reading the gate. The stage stays at beta. No application code changes.

One full production beta hour

Use a full hour after telemetry is serving. Require positive request volume, observed successful commits, and live scrapes throughout the window. A missing series is missing evidence.

  1. Reconcile 5xx <1%. Count request logs using this Logs Explorer filter over the hour. Divide the count with httpRequest.status>=500 AND httpRequest.status<600 appended by the count using the base filter.

    resource.type="cloud_run_revision"
    resource.labels.service_name="backend-sync"
    log_id("run.googleapis.com/requests")
    httpRequest.requestMethod="POST"
    httpRequest.requestUrl=~"/v1/conversations-v3/reconcile([?].*)?$"
    
  2. Committed reconciles. Require a positive result from:

    sum(increase(omi_conversations_v3_reconciles_total{service_name="backend-sync",outcome="committed"}[1h]))
    
  3. Pending recordings older than one hour. This query counts observations older than one hour. The sweep can observe the same recording repeatedly. An exact distinct backlog count requires an approved aggregate count over the conversations collection group with v3_pending == true and v3_pending_since < now - 1h, restricted to the user recording rows counted by the sweep. Confirm the sweep ran during the window before interpreting zero.

    sum(increase(omi_conversations_v3_pending_age_seconds_count{service_name="backend-sync"}[1h]))
    - sum(increase(omi_conversations_v3_pending_age_seconds_bucket{service_name="backend-sync",le=~"3600(\\.0)?"}[1h]))
    
  4. At most one outline call per conversation. Use the following for total outline attempts. The counter has no conversation key, and a committed reconcile can affect several conversations. An exact gate needs a correlated aggregate of outline attempts grouped by conversation, then the maximum count across conversations. Do not substitute outlines per reconcile.

    sum(increase(omi_conversations_v3_model_calls_total{service_name="backend-sync",kind="outline"}[1h]))
    
  5. Late-rewrite cost share <=5%. Use the following for persisted rewrite volume. The gateway ledger is the cost source. The exact gate needs the sum of gateway cost attributed to late rewrites divided by total v3 builder cost for the same hour and scope. This write counter contains neither cost nor a correlation key. No exact query for this ratio was verified. The rollout remains gated pending an attributable aggregate.

    sum(increase(omi_conversations_v3_summary_writes_total{service_name="backend-sync",kind="rewrite"}[1h]))
    

Terminal failure and race counters are available for diagnosis. This PR is scoped to the five SCA-2918 gates. Blocked/adopted counters and visibility/summary latency are separate runbook readouts. Labeled counters are registered by the existing metrics module and become visible when their producer observes a label value.

Verification

The scrape contract exercises all six families and rejects an arbitrary v3 family.

Failure-Class: FC-metric-dropped-by-scrape-allowlist

🤖 Generated with Claude Code

View guided diff

Git-on-my-level and others added 4 commits November 25, 2026 10:25
Failure-Class: FC-metric-dropped-by-scrape-allowlist

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-metric-dropped-by-scrape-allowlist

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GitHub kept reporting the PR head at 9980247 after 8197954 was pushed.

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

chatgpt-codex-connector Bot commented Nov 25, 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-25T16:36:34.000087Z 2bf0b13 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.

…rics

# Conflicts:
#	backend/deploy/cloud_run_gmp_sync.yaml

@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: ed4c0dc84a

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



def test_backend_sync_scrapes_v3_builder_metric_families():
from utils.conversations.v3 import metrics

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 Move the metrics import to module scope

The new function-local import violates the explicit import convention in backend/AGENTS.md: “All imports at module top level — never inside functions.” Move metrics into the existing module-level import block; this test does not perform any pre-import mocking that requires deferring it.

AGENTS.md reference: backend/AGENTS.md:L168-L168

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 2bf0b13: the import is now at module scope (as v3_metrics).

Failure-Class: none
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 8373516 into BasedHardware:main Nov 25, 2026
56 checks passed
Git-on-my-level added a commit that referenced this pull request Nov 27, 2026
## Summary

SCA-2918. Supersedes #25659. Set the shared conversations v3 runtime
stage to `all`. The existing capable-client admission check still
applies.

PR #26307 adds pending-age telemetry to the backend-sync collector
allowlist; Release verified the GMP series on SCA-4803. **Activation and
auto-revert (David, 2026-11-26 ~15:30 UTC; ANX ask
ev_f3d6aeedf66a59bcb4eecaa691daa070, recorded on SCA-2918 comment
01a21878), superseding the earlier manual p95 rule.** The flip follows
one settled hour with the recovery carrier `afab9560` serving
backend-sync and the parked backlog falling. Home v3 posted a passing
READBACK on SCA-2918 at 19:32 UTC. An auto-revert executor
(omi-workspace `infra/rollout/bin/v3_stage_guard.py`, reviewed; Release
runs it under SCA-4803) captures the baseline at the flip and returns
the full set to `beta` if any of these hold: corrected backend-sync
reconcile 5xx (2xx/3xx ×10 for log sampling) above 5%; pending rows
older than 1 h above 2× the at-flip count within 2 h; or
`v3_derived_budget` or `document_too_large` blocks above 2× the pre-flip
hour. The rollout note includes the queries and an unsampled Cloud Run
request-count cross-check.

Follow the activation order. Verify llm-gateway first, then deploy
backend, backend-sync, backend-sync-backfill and backend-integration.
Run desktop-backend's production workflow separately after those Cloud
Run writers, then apply the shared ConfigMap and roll pusher followed by
backend-listen. The desktop stage and kill-switch settings are for
manifest parity only. The desktop entrypoint has no v3 admission routes,
so its deploy does not change runtime behavior; it does gate the
activation parity check (READY). Also deploy backend-projection-pump and
the four manifest-managed jobs: notifications-job (full deploy),
x-connector-sync-job, frame-request-retention-job, and
day3-reengagement-email-job.

To reverse the move, restore `conversations_v3_stage: beta` in the
shared source, regenerate the manifest, and redeploy the same set. For a
hard stop, set `conversations_v3: 'off'` under `overlay` in
`backend/deploy/runtime_env/prod.overlay.yaml`, regenerate the manifest,
and redeploy the full set. Existing marked recordings continue draining.

After a desktop rollback or retained-revision recovery at stage all,
either forward-redeploy desktop with the current manifest or return the
full set to beta. Rerun the activation parity check with fresh serving
state.

## Verification

- Hermetic backend pre-deploy check passed. Dev and prod env validation
passed, along with 43 source-admission tests and 707 deploy tests.
- Runtime env sources, activation manifest, and desktop backend
contracts passed (119 tests).
- Actionlint passed for both updated workflows.
- After panel follow-up, 557 focused tests passed. Mutating the rendered
desktop stage or kill switch independently blocked activation.

- Final panel follow-up passed 152 monitoring and activation tests,
Actionlint, the CI budget check, and manifest composition. The sampling
correction passed mock mixed-status, zero-error, and empty-window cases.

## Product invariants affected

- INV-DATA-1. Desktop deploys retain their existing environment-specific
data-plane bindings.
- INV-MEM-4. Runtime stage and first app build parity use the generated
manifest, including desktop-backend.

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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