Repository navigation
fix(hooks): preserve usage records at transcript tail boundaries - #3657
Conversation
ECC Tools / Security EvidenceCommit: Security scanner evidence required (action_required) Detected 1 security-sensitive predictive risk signal(s) without scanner evidence. Mode: enforce Findings:
Touched security-sensitive paths:
Expected evidence:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): Security Evidence, CI/CD Recommendation. Scanned 6 changed file(s). Roadmap taxonomy buckets: Security EvidenceSecurity-sensitive changes should carry explicit scanner, code-scanning, or focused regression evidence. Signals:
Paths:
CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 0/7 areas (0%) across 6 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 6 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
[Medium impact] No blocking or non-blocking findings remain; the validated reader and hook behavior supports merging this change.
|
|
Thank you for retaining a complete usage record at a transcript-tail boundary. This is now merged through #3806, with your contributor head preserved. I also isolated transcript fixtures in private temporary storage after code scanning caught a shared-path risk. The combined integration and exact resulting main passed CI, CodeQL and a fresh supply-chain scan (CI, main |
What Changed
Preserve complete usage records at the beginning of the requested transcript tail.
readLatestContextTokens()reads one preceding byte to distinguish a newline boundary from a partial record. The optional rawbyteLengthresult fromreadFileTail()keeps that decision correct when a transcript ends with unfinished UTF-8; existing callers retain the same default result shape.Add six reader regressions, two raw-byte reader checks, and a real
suggest-compacthook regression. Include an Unreleased changelog entry.Why This Change
Previously, any truncated tail unconditionally discarded its first line. If a complete assistant usage record begins exactly at the default 256 KiB boundary and later records contain only tool results, context detection returns
nulland the strategic-compact reminder never fires—even at 170,000 tokens.The boundary-aligned regressions fail before the change. With this fix the same transcript emits
hookSpecificOutput.additionalContextcontainingContext ~170k tokens. Partial and out-of-window records remain excluded.Testing Done
CHANGELOG.mdandgit diff --checkpassed.npm testis green: the final-tree parallel run reported 8,854 passed / 2 failed across 428 files. The two failing installation suites both passed on isolated reruns:repo-scan-install38/38 andsetup30/30; the parallel setup failure was a subprocessETIMEDOUT. An earlier run while the source was still changing reported 8,887 passed / 2 failed (install-executorandinstall-apply), which also passed individually, 26/26 and 48/48. All validators passed. A clean full-suite run is not claimed; hosted CI remains the full integration check.Type of Change
fix:Bug fixSecurity & Quality Checklist
Documentation
CHANGELOG.mdand comments explaining the byte-boundary handling.