Skip to content

Normalize Claude session diagnostics and snapshot evidence - #67351

Merged
pelikhan merged 2 commits into
mainfrom
pelikhan-claude-session-audit
Oct 10, 2026
Merged

pelikhan merged 2 commits into
mainfrom
pelikhan-claude-session-audit

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Why

Live Claude transcripts contain duplicate provider-error envelopes and permission-denial notices presented as assistant answers. This aligns those observations with the unified agent session contract while preserving native evidence and partial traces.

Changes

  • Map provider errors, retries, authentication failures, and permission denials to canonical session diagnostics. Reconcile terminal denial snapshots by observed identity without inventing tool completions or discarding distinct notices.
  • Retain mapped streaming envelopes and finalized snapshots on canonical events instead of emitting duplicate claude.* records. Preserve refusal policy metadata, observed partials, reasoning signatures, and recovered snapshot suffixes.
  • Preserve structured images, documents, and redacted reasoning. Explicit tool failure and interruption signals take precedence over contradictory success fields. Unknown native extensions and genuinely unmapped controls remain available.

Includes sanitized regression coverage and Claude-specific documentation. Shared implementation, types, projection, and specification files are unchanged; shared test edits only update Claude-specific expectations.

Evidence and limitations

Inspected existing success, API failure, documentation/subagent, and dynamic-workflow artifacts. The documentation run persisted 15 denial notices as assistant answers in both canonical and unified traces; the corrected replay retains 15 canonical denials once. The failure replay preserves all 22 error observations without duplicate native envelopes.

The newer two runs contain agent-session.jsonl and aw_session.jsonl; older runs only support native-log replay. Streaming and structured-content regressions use synthetic SDK/API shapes, not live coverage claims. No workflow runs were triggered.

Validation

  • make fmt-cjs && make lint-cjs
  • PATH=/opt/homebrew/bin:$PATH make agent-report-progress: build, lint, schema freshness, and 237 impacted JavaScript tests passed; no Go changes.
  • Expanded Claude and dependent shared suites: 672 tests passed across 18 matched suites.
  • npm run typecheck and npm run schema:session:check from actions/setup/js.
  • Four complete downloaded transcripts passed schema validation, JSON round-trip/idempotence checks, and exact native text, reasoning, and tool-output comparisons against canonical and projected events.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 10, 2026 05:34
Copilot AI balanced review requested due to automatic review settings October 10, 2026 05:34
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed for PR #67351: the PR does not carry the 'implementation' label and has 0 new lines in default business logic directories (threshold: 100, no custom .design-gate.yml present).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Generated by Ponytail Reviewer for #67351

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

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

Stream normalization still duplicates recognized blocks and leaves several mapped transport envelopes as separate native events.

1 open finding
What changed in this PR

Normalizes Claude diagnostics and streamed evidence into the unified session model while preserving native metadata.

Changes:

  • Canonicalizes errors, permission denials, refusals, and structured content.
  • Reconciles streamed events with finalized snapshots.
  • Adds regression coverage and Claude documentation.
File Description
.changeset/​patch-claude-session-audit.md Records the patch release changes.
actions/​setup/​js/​agent_session_render.test.cjs Updates stream projection expectations.
actions/​setup/​js/​claude_session.cjs Implements Claude session normalization.
actions/​setup/​js/​claude_session.test.cjs Updates streaming snapshot coverage.
actions/​setup/​js/​claude_session_audit.test.cjs Adds diagnostic and evidence regressions.
actions/​setup/​js/​claude_session_normalization.test.cjs Updates denial normalization coverage.
actions/​setup/​js/​provider_refusal.test.cjs Tests attached refusal snapshots.
actions/​setup/​js/​unified_session.test.cjs Tests canonical provider errors.
docs/​src/​content/​docs/​engines/​claude.md Documents Claude session mapping.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/claude_session.cjs
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-10-10T05:36:54Z
review_event: REQUEST_CHANGES
top_themes:
  - finalized snapshot evidence loss
  - late refusal snapshot loss
  - camelCase tool success misclassification
files_reviewed:
  - actions/setup/js/claude_session.cjs
  - actions/setup/js/unified_session.cjs
  - actions/setup/js/agent_session.cjs
  - actions/setup/js/provider_refusal.cjs
comment_count: 3

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 · gpt54 · 49.3 AIC · ⌖ 7.87 AIC · ⊞ 19.9K · ◷
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.

Request changes

These changes still regress Claude trace fidelity in three places: successful camelCase tool results can become "unknown", and the only finalized SDK snapshot can be lost for both streamed blocks and late refusals.

Blocking themes
  • isError: false is not normalized symmetrically with the new failure aliases, so some successful tool results no longer project as explicit successes.
  • First finalized SDK snapshots are not always retained on the canonical event once duplicate claude.assistant_snapshot records are removed.
  • Late refusal reclassification drops the originating finalized snapshot, which defeats the evidence-preservation goal of this change.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt54 · 49.3 AIC · ⌖ 7.87 AIC · ⊞ 19.9K
Comment /review to run again

Comment thread actions/setup/js/claude_session.cjs Outdated
Comment thread actions/setup/js/claude_session.cjs
Comment thread actions/setup/js/claude_session.cjs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan merged commit caa19db into main Oct 10, 2026
43 checks passed
@pelikhan
pelikhan deleted the pelikhan-claude-session-audit branch October 10, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants