Skip to content

fix: record metrics for ambient gate declines - #997

Open
time-attack wants to merge 1 commit into
mainfrom
fix/ambient-decline-metrics
Open

fix: record metrics for ambient gate declines#997
time-attack wants to merge 1 commit into
mainfrom
fix/ambient-decline-metrics

Conversation

@time-attack

@time-attack time-attack commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Addresses the missing ambient-gate metrics in #609, reported by @ianTPE from a running QM deployment. This intentionally does not close the broader issue.

When the ambient reply gate chose silence or an emoji reaction, the orchestrator returned before writing a turn metric. Record one metric at that existing decision point, with the actual status, session, scope, optional run ID, and detection duration.

No answer harness runs on this path, so totalMs is zero. Admission-to-decision time is recorded in the existing ingressMs field; detectMs remains its detection-phase subset. This preserves the meaning of completed-turn timing fields instead of mixing two time bases.

Scope

Validation

  • Silent and reaction regressions failed with zero rows before the fix and pass afterward.
  • Tests assert exactly one main metric, correct run/session/scope, zero harness duration, and ingress duration covering detection. A normal answered-turn control is unchanged.
  • Orchestrator suite: 150 passed.
  • Admin metrics, metrics sink, and turn-metrics route suites: 11 passed.
  • Core typecheck, full ESLint, Oxlint, formatting, and Knip passed.
  • Independent review caught the initial timing-basis mismatch; it was corrected and re-reviewed successfully.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Persist silent and reaction gate decisions with their run, session, scope, and detection timing. No answer harness runs, so leave totalMs at zero and retain pre-harness elapsed time in ingressMs.

Co-authored-by: Ian Chou <ertiach@gmail.com>
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