Repository navigation
Preserve model routing attribution in audit and logs - #67114
Conversation
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
|
@copilot resolve merge conflicts |
There was a problem hiding this comment.
🟡 Changes recommended
Production outcome writers omit promised endpoints, audit comparisons discard them, and endpoint-distinct route ordering is unstable.
2 open findings
What changed in this PR
Preserves harness-selected model-routing attribution across artifact downloads, unified sessions, audit reports, and logs.
Changes:
- Preserves final agent metadata while flattening artifacts.
- Adds workflow and routing-outcome session events.
- Consumes session attribution and updates schemas, cache versions, documentation, and tests.
| File | Description |
|---|---|
schemas/logs.schema.json |
Adds endpoint fields to logs schemas. |
schemas/logs-jsonl.schema.json |
Adds endpoints and bumps cache schema. |
schemas/audit.schema.json |
Exposes routing endpoints in audits. |
pkg/cli/model_routing.go |
Merges session routing attribution. |
pkg/cli/model_routing_test.go |
Tests session attribution. |
pkg/cli/model_routing_session.go |
Parses routing session events. |
pkg/cli/logs_report.go |
Reports endpoint attribution. |
pkg/cli/logs_models.go |
Adds selected endpoint metadata. |
pkg/cli/logs_flatten_test.go |
Tests nested artifact preservation. |
pkg/cli/logs_download_flatten.go |
Safely stages and flattens agent artifacts. |
pkg/cli/logs_cached_json.go |
Invalidates and updates cached attribution. |
pkg/cli/logs_cached_json_test.go |
Updates cache-version tests. |
pkg/cli/audit_report_render.go |
Renders effective and selected endpoints. |
pkg/cli/audit_expanded.go |
Adds session metadata fallback. |
docs/src/content/docs/specs/unified-agent-session-specification.md |
Documents routing events and fields. |
docs/public/schemas/unified-session.schema.json |
Extends the public session schema. |
actions/setup/sh/collect_usage_artifact_files.sh |
Prefers final agent metadata. |
actions/setup/sh/collect_usage_artifact_files_test.sh |
Tests final metadata collection. |
actions/setup/js/unified_session.test.cjs |
Tests routing session collection. |
actions/setup/js/unified_session.cjs |
Emits workflow and routing events. |
actions/setup/js/unified_session_render.test.cjs |
Tests endpoint rendering. |
actions/setup/js/unified_session_render.cjs |
Renders routing events. |
actions/setup/js/unified_session_payload.test.cjs |
Tests workflow metadata normalization. |
actions/setup/js/unified_session_payload.cjs |
Normalizes routing payloads. |
actions/setup/js/types/unified_session.d.ts |
Adds routing event types. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…s-loss # Conflicts: # pkg/cli/audit_report_render.go # pkg/cli/logs_report.go # pkg/cli/model_routing.go # pkg/cli/model_routing_test.go # schemas/logs.schema.json Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
Resolved the conflicts by merging |
|
Warning Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs for details. @copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: ec02768
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
|
Verified
The download fix also works on artifacts from before this PR. @copilot /pr-finisher |
…s-loss Co-authored-by: SivaKesava1 <11771739+SivaKesava1@users.noreply.github.com>
|
Ready for review. Sandbox-verified at |

Agent artifact flattening discarded final routing metadata, and unified sessions omitted workflow metadata and the harness outcome. As a result, audit and logs could report AWF’s selected endpoint instead of the endpoint and effort actually used by the harness.
aw_info.jsonfor existing consumers and prefer it in usage artifacts.workflow.infoandmodel_routing.outcome; document their routing fields and the existingfirewall.model_routingfields in the specification and schema.aw_info.jsonand AWF routing logs as fallbacks. Invalidate cached summaries from the prior schema version.Example session events:
{"type":"workflow.info","data":{"model":"claude-sonnet-5","requestedModel":"agent","modelRouting":{"effectiveEndpoint":"/v1/messages","selectedEndpoint":"/chat/completions"}}} {"type":"model_routing.outcome","data":{"status":"selected","effectiveEndpoint":"/v1/messages","selectedEndpoint":"/chat/completions","appliedEffort":"medium"}}