Skip to content

Report native Copilot session credit completeness - #79295

Merged
rabeckett merged 6 commits into
mainfrom
aw1-copilot-session-credits
Nov 19, 2026
Merged

rabeckett merged 6 commits into
mainfrom
aw1-copilot-session-credits

Conversation

@rabeckett

@rabeckett rabeckett commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #79103

The unified session already had a native credit number, but not whether every observed call reported a charge. This adds just aiCreditsStatus to Copilot shutdown records. A complete totalNanoAiu covers 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, and primaryAic and 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).

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

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

Comment thread actions/setup/js/unified_session.cjs Resolved
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]>
@rabeckett rabeckett changed the title Report native Copilot session credit completeness and scope Report native Copilot session credit completeness Nov 19, 2026
@rabeckett
rabeckett marked this pull request as ready for review November 19, 2026 16:16
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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 happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #79295 · codex · routed: gpt61 medium · ~4 AIC · ⊞ 185 · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Specification Reviewer has started processing this pull request

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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 happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@rabeckett

Copy link
Copy Markdown
Collaborator Author

Ready-state CI on 6330d58af8: all 18 CJS checks passed, and there are no unresolved review threads. The retained delegated run still reports 9.1655725 Copilot session credits. Locally the focused tests, typecheck, and generated-schema checks passed; the Linux pre-PR gate could not finish without the ARM64 TypeScript package.

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 (EACCES). The same failure occurred on the independently merged #79283. I have not requested maintainer review or rerun those jobs. Once the reviewer runtime is fixed, only these three workflows need to be retried.

@rabeckett
rabeckett marked this pull request as draft November 19, 2026 16:46
@rabeckett
rabeckett marked this pull request as ready for review November 19, 2026 16:53
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer failed to deliver outputs. Please review the logs for details.

Commit pushed: 74d1eaa

Generated by PR Specification Reviewer for #79295 · copilot · gpt56 · ~7 AIC · ⌖ ~2 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

Matt Pocock Skills Reviewer

Outcome: reported_action

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.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #79295 · codex · routed: gpt61 medium · ~5 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-19T16:56:28Z
review_event: REQUEST_CHANGES
top_themes: [native accounting trust scope]
files_reviewed: [actions/setup/js/unified_session.cjs, actions/setup/js/unified_session_payload.cjs, actions/setup/js/unified_session.test.cjs, actions/setup/js/types/unified_session.d.ts, actions/setup/js/unified_session_render.cjs, docs/public/schemas/unified-session.schema.json, docs/src/content/docs/specs/unified-agent-session-specification.md]
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~4 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

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 thread actions/setup/js/unified_session.cjs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-4d58b200-172a-480e-8e57-72c0aaad357e","parents":[],"payload":{"id":"ldg-9f43bb74-d4d6-49e2-b443-6fe6111a457e","operation":"append","value":{"finding_count":1,"head_sha":"8b2e7fb9b2d257fdd7dad1b59ada3f57554f22ff","outcome":"findings"}},"sha":"sha256:8f199843644802fcfa6e6f6092706a9007fb5d6eae107c281c9fdfa2804eb225","timestamp":"2026-11-19T17:01:10.583Z","type":"ledger_append","version":1}
History

@github-actions github-actions Bot 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.

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 unavailable when copilotSource is true. The new test matrix only covers raw accountingSnapshot input.
  • Legacy totals vs. spec: the spec says legacy artifacts "do not verify a bill", but the renderer shows a bare legacy totalNanoAiu with no status.
  • Generated artifacts: types/unified_session.d.ts and the JSON schema were hand-edited. make check-session-schemas should 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 isTokenCount guard 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 main and the test run were not possible offline. npm ci fails on the package proxy certificate.
  • The null/missing-data shutdown 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

@rabeckett

rabeckett commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

All review threads are resolved on 88466cdab7ae64f2e8f1f60e5f054163f9b837df. The full local LF Linux gate passed (344 impacted tests), as did the schema check, typecheck, and retained-session replay: 9.1655725 complete Copilot session credits. Fallback logs do not establish a bill. The upstream SDK directory fix is in this head.

The remaining CJS shard failure is independent of this patch. I ran the exact failing test on a clean checkout of main at 3b157b1ba5: the conformance dispatcher lists 16 workers after #79280 added LangGraph, while its portfolio has 15. The dispatcher, portfolio and test are unchanged on main through faa32b1c4c. The other six cancelled shards were stopped by the matrix after that assertion failed.

Maintainer handoff: GitHub reports no merge conflict and no required status checks. The outstanding merge blocker is the CHANGES_REQUESTED decision on the older 8b2e7fb9b2 head. The code-quality finding was fixed, and the skills-review feedback was answered and verified. Independent review has been requested from dsyme on 88466cdab7. Please assess the addressed findings and the separately documented main-branch CI failure before deciding whether to merge. Updating this branch to the current main would not change either.

@rabeckett
rabeckett requested review from dsyme and removed request for dsyme November 19, 2026 17:21
@rabeckett
rabeckett dismissed stale reviews from github-actions[bot] and github-actions[bot] November 19, 2026 17:27

All PR review threads are resolved. The fallback-log finding was fixed in 427ae11 (native shutdown provenance required, with regression tests); verified on head 88466cd by the full LF Linux pre-PR gate.

@rabeckett
rabeckett merged commit e0086c9 into main Nov 19, 2026
48 of 55 checks passed
@rabeckett
rabeckett deleted the aw1-copilot-session-credits branch November 19, 2026 17:28
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.

2 participants