Skip to content

Read AWF per-conversation steering deliveries from the unified session - #77088

Merged
pelikhan merged 24 commits into
mainfrom
copilot/read-awf-budget-notice-records
Nov 13, 2026
Merged

pelikhan merged 24 commits into
mainfrom
copilot/read-awf-budget-notice-records

Conversation

Copilot AI commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

AWF releases after v0.29.11 send each budget notice to every conversation in a run, once. They also add a little_left notice, which has a null threshold. Each delivery is recorded in a new steering_delivery field in token-usage.jsonl, and the *_steering events gain trigger and conversation. gh-aw dropped steering_delivery, and its decoder turned a null threshold into 0, so audits could not show which conversations received a notice.

Session file (usage/aw_session.jsonl)

  • firewall.token_usage and usage.report carry steering_delivery as steeringDelivery, keeping only type, trigger, threshold, conversation and first. A record that doesn't match AWF's contract is dropped. The contract:
    • threshold is 80, 90, 95 or 99 when trigger is threshold, and null exactly when it is little_left.
    • conversation is 12 lowercase hex characters, or null.
    • first is a boolean.
  • firewall.steering keeps trigger, conversation, and a null threshold.
  • unified_session.d.ts gains a SteeringDelivery type. The schema is regenerated from it, and the renderer prints the new fields.

gh aw audit / gh aw logs --json

  • New steering_deliveries list, read only from the session file, with one entry per delivery. It appears at the top level of audit and of each logs run, and on firewall_token_usage. A little-left notice has "threshold": null, never 0:
    {"type":"timeout","trigger":"little_left","threshold":null,"conversation":null,"first":true,"request_id":"req-4","phase":"agent"}
  • steering_notices is unchanged and still has at most one entry per threshold per run.
  • gateway_steering_events entries gain trigger and conversation. The console and timeline show "little left" (for example credit little left) instead of a percentage.
  • TokenUsageSteeringDelivery decodes leniently: a malformed delivery never rejects its token-usage record. Records without steering_delivery (AWF v0.29.11 and older) still decode.
  • gateway_steering_events still prefers the raw api-proxy event log and falls back to the session file, as before. Only the new steering_deliveries list is sourced exclusively from the session file.
  • A delivery with a missing or null first is dropped rather than read as false.
  • The audit cache (auditSchemaVersion 14) and logs JSONL cache (cachedLogsJSONLSchemaVersion 6) are bumped, so cached results from before this change are rebuilt with the new fields.
  • Console output passes every session- and log-derived steering string (type, message, conversation, request ID, phase, timestamp) through sanitizeControlChars.
  • The session, audit and logs schemas enforce the trigger/threshold pairing, so they reject the same deliveries the decoders drop.

Smoke test

  • T1 also passes when the main agent received an ai_credit little_left delivery on a 2xx response before 80%, which AWF can send on the 7-credit smoke budget. The session steeringDelivery must match the token-usage.jsonl record on all five fields.
  • T2's at-most-once check still uses the legacy steering records. A new test covers repeated steering_delivery records across conversations. T2 allows zero threshold notices only after such a little_left delivery, and only when no steerable 2xx main-agent request started at or above 80% of the budget and every such request carries credit accounting. Requests AWF never steers (/decisions, token counting, /responses/compact) are ignored.
  • smoke-copilot-routed-steering.md now asks the agent for the amounts the warning states (for example 247 of 300 AI credits are used) instead of a threshold percentage. The lock file is recompiled.

Docs

  • Unified agent session spec 2.10.0: T-UAS-071 now covers steeringDelivery, little-left handling, and checking at-most-once delivery against steering only. Change-log entry added.
  • The audit and artifacts reference pages describe steering_deliveries and the new gateway_steering_events fields.

Copilot AI changed the title [WIP] Update handling for AWF's new per-conversation budget-notice records Read AWF per-conversation steering deliveries from the unified session Nov 12, 2026
Copilot AI requested a review from rabeckett November 12, 2026 06:40
@rabeckett
rabeckett requested a max review from Copilot November 12, 2026 06:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved validation defects, stale cache compatibility, and unsanitized audit output can admit invalid delivery data, omit new metadata, and expose users to terminal control-sequence injection.

3 open issues
What changed in this PR

Extends gh-aw’s unified-session pipeline to preserve AWF’s per-conversation budget-warning deliveries and expose them in audit and logs reports, addressing #77054.

Changes:

  • Preserve delivery metadata and represent little_left notices without a threshold.
  • Add delivery details to reporting while retaining legacy steering-notice behavior.
  • Update schemas, documentation, regression tests, and the smoke workflow prompt.
File Description
schemas/​logs.schema.json Adds steering deliveries to logs output contracts.
schemas/​logs-jsonl.schema.json Adds delivery and gateway-event metadata to JSONL contracts.
schemas/​audit.schema.json Extends audit output with steering metadata.
pkg/​cli/​token_usage_unified.go Collects deliveries from unified-session events.
pkg/​cli/​token_usage_types.go Defines delivery types and lenient decoding.
pkg/​cli/​token_usage_steering.go Populates delivery summaries and gateway metadata.
pkg/​cli/​token_usage_steering_delivery_test.go Tests decoding, reporting, compatibility, and rendering.
pkg/​cli/​token_usage_aic_files.go Includes deliveries when merging usage summaries.
pkg/​cli/​logs_report.go Adds deliveries to per-run logs reports.
pkg/​cli/​logs_models.go Extends gateway events with trigger and conversation.
pkg/​cli/​gateway_logs_timeline.go Labels little-left notices in timelines.
pkg/​cli/​audit_report.go Populates audit delivery records.
pkg/​cli/​audit_report_types.go Adds the audit delivery-list field.
pkg/​cli/​audit_report_render.go Renders deliveries and new gateway metadata.
docs/​src/​content/​docs/​specs/​unified-agent-session-specification.md Documents the expanded contract in version 2.10.0.
docs/​src/​content/​docs/​reference/​audit.md Describes delivery output and little-left notices.
docs/​src/​content/​docs/​reference/​artifacts.md Explains delivery records and session mappings.
docs/​public/​schemas/​unified-session.schema.json Publishes the expanded unified-session schema.
actions/​setup/​js/​unified_session.test.cjs Tests collection and validation of steering metadata.
actions/​setup/​js/​unified_session_render.cjs Displays additional steering-event fields.
actions/​setup/​js/​unified_session_payload.test.cjs Tests delivery projection and malformed-record handling.
actions/​setup/​js/​unified_session_payload.cjs Validates and projects delivery metadata.
actions/​setup/​js/​types/​unified_session.d.ts Defines the session delivery contract.
actions/​setup/​js/​smoke_model_routing_assertions.test.cjs Tests legacy notice checks with repeated deliveries.
actions/​setup/​js/​smoke_model_routing_assertions.cjs Clarifies legacy T2 behavior in comments only.
.github/​workflows/​smoke-copilot-routed-steering.md Requests warning amounts instead of percentages.
.github/​workflows/​smoke-copilot-routed-steering.lock.yml Refreshes generated hashes for the prompt change.

Review effort: Max

Comment thread pkg/cli/audit_report.go Resolved
Comment thread pkg/cli/audit_report_render.go Resolved
Comment thread pkg/cli/token_usage_types.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The session schema accepts trigger/threshold mismatches that decoders silently discard, while smoke-test assumptions can falsely fail valid little-left-first deliveries.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Smoke tests reject valid little-left-first delivery

actions/​setup/​js/​smoke_model_routing_assertions.test.cjs:1042

AWF can send little_left before 80% usage, but this fixture always supplies legacy threshold notices first. If the 7-credit smoke run stops on that earlier warning, T1 reports a missing ai_credit@80 notice and T2 reports no notices to check, even when the delivery is present in the session. Add a little-left-first case and accept its matching delivery evidence for T1; allow T2 to have no threshold notices in that case while keeping its duplicate checks on legacy steering records.

3 resolved since last review

Review effort: Max

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Smoke assertions can falsely accept incomplete or mismatched deliveries and missing 80% threshold warnings, while the session schema permits trigger/threshold combinations that downstream readers discard.

2 open issues

Review effort: Max

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task

Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering.

Structured data
{
  "completed_task": 43462393694,
  "head": "1aa1d2c074fd412e92ce6efdb1b9e01f7cc86335",
  "kind": "ci-follow-up",
  "schema_version": "1",
  "state": "eb2773176be5833022befe6a71f4f94b536afbc773131260a7644d7bf3e05607",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: [Completed task](https://github.com/github/gh-aw/actions/runs/43...

Fixed the impacted Go test by committing the regenerated workflow skill entry for responsible-ai.md (commit d2d9492). The focused test and impacted Go/JavaScript tests pass; the final gate is still blocked by existing custom-linter findings in unrelated Go lines.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task

Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering.

Structured data
{
  "completed_task": 43473820805,
  "head": "fa06b94a897d066862eed33bc83eb0c1a89c9de5",
  "kind": "ci-follow-up",
  "schema_version": "1",
  "state": "7e01e4c94364507d6c5ae31d6108860cee7641e60f1a5e085064f07ec1c96e76",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task

Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering.

Structured data
{
  "completed_task": 43483412368,
  "head": "fa06b94a897d066862eed33bc83eb0c1a89c9de5",
  "kind": "ci-follow-up",
  "schema_version": "1",
  "state": "7e01e4c94364507d6c5ae31d6108860cee7641e60f1a5e085064f07ec1c96e76",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: [Completed task](https://github.com/github/gh-aw/actions/runs/43...

Fixed the release-mode tests to use deterministic cached SHA pins in 581b69d2. Setup tests and impacted Go/JavaScript tests pass. The final gate still reports existing custom-linter findings outside this change; no CI run was triggered.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task

Please address the remaining CI failures on this PR's existing branch. No merging or CI triggering.

Structured data
{
  "completed_task": 43487023824,
  "head": "581b69d26b3cabf07b37768d6b3c164c7cbd6bac",
  "kind": "ci-follow-up",
  "schema_version": "1",
  "state": "177cf86c2144ae462a6ab465877a4ea1f040ca918736f583d688039b65733ead",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

@rabeckett

Copy link
Copy Markdown
Collaborator

@copilot /pr-finisher

Please do one final, scoped merge-readiness pass. My approval is now recorded on 581b69d2, and all 12 review threads are resolved. Preserve the steering/unified-session scope; do not merge or trigger CI.

The sole failing CI test on that head is TestIntentGuidanceContract, which expects wording removed by #77481 on main: https://github.com/github/gh-aw/actions/runs/43488902438/job/132104819927. Do not bundle unrelated main fixes or repeatedly merge main to chase them. If unrelated failures block the final gate, identify them and stop.

Please report the exact validated head SHA, validation results, any remaining in-scope blockers, and whether a maintainer needs to rerun CI. I have stopped the duplicate automatic attempt and removed the assignment to prevent further Sous Chef follow-ups while this is handed off for maintainer merge.

Copilot AI commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot /pr-finisher

Please do one final, scoped merge-readiness pass. My approval is now recorded on 581b69d2, and all 12 review threads are resolved. Preserve the steering/unified-session scope;...

Final scoped pass on 581b69d26b3cabf07b37768d6b3c164c7cbd6bac; head unchanged.

  • ✅ Approval is recorded on that SHA; all 12 review threads are resolved.
  • ✅ Working tree is clean; git diff --check passes. Recorded CI schema-currentness tests pass.
  • ❌ Sole failed CI check: impacted-go-tests. Logs confirm TestIntentGuidanceContract requires “When the request already states a goal,” removed by Pack instruction contracts into the first 8,000 UTF-8 bytes #77481. The test and source document are unchanged relative to this PR’s base.
  • PR is open, non-draft; reported merge state is unstable.

No remaining in-scope blocker found. Stopped at the unrelated failure as requested; no edits, merges, pushes, or CI triggers, and no full local gate rerun. Maintainer action is needed to resolve/dispose of the unrelated check and obtain green CI before merge; rerunning the unchanged head alone will not fix this deterministic mismatch.

Copilot AI requested a review from rabeckett November 13, 2026 19:56
@rabeckett
rabeckett removed their request for review November 13, 2026 19:57
@rabeckett

Copy link
Copy Markdown
Collaborator

@pelikhan I've approved the current head, 581b69d26b3cabf07b37768d6b3c164c7cbd6bac, and the final scoped PR-finisher pass is complete. It made no edits or pushes. All 12 review threads are resolved, and the PR has no merge conflicts.

The only failing check is impacted-go-tests: TestIntentGuidanceContract expects wording removed by #77481. I independently checked current main (474b83b35119e716a2dac92b9e07c147fd69285c): the same test/source mismatch is present there. Rerunning the unchanged head alone will not fix it. The finisher stopped at that unrelated failure and did not rerun the full local gate.

I've removed Copilot's assignment and cancelled the duplicate automatic attempt to stop further Sous Chef churn and unrelated fixes landing here. Please take the final maintainer review and merge once satisfied with the handling of the inherited CI failure; any fix for that failure should stay separate from this steering/unified-session PR.

@pelikhan
pelikhan merged commit ea32108 into main Nov 13, 2026
69 of 71 checks passed
@pelikhan
pelikhan deleted the copilot/read-awf-budget-notice-records branch November 13, 2026 20:06
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read AWF's new per-conversation budget-notice records

6 participants