Repo Context Audit: add governed model running summaries#1803
Repo Context Audit: add governed model running summaries#1803Niko4417 wants to merge 13 commits into
Conversation
Audit review — PR #1803 (Resolves #1765)Verdict: Approve with minor non-blocking nits. All four acceptance criteria are met with regression coverage, security posture is preserved, and CI ( Acceptance criteria — verified
Strengths
Non-blocking findings
None of the above block merge. The PR implements only the linked issue scope and preserves deterministic-fallback semantics. |
…ld synthesis (#1765) Address two confirmed review findings on PR #1803: - validationState "accepted" was effectively unreachable: normalizeSummaryText derived `changed` from cosmetic normalization (NFKC, CRLF, whitespace collapse, trim), so nearly every summary persisted as "redacted". `changed` now reflects only safety-relevant transforms (secret/absolute-path redaction fired, unsafe format chars stripped, or content clamped to the max-chars bound). Cosmetic normalization alone no longer marks a summary as redacted. - Blank model content discarded valid structured fields: sanitizeSummaryContent returned undefined when content normalized to empty, causing parseStructuredSummary to reject the whole summary and leaving synthesizeSummaryContent(fields) as dead code. It now returns an empty value for unusable-but-string content so content is synthesized from the already-sanitized structured fields (each item independently redacted), preserving decisions/constraints/files/debugging/open-threads. Adds two regression tests. Incidental hunks are the project format-on-save hook normalizing pre-existing non-prettier-clean lines; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review findings addressed —
|
…1907) * feat(context): add governed model running summaries Refs #1765 * feat(context): add calibrated token accounting * fix(context): tighten model-summary validationState and reachable field synthesis (#1765) Address two confirmed review findings on PR #1803: - validationState "accepted" was effectively unreachable: normalizeSummaryText derived `changed` from cosmetic normalization (NFKC, CRLF, whitespace collapse, trim), so nearly every summary persisted as "redacted". `changed` now reflects only safety-relevant transforms (secret/absolute-path redaction fired, unsafe format chars stripped, or content clamped to the max-chars bound). Cosmetic normalization alone no longer marks a summary as redacted. - Blank model content discarded valid structured fields: sanitizeSummaryContent returned undefined when content normalized to empty, causing parseStructuredSummary to reject the whole summary and leaving synthesizeSummaryContent(fields) as dead code. It now returns an empty value for unusable-but-string content so content is synthesized from the already-sanitized structured fields (each item independently redacted), preserving decisions/constraints/files/debugging/open-threads. Adds two regression tests. Incidental hunks are the project format-on-save hook normalizing pre-existing non-prettier-clean lines; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(context): address PR #1802 audit findings for calibrated token accounting (#1766) - Split chat-prompt-budget-diagnostics.ts under the 400-LOC cap by extracting the token-summary helpers into chat-prompt-budget-token-summary.ts. - Document the deliberate lane attribution: the compaction summary's tokens are charged to the history-summary lane (which owns the +1 summary item), while system-contract reports only the bare canonical system prompt. - Pin the compacted-path lane split with a mutation-robust test. - Reject stray scaleMilli/offsetTokens under source "fallback-estimated". - Document the defensive clamp in calibratedTokenCount; add redactTokenAccounting and validator-rejection test coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(qi): stabilize verification cache regression Refs #1766 * fix(context): harden model summaries after dev merge Refs #1765 * fix(evidence): prime QI verification cache after writes Refs #1765 * test(evidence): stabilize performance gate timing Refs #1765 * fix(gateway): redact token counter ids from browser projections Refs #1766 * fix(security): make role marker scanning linear * test(evidence): cover QI verification cache edge cases * test(evidence): stabilize lock reclaim regressions Refs #1766 * fix(security): guard pseudo-role scanner bounds * test: cap root vitest workers for stable receipts Refs #1766 * test(ci): stabilize full-suite timeout-sensitive checks * test(evidence): stabilize QI retention count gate * test: tighten root vitest worker cap Refs #1766 * fix: harden governed updater UX * test: stabilize QI verification cache budget * test(package): update safe capability surface contract (#1766) * test: relax dev runner readiness timeout * test: harden evidence prefix cleanup * test(package): keep safe capability surface sorted (#1766) * test: relax release-impact notes timeout * test: format evidence prefix cleanup * test: cover updater review follow-ups * test: satisfy updater playwright lint --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Oliver Scharkowski <59687448+oscharko@users.noreply.github.com>
Summary
Adds a governed Model Gateway-backed structured running-summary path for compacted chat history so long sessions preserve ordinary decisions, constraints, files/symbols, debugging context, and open threads without ungoverned model calls or user-role injection.
Resolves #1765
Scope
Reuse And No-Duplication
Delivery Board
Keiko Product Deliveryproject.Parent Epic: #1720unless this PR updates an epic container directly.Classification: Epic,Status: Open Epics, and priority/order set for top-to-bottom implementation sequencing.Classification: Task,Status: In Progresswhile active, inherited or explicitPriority, andHuman Review Required: Yes.StatusisIn Progresswhile work is active, orDoneonly after merge and closure evidence.Workflow StateisPR OpenorReady for Human Review.Owner / Agent,Branch,Pull Request, andHuman Review Requiredare filled.status: in progress,status: ready for human review, orstatus: doneafter merge.dev, enable auto-merge, close the issue, or bypass human review unless explicitly authorized by the human maintainer.Product Impact
Update Impact
improvements.high.dev.npm run check:release-impactpassed locally.Verification
Required:
Local verification:
Reuse / gap rationale:
Select only what applies:
npm run check:release-impactor an explicit rationale.Not applicable rationale:
Review And Closure
Resolves #<issue_number>only when this PR should close the issue.Risk Notes
The generated summary is model-authored and therefore treated as untrusted input: it is schema-validated, bounded, redacted, persisted with validation/failure state, and resurfaced only through system-scoped compaction context. Legacy summary manifests remain accepted for compatibility when they have content and no structured metadata. The PR intentionally does not merge to
dev, close the issue manually, or bypass human review.