Repository navigation
Report native Copilot session credit completeness - #79295
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 Changes recommended
Canonical Copilot sessions reconstructed without engine metadata can skip accounting normalization, causing valid snapshots to lose completeness status and unavailable accounting to retain an unqualified zero total.
1 open issue
What changed in this PR
This PR adds completeness and scope information to native Copilot credit accounting in unified sessions, supporting trustworthy cost observation without claiming whole-job cost or model-outcome verification.
Changes:
- Reports complete totals, partial subtotals, and unavailable accounting, preserving valid zero totals.
- Adds accounting status and scope to types, schema, and rendering.
- Documents accounting limits and adds seven focused cases without substituting token-price estimates or changing
primaryAic.
| File | Description |
|---|---|
docs/src/content/docs/specs/unified-agent-session-specification.md |
Defines accounting statuses, scope, and limitations. |
docs/public/schemas/unified-session.schema.json |
Adds credit status and scope fields. |
actions/setup/js/unified_session.test.cjs |
Covers seven terminal-accounting cases. |
actions/setup/js/unified_session.cjs |
Passes Copilot source identity into normalization. |
actions/setup/js/unified_session_render.cjs |
Displays credit status and scope. |
actions/setup/js/unified_session_payload.cjs |
Validates terminal accounting and suppresses unavailable amounts. |
actions/setup/js/types/unified_session.d.ts |
Types the new accounting fields. |
Review effort: Balanced
Keep the session as the documented unit of accounting. Preserve explicit status on reread and recognize canonical Copilot sessions during reconstruction without workflow metadata. Co-authored-by: Copilot <[email protected]>
|
✅ Ponytail Reviewer completed successfully! Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🔎 PR Code Quality Reviewer is reviewing code quality for this pull request... |
|
🚀 PR Specification Reviewer has started processing this pull request |
|
✅ Test Quality Sentinel completed test quality analysis. Warning Threat detection engine error Threat detection could not complete its analysis due to a tooling error. This is not a security finding. What happenedThe threat detection engine failed to produce results. Review the workflow run logs to troubleshoot the error. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills... |
|
Ready-state CI on CI is not green. The specification reviewer, code-quality reviewer, and skills reviewer exhausted their retries because the Copilot SDK could not create its session-state directory ( |
Co-authored-by: Copilot <[email protected]>
|
❌ PR Specification Reviewer failed to deliver outputs. Please review the logs for details. Commit pushed:
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ Matt Pocock Skills ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found one correctness issue: the new Copilot accounting trust path applies to all agent-component sources, including non-native fallback logs. That can incorrectly publish a complete terminal credit snapshot. Please restrict this to native accounting sources and cover the fallback case.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K
Comment /review to run again
Comment MemoryPeek at saved memory (review-history)History |
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /tdd, /grill-with-docs, and /codebase-design. Requesting changes on one correctness gap and one spec/render mismatch.
📋 Key Themes & Highlights
Key Themes
- Non-idempotent reprojection: an already-normalized verified total is downgraded to
unavailablewhencopilotSourceistrue. The new test matrix only covers rawaccountingSnapshotinput. - Legacy totals vs. spec: the spec says legacy artifacts "do not verify a bill", but the renderer shows a bare legacy
totalNanoAiuwith no status. - Generated artifacts:
types/unified_session.d.tsand the JSON schema were hand-edited.make check-session-schemasshould confirm they match the generator. I could not run it here.
Positive Highlights
- ✅ The status matrix (complete, partial, unavailable, contradictory total) is well covered and reads as a spec.
- ✅ The
isTokenCountguard and the explicit-zero handling are correct. - ✅ The new spec text clearly separates the terminal snapshot from child-agent and routing costs.
Not verified
- Baseline comparison against
mainand the test run were not possible offline.npm cifails on the package proxy certificate. - The null/missing-
datashutdown throw also happens on the pre-PR code, so I did not count it as a regression.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
Co-authored-by: Copilot <[email protected]>
|
All review threads are resolved on The remaining CJS shard failure is independent of this patch. I ran the exact failing test on a clean checkout of Maintainer handoff: GitHub reports no merge conflict and no required status checks. The outstanding merge blocker is the |

Refs #79103
The unified session already had a native credit number, but not whether every observed call reported a charge. This adds just
aiCreditsStatusto Copilot shutdown records. A completetotalNanoAiucovers the session, including delegated work, and can be zero. A partial amount is a subtotal. Unavailable or contradictory accounting has no amount. Rereading a numeric total from an older artifact does not make it complete. No token-price estimate is substituted, andprimaryAicand routing behavior are unchanged.This is session cost, not a whole-job bill or proof of the routed model, reasoning effort, or task outcome.
Evidence. Replaying the retained delegated run through the writer and reader produced
totalNanoAiu: 9165572500,aiCreditsStatus: complete, with no scope field. The five main calls used 6.1465600 credits and three children used 3.0190125, each counted once. No new workflow was dispatched.Validation on
88466cdab7ae64f2e8f1f60e5f054163f9b837df: All 13 focused accounting tests, typecheck, generated schemas, the retained writer/reader/render replay, and the full LF Linux pre-PR gate passed (jq 1.6; 344 impacted JS tests). Fallback logs do not establish native credit accounting, even if they contain a matching-looking shutdown. Includes the versioned specification and upstream reviewer runtime fix (#79277).