You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Read AWF per-conversation steering deliveries from the unified session - #77088
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:
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 nullfirst 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_creditlittle_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.
CopilotAI
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
@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.
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
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.
AWF releases after v0.29.11 send each budget notice to every conversation in a run, once. They also add a
little_leftnotice, which has anullthreshold. Each delivery is recorded in a newsteering_deliveryfield intoken-usage.jsonl, and the*_steeringevents gaintriggerandconversation. gh-aw droppedsteering_delivery, and its decoder turned anullthreshold into 0, so audits could not show which conversations received a notice.Session file (
usage/aw_session.jsonl)firewall.token_usageandusage.reportcarrysteering_deliveryassteeringDelivery, keeping onlytype,trigger,threshold,conversationandfirst. A record that doesn't match AWF's contract is dropped. The contract:thresholdis 80, 90, 95 or 99 whentriggeristhreshold, andnullexactly when it islittle_left.conversationis 12 lowercase hex characters, ornull.firstis a boolean.firewall.steeringkeepstrigger,conversation, and anullthreshold.unified_session.d.tsgains aSteeringDeliverytype. The schema is regenerated from it, and the renderer prints the new fields.gh aw audit/gh aw logs --jsonsteering_deliverieslist, 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 onfirewall_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_noticesis unchanged and still has at most one entry per threshold per run.gateway_steering_eventsentries gaintriggerandconversation. The console and timeline show "little left" (for examplecredit little left) instead of a percentage.TokenUsageSteeringDeliverydecodes leniently: a malformed delivery never rejects its token-usage record. Records withoutsteering_delivery(AWF v0.29.11 and older) still decode.gateway_steering_eventsstill prefers the raw api-proxy event log and falls back to the session file, as before. Only the newsteering_deliverieslist is sourced exclusively from the session file.nullfirstis dropped rather than read asfalse.auditSchemaVersion14) and logs JSONL cache (cachedLogsJSONLSchemaVersion6) are bumped, so cached results from before this change are rebuilt with the new fields.sanitizeControlChars.Smoke test
ai_creditlittle_leftdelivery on a 2xx response before 80%, which AWF can send on the 7-credit smoke budget. The sessionsteeringDeliverymust match thetoken-usage.jsonlrecord on all five fields.steeringrecords. A new test covers repeatedsteering_deliveryrecords across conversations. T2 allows zero threshold notices only after such alittle_leftdelivery, 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.mdnow asks the agent for the amounts the warning states (for example247 of 300 AI credits are used) instead of a threshold percentage. The lock file is recompiled.Docs
steeringDelivery, little-left handling, and checking at-most-once delivery againststeeringonly. Change-log entry added.steering_deliveriesand the newgateway_steering_eventsfields.