fix(observability): export shared metrics after task completion - #73544
Merged
jquesnelle merged 2 commits intoJul 28, 2026
Merged
Conversation
Signed-off-by: Alex Fournier <afournier@nvidia.com>
Signed-off-by: Alex Fournier <afournier@nvidia.com>
jquesnelle
enabled auto-merge
July 28, 2026 19:22
jquesnelle
disabled auto-merge
July 28, 2026 19:42
This was referenced Jul 28, 2026
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…top-outbox-export fix(observability): export shared metrics after task completion
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Shared-metrics packages were created when a Relay session closed. Desktop sessions are long-lived, so a normal completed desktop task could update SQLite without creating an outbox entry.
This moves the export opportunity to task completion. Package creation is gated by the durable SQLite outbox, so Hermes creates packages at most once per UTC day across tasks, threads, processes, and restarts. Session close and runtime shutdown remain fallback opportunities and use the same gate.
The gate uses the committed package timestamp rather than the file-write timestamp. If writing the outbox file fails, a later task can retry the write without packaging the same counter deltas twice.
Package creation only runs after Relay subscriber flushing succeeds. A failed flush leaves the daily gate open so a later same-day task can flush the complete queue and create that day's package.
Related Issue
Follow-up to #67607.
Type of Change
Changes Made
SharedMetricsStore.How to Test
telemetry.shared_metrics.enabled.telemetry/shared_metrics/outbox.Validation run:
662 passedacross the shared-metrics store, runtime, lifecycle, desktop gateway, lazy-session, and smoke-harness suites.git diff --checkpassed.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
A direct native smoke completed one Hermes task without requiring an explicit session close. The SQLite snapshot showed
value=1andpackaged_value=1forhermes.task_run.started,hermes.task_run.finished, andhermes.model_call.count, with one schema-valid outbox package.The temporary native flush-failure harness then forced the first eligible flush to fail. It verified zero package rows and files after that failure, followed by one same-day package with
started=2andfinished=2after the next task completed.