Repository navigation
fix(ci): reject line-cap growth on pull requests - #149622
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 16, 2026, 7:08 AM ET / 11:08 UTC (Revision 9). ClawSweeper reviewWhat this changesAdds an Oxlint-backed check that rejects new file-length violations and growing over-cap files in PR CI and local changed-file checks. Merge readiness⛔ Blocked before merge - 4 items remain The growth check remains useful beyond main’s warning policy, but the previously reported extension-coverage defect remains unfixed. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s development checks compare changed source files against their Git baseline using the repository’s lint limits. The result determines whether PR CI and local checks accept the change. flowchart TD
A[PR or local changes] --> B[Select changed source files]
C[Git baseline and renames] --> D[Oxlint line counts]
B --> D
E[Canonical lint limits] --> D
D --> F{New violation or growing debt?}
F -->|Yes| G[Fail check]
F -->|No| H[Pass check]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceTests +159, Docs +40, Config +4, Other +221. Total +424 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep canonical warning behavior and make the growth checker and its local scheduler cover every governed source extension. Do we have a high-confidence way to reproduce the issue? Yes, from source: a new src/example.js with 701 counted lines is excluded before measurement, and a JavaScript-only change also skips local scheduling. This review did not execute the scenario. Is this the best way to solve the issue? Yes, the Git-baseline comparison using canonical Oxlint counts is a focused solution once both selectors cover all governed extensions; the suppression inventory serves a separate purpose. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bc610aed20f2. LabelsLabel justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
b2f208d to
c9a1792
Compare
Independently green PRs can combine to exceed max-lines and block main. Use explicit hosted warnings and an oxlint-backed changed-file growth check. Keep canonical caps, suppression inventory, and strict local/landing lint.
Count native colored diagnostics and load cumulative config only when warning mode is requested. Restore strict-runner fixture isolation and accurate hosted warning totals.
Main now warns for all max-lines scopes, making hosted-only demotion redundant. Keep the PR growth ratchet and document the shared warning policy and shrink-only maintenance.
8d1bb8c to
81d2697
Compare
|
Merged via squash.
|
* fix(ci): ratchet line caps without blocking main Independently green PRs can combine to exceed max-lines and block main. Use explicit hosted warnings and an oxlint-backed changed-file growth check. Keep canonical caps, suppression inventory, and strict local/landing lint. * fix(ci): preserve warning counts and isolated lint runners Count native colored diagnostics and load cumulative config only when warning mode is requested. Restore strict-runner fixture isolation and accurate hosted warning totals. * fix(ci): align line-cap ratchet with global warnings Main now warns for all max-lines scopes, making hosted-only demotion redundant. Keep the PR growth ratchet and document the shared warning policy and shrink-only maintenance.
c1f00ed (openclaw#149622) rejects growth in a changed file past its line cap. The two e2e cases this branch adds took model-fallback.run-embedded.e2e.test.ts from 969 to 1017 counted lines against a 1000 cap. The error-message fixtures, EmbeddedAttemptParams and makeFallbackSuccessAttempt are mock-free, so they move verbatim into the existing model-fallback.run-embedded.e2e.test-support.ts, leaving the test at 999. No test case or assertion changes.
The line-cap ratchet (openclaw#149622) rejects growth in files already past the max-lines cap. Move the Telnyx pin test into a vendor-pins sibling module, and drop the CLI install and onboarding additions that re-proved what the wecom pass-through and plugin-install-plan tests already cover. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…cap ratchet c1f00ed (openclaw#149622, 2026-09-16) rejects growth in any changed file that is already over its line cap. Rebased onto cecf47a, this branch grew four: compaction.ts 900 -> 902 (cap 700) compaction-safeguard.ts 1315 -> 1343 (cap 700) compaction-safeguard.test.ts 4622 -> 4651 (cap 1000) compact.hooks.test.ts 6650 -> 6662 (cap 1000) Each goes back under its base count by moving one self-contained unit out verbatim: - compaction-details.ts: the CompactionDetails type, its parser, and the bounded latest-user-request extractor that fills it. compaction.ts re-exports the type, so the agent-core index is unchanged. - compaction-safeguard-tool-failures.ts: collecting failed tool results and rendering the Tool Failures section. Its 8 tests move with it and import it directly, so the two __testing entries go. The two type assertions that moved get SAFETY comments (a new file's baseline is 0), and the old file's assertion baseline drops 14 -> 12. - compact.hooks.codex-plans.test-support.ts: the pure prepared Codex plan fixture. No test case or assertion changes. Measured on the M4 (node 26.8.1) against cecf47a: counted lines after 858 / 1264 / 4465 / 6631 line-cap, max-lines, assertion-safety ratchets exit 0 oxfmt --check, 15 changed files exit 0 oxlint, 12 changed .ts files 0 warnings, 0 errors tsgo:core and changed-path test types exit 0 12 test files 497 passed the shard holding compaction-safeguard.test.ts went 175 -> 167 tests, and the new tool-failures file runs the other 8
* feat: register Telnyx as an official external provider * docs(telnyx): acknowledge non-interactive setup risk * fix(telnyx): pin the SDK-compatible 0.2.0 provider artifact @telnyx/[email protected] is built against the batched provider-catalog SDK and loads on 2026.8.1+ hosts; 0.1.0 failed with sdk-incompatible. Pin the npm artifact with its registry integrity, raise minHostVersion to >=2026.8.1, drop the ClawHub pin until 0.2.0 is published there, and remove the docs warning. * fix(telnyx): restore the ClawHub install source for 0.2.0 @telnyx/[email protected] is now published on ClawHub under the telnyx publisher with the same npm integrity and source commit, so the catalog can offer both sources again. npm stays the default choice. * test(telnyx): keep over-cap suites at their baseline line count The line-cap ratchet (#149622) rejects growth in files already past the max-lines cap. Move the Telnyx pin test into a vendor-pins sibling module, and drop the CLI install and onboarding additions that re-proved what the wecom pass-through and plugin-install-plan tests already cover. --------- Co-authored-by: jalehman <[email protected]>
* feat: register Telnyx as an official external provider * docs(telnyx): acknowledge non-interactive setup risk * fix(telnyx): pin the SDK-compatible 0.2.0 provider artifact @telnyx/[email protected] is built against the batched provider-catalog SDK and loads on 2026.8.1+ hosts; 0.1.0 failed with sdk-incompatible. Pin the npm artifact with its registry integrity, raise minHostVersion to >=2026.8.1, drop the ClawHub pin until 0.2.0 is published there, and remove the docs warning. * fix(telnyx): restore the ClawHub install source for 0.2.0 @telnyx/[email protected] is now published on ClawHub under the telnyx publisher with the same npm integrity and source commit, so the catalog can offer both sources again. npm stays the default choice. * test(telnyx): keep over-cap suites at their baseline line count The line-cap ratchet (openclaw#149622) rejects growth in files already past the max-lines cap. Move the Telnyx pin test into a vendor-pins sibling module, and drop the CLI install and onboarding additions that re-proved what the wecom pass-through and plugin-install-plan tests already cover. --------- Co-authored-by: jalehman <[email protected]>
…ermanently uncompactable (#130393) * fix(compaction): stop a failed summary audit from leaving a session uncompactable Once a session reaches this state it cannot leave it. Compaction runs, produces a summary, fails its quality audit, and cancels. Nothing shrinks, so the next turn is larger than the last and fails the same way, and every later turn ends in "Context is too large and auto-compaction could not recover this turn". The only escape is /new, which discards the conversation. Cancelling is right for a summary that is merely bad: it preserves history rather than storing something worse. It is wrong when the audit cannot be satisfied at all, because the session can then never shrink and the user loses the whole conversation instead of some fidelity. Both terminal quality paths - an exhausted audit and required facts that cannot fit the finalized budget - now emit the structured previous summary plus the preserved recent turns and the generated split-turn prefix through one degradeToFallbackSummary closure, and let compaction complete. Genuinely unrecoverable paths still cancel: a failed built-in generation, an unresolvable summarization model, and missing credentials. The degradation is recorded on the boundary it produced, as details.qualityDegraded, not only in a log line. Reading intent back out of the fallback template's prose is the multi-signal inference this repo's doctrine forbids, and the log line is not durable. parseCompactionDetails carries the flag across the read path so the fact survives a reload. Corrects a contract the code stated and the tests asserted. A configured compaction provider that throws does NOT cancel: the exception is caught and falls back to built-in summarization, so the comment naming "LLM throw" as the path that still cancels described the wrong route. What actually reaches the degrade is a summarizer that SUCCEEDS and then fails the audit. Traced against production: rh-bot 2026-09-07 lost every gpufarm backend mid-compaction, summarizeViaLLM threw, and the outer catch cancelled 298 messages with history preserved - the throw path behaving correctly. Tests follow the corrected contract rather than being edited to pass. The agent-session-compaction table now names a closed outcome per row - recovered, degraded, cancelled - instead of a boolean that conflated "not recovered" with "cancelled"; only caller cancellation leaves history untouched. The retention-infeasible test asserts the degraded commit. The compact.hooks provenance row asserts the recorded flag on the persisted boundary. Docs corrected in the same change: three pages promised the original history is kept when validation is exhausted, which is no longer true. Production +44/-15, tests +106/-30, docs +14/-5. Validation on Node 24.18.0: agent-session-compaction.test.ts 23 passed compaction-safeguard.test.ts 151 passed compact.hooks.test.ts 196 passed check-changed.mjs --base upstream/main exit 0 tsgo:core exit 0 autoreview --mode uncommitted --max-priority P2 scoped-clean, 0 findings * test(sessions): split the compaction provider boundary out to stay under max-lines d80b2e1ebeb grew agent-session-compaction.test.ts to 1032 counted lines, over the 1000 max-lines cap (check-lint-core-2 on the PR). The file was already at 1037 raw lines on main, and a max-lines suppression is not allowed, so it is split. The seam is the contract, not a line count: the provider-failure outcomes and the degraded-fallback artifact move to agent-session-compaction.provider-boundary.test.ts. collectCompactionEnds is used by both halves, so it moves to the shared agent-session-loop-correctness.test-support.ts instead of being copied. No test case or assertion changes. agent-session-compaction.test.ts 18 passed agent-session-compaction.provider-boundary.test.ts 5 passed (18 + 5 = the prior 23) oxlint --config .oxlintrc.json on the touched files exit 0 control: the same run on a +400-line file exits 1 on max-lines check-changed.mjs --base upstream/main exit 0 autoreview --mode uncommitted --max-priority P2 scoped-clean check-changed selected core, coreTests and docs lanes for this diff and none of them is lint, so its exit 0 never covered max-lines. The oxlint run above did. * fix(compaction): carry the pending ask into the degraded fallback The quality-guard degrade path finalized its fallback summary with no retention plan, so the pending user request and the exact identifiers the audited path budgets for were dropped and the session kept only the empty fallback template. Retention on this path cannot be mandatory: one of the ways a session reaches the degrade is required facts that do not fit the budget, and throwing there would strand the session the branch exists to rescue. finalizeSummaryText now takes an opt-in best-effort mode that records a `quality-retention` loss and refits without the plan, so the degrade keeps its no-throw contract while the audited path still fails closed. Absorbs the fix into the owner rather than wrapping the call site in a try/catch, and drops an unreachable `qualityGuardEnabled` branch the early return above already guarantees. * test(compaction): pin the carried pending ask on the provider boundary The degraded fallback now carries the active request, so the artifact these two provider-boundary cases assert changed with it. The constant still described the lossy shape, where "## Pending user asks" read "None." while the user was still waiting on that prompt. Caught by CI, not by the local gate: check:changed classified this change into core/coreTests/docs and never selected this file, and my scoped runs covered compaction-safeguard.test.ts only. A compaction behavior change has to be run against the whole compaction surface, not the lane the classifier picks. * refactor(compaction): extract sibling modules to stay under the line-cap ratchet c1f00ed (#149622, 2026-09-16) rejects growth in any changed file that is already over its line cap. Rebased onto cecf47a, this branch grew four: compaction.ts 900 -> 902 (cap 700) compaction-safeguard.ts 1315 -> 1343 (cap 700) compaction-safeguard.test.ts 4622 -> 4651 (cap 1000) compact.hooks.test.ts 6650 -> 6662 (cap 1000) Each goes back under its base count by moving one self-contained unit out verbatim: - compaction-details.ts: the CompactionDetails type, its parser, and the bounded latest-user-request extractor that fills it. compaction.ts re-exports the type, so the agent-core index is unchanged. - compaction-safeguard-tool-failures.ts: collecting failed tool results and rendering the Tool Failures section. Its 8 tests move with it and import it directly, so the two __testing entries go. The two type assertions that moved get SAFETY comments (a new file's baseline is 0), and the old file's assertion baseline drops 14 -> 12. - compact.hooks.codex-plans.test-support.ts: the pure prepared Codex plan fixture. No test case or assertion changes. Measured on the M4 (node 26.8.1) against cecf47a: counted lines after 858 / 1264 / 4465 / 6631 line-cap, max-lines, assertion-safety ratchets exit 0 oxfmt --check, 15 changed files exit 0 oxlint, 12 changed .ts files 0 warnings, 0 errors tsgo:core and changed-path test types exit 0 12 test files 497 passed the shard holding compaction-safeguard.test.ts went 175 -> 167 tests, and the new tool-failures file runs the other 8 * fix(compaction): keep the request and split-turn context in the degraded fallback Two ways the degraded fallback still dropped the context it exists to carry. An identifier longer than the artifact budget made the retention plan infeasible. budgetCompactionSummary then returned the bare fallback template with qualityRetentionInfeasible set, fitCompactionSummary accepted it because it fit, and the best-effort retry only ran on a failed fit, so the committed boundary lost the bounded request context along with the identifier. The degraded path now sheds identifiers longest first until the plan fits, logs `identifier-retention` when it had to, and only drops retention entirely (`quality-retention`) when the request context alone cannot fit. The degraded path also passed the generated split-turn section as the first suffix section, and capCompactionSuffix keeps the suffix tail, so a large preserved-turn or file-ops suffix cut the split-turn summary first. The degraded suffix now reserves that section and trims the later sections instead; the normal audited path is unchanged. * test(sessions): reopen and continue a session from a degraded boundary Writes the degraded boundary through the SQLite transcript, reopens the session from disk, and sends the next request, for a fresh session and for one that already held a boundary written before `qualityDegraded` existed. The trigger is the oversized-identifier case, so the reopened boundary, the replayed context, and the next request must all still carry the request. * test(compaction): name the terminal audit path and pin the degraded reasonCode log Address the two non-blocking nits from the September 2 review: - rename the split-turn retention test so it names the audit path it exercises (qualityGuardMaxRetries: 0 makes the rejection terminal), with the in-test comment stating why; - add a focused test that the terminal degrade helper logs the greppable reasonCode=quality_guard_degraded_fallback marker, so a future refactor of the helper's log contract cannot regress it silently. compaction-safeguard.test.ts: 147 passed, 0 failed. oxfmt clean, oxlint 0 warnings / 0 errors, line-cap / max-lines / assertion-safety ratchets OK against main. * test(compaction): route the degraded-reload reopen test to the forks pool The disk-reopen case drives the host-owned SQLite broker, which requires the main thread (openAgentDatabaseSqliteWorkerStore rejects on !isMainThread). Every sibling disk-backed session test is listed in databaseWorkerCoreTestFiles so it runs in the infra forks pool; this new file was missing from the list, so it ran in the agents-support threads pool and hit the admission reject. Add it to the list. * test(compaction): drain the agent database before each reopen in the degraded-reload test On current main both cases fail with "Agent database resources are closing". A queued store writer still opens the SQLite worker store (`persistWorkerRecord` -> `withSessionMetadataWorker` -> `openOpenClawAgentSqliteWorkerStore`) after the test has called the synchronous `closeOpenClawAgentDatabaseByPath`, so its resource registration is refused. Use `closeOpenClawAgentDatabaseByPathAsync`, which waits for pending owners before closing. The sibling reopen tests on main already use it (`agent-session-compaction.admission.test.ts`, `agent-session-tool-result-redaction.test.ts`). Measured on this branch merged into main 560d15c, Node 24.19.0, `pnpm test <file> --maxWorkers=1`: before, 3 of 3 runs failed with 2 of 2 tests red; after, 5 of 5 runs passed. All six test files this PR changes passed together once on the same merge (376 tests). * test(compaction): move the degraded-fallback cases beside the safeguard suite Main consolidated the tool-failure tests to one table, so moving them out no longer pays for the degraded-fallback cases inside compaction-safeguard.test.ts: the line-cap ratchet counted 2178 -> 2193 against main 27e3afb. The three degraded cases (oversized identifier for a source ask and a run-owned request, retained facts plus the reasonCode log, split-turn context under a trimmed suffix) now live in compaction-safeguard.degraded-fallback.test.ts with their own terminal-attempt harness, replacing main's fail-closed case. Also shrinks the assertion-safety entry for compaction-safeguard.ts from 12 to 10 (the two casts moved to the tool-failures module with SAFETY notes) and fixes the import order oxfmt wants in compact.hooks.test.ts. * test(compaction): remove unused pre-merge harness stub * fix(compaction): preserve degraded notices for direct replies Reuse the notice presentation owner for completion and status formatting. Keep warnings in returned replies when no streaming dispatcher exists, preserve abort fencing, and assert retained summary facts instead of a discarded fallback template. * refactor(compaction): keep recovery owners and tests within line limits --------- Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Alex Mittell <[email protected]>
…ermanently uncompactable (openclaw#130393) * fix(compaction): stop a failed summary audit from leaving a session uncompactable Once a session reaches this state it cannot leave it. Compaction runs, produces a summary, fails its quality audit, and cancels. Nothing shrinks, so the next turn is larger than the last and fails the same way, and every later turn ends in "Context is too large and auto-compaction could not recover this turn". The only escape is /new, which discards the conversation. Cancelling is right for a summary that is merely bad: it preserves history rather than storing something worse. It is wrong when the audit cannot be satisfied at all, because the session can then never shrink and the user loses the whole conversation instead of some fidelity. Both terminal quality paths - an exhausted audit and required facts that cannot fit the finalized budget - now emit the structured previous summary plus the preserved recent turns and the generated split-turn prefix through one degradeToFallbackSummary closure, and let compaction complete. Genuinely unrecoverable paths still cancel: a failed built-in generation, an unresolvable summarization model, and missing credentials. The degradation is recorded on the boundary it produced, as details.qualityDegraded, not only in a log line. Reading intent back out of the fallback template's prose is the multi-signal inference this repo's doctrine forbids, and the log line is not durable. parseCompactionDetails carries the flag across the read path so the fact survives a reload. Corrects a contract the code stated and the tests asserted. A configured compaction provider that throws does NOT cancel: the exception is caught and falls back to built-in summarization, so the comment naming "LLM throw" as the path that still cancels described the wrong route. What actually reaches the degrade is a summarizer that SUCCEEDS and then fails the audit. Traced against production: rh-bot 2026-09-07 lost every gpufarm backend mid-compaction, summarizeViaLLM threw, and the outer catch cancelled 298 messages with history preserved - the throw path behaving correctly. Tests follow the corrected contract rather than being edited to pass. The agent-session-compaction table now names a closed outcome per row - recovered, degraded, cancelled - instead of a boolean that conflated "not recovered" with "cancelled"; only caller cancellation leaves history untouched. The retention-infeasible test asserts the degraded commit. The compact.hooks provenance row asserts the recorded flag on the persisted boundary. Docs corrected in the same change: three pages promised the original history is kept when validation is exhausted, which is no longer true. Production +44/-15, tests +106/-30, docs +14/-5. Validation on Node 24.18.0: agent-session-compaction.test.ts 23 passed compaction-safeguard.test.ts 151 passed compact.hooks.test.ts 196 passed check-changed.mjs --base upstream/main exit 0 tsgo:core exit 0 autoreview --mode uncommitted --max-priority P2 scoped-clean, 0 findings * test(sessions): split the compaction provider boundary out to stay under max-lines d80b2e1ebeb grew agent-session-compaction.test.ts to 1032 counted lines, over the 1000 max-lines cap (check-lint-core-2 on the PR). The file was already at 1037 raw lines on main, and a max-lines suppression is not allowed, so it is split. The seam is the contract, not a line count: the provider-failure outcomes and the degraded-fallback artifact move to agent-session-compaction.provider-boundary.test.ts. collectCompactionEnds is used by both halves, so it moves to the shared agent-session-loop-correctness.test-support.ts instead of being copied. No test case or assertion changes. agent-session-compaction.test.ts 18 passed agent-session-compaction.provider-boundary.test.ts 5 passed (18 + 5 = the prior 23) oxlint --config .oxlintrc.json on the touched files exit 0 control: the same run on a +400-line file exits 1 on max-lines check-changed.mjs --base upstream/main exit 0 autoreview --mode uncommitted --max-priority P2 scoped-clean check-changed selected core, coreTests and docs lanes for this diff and none of them is lint, so its exit 0 never covered max-lines. The oxlint run above did. * fix(compaction): carry the pending ask into the degraded fallback The quality-guard degrade path finalized its fallback summary with no retention plan, so the pending user request and the exact identifiers the audited path budgets for were dropped and the session kept only the empty fallback template. Retention on this path cannot be mandatory: one of the ways a session reaches the degrade is required facts that do not fit the budget, and throwing there would strand the session the branch exists to rescue. finalizeSummaryText now takes an opt-in best-effort mode that records a `quality-retention` loss and refits without the plan, so the degrade keeps its no-throw contract while the audited path still fails closed. Absorbs the fix into the owner rather than wrapping the call site in a try/catch, and drops an unreachable `qualityGuardEnabled` branch the early return above already guarantees. * test(compaction): pin the carried pending ask on the provider boundary The degraded fallback now carries the active request, so the artifact these two provider-boundary cases assert changed with it. The constant still described the lossy shape, where "## Pending user asks" read "None." while the user was still waiting on that prompt. Caught by CI, not by the local gate: check:changed classified this change into core/coreTests/docs and never selected this file, and my scoped runs covered compaction-safeguard.test.ts only. A compaction behavior change has to be run against the whole compaction surface, not the lane the classifier picks. * refactor(compaction): extract sibling modules to stay under the line-cap ratchet 38f24c6 (openclaw#149622, 2026-09-16) rejects growth in any changed file that is already over its line cap. Rebased onto b7d9610, this branch grew four: compaction.ts 900 -> 902 (cap 700) compaction-safeguard.ts 1315 -> 1343 (cap 700) compaction-safeguard.test.ts 4622 -> 4651 (cap 1000) compact.hooks.test.ts 6650 -> 6662 (cap 1000) Each goes back under its base count by moving one self-contained unit out verbatim: - compaction-details.ts: the CompactionDetails type, its parser, and the bounded latest-user-request extractor that fills it. compaction.ts re-exports the type, so the agent-core index is unchanged. - compaction-safeguard-tool-failures.ts: collecting failed tool results and rendering the Tool Failures section. Its 8 tests move with it and import it directly, so the two __testing entries go. The two type assertions that moved get SAFETY comments (a new file's baseline is 0), and the old file's assertion baseline drops 14 -> 12. - compact.hooks.codex-plans.test-support.ts: the pure prepared Codex plan fixture. No test case or assertion changes. Measured on the M4 (node 26.8.1) against b7d9610: counted lines after 858 / 1264 / 4465 / 6631 line-cap, max-lines, assertion-safety ratchets exit 0 oxfmt --check, 15 changed files exit 0 oxlint, 12 changed .ts files 0 warnings, 0 errors tsgo:core and changed-path test types exit 0 12 test files 497 passed the shard holding compaction-safeguard.test.ts went 175 -> 167 tests, and the new tool-failures file runs the other 8 * fix(compaction): keep the request and split-turn context in the degraded fallback Two ways the degraded fallback still dropped the context it exists to carry. An identifier longer than the artifact budget made the retention plan infeasible. budgetCompactionSummary then returned the bare fallback template with qualityRetentionInfeasible set, fitCompactionSummary accepted it because it fit, and the best-effort retry only ran on a failed fit, so the committed boundary lost the bounded request context along with the identifier. The degraded path now sheds identifiers longest first until the plan fits, logs `identifier-retention` when it had to, and only drops retention entirely (`quality-retention`) when the request context alone cannot fit. The degraded path also passed the generated split-turn section as the first suffix section, and capCompactionSuffix keeps the suffix tail, so a large preserved-turn or file-ops suffix cut the split-turn summary first. The degraded suffix now reserves that section and trims the later sections instead; the normal audited path is unchanged. * test(sessions): reopen and continue a session from a degraded boundary Writes the degraded boundary through the SQLite transcript, reopens the session from disk, and sends the next request, for a fresh session and for one that already held a boundary written before `qualityDegraded` existed. The trigger is the oversized-identifier case, so the reopened boundary, the replayed context, and the next request must all still carry the request. * test(compaction): name the terminal audit path and pin the degraded reasonCode log Address the two non-blocking nits from the September 2 review: - rename the split-turn retention test so it names the audit path it exercises (qualityGuardMaxRetries: 0 makes the rejection terminal), with the in-test comment stating why; - add a focused test that the terminal degrade helper logs the greppable reasonCode=quality_guard_degraded_fallback marker, so a future refactor of the helper's log contract cannot regress it silently. compaction-safeguard.test.ts: 147 passed, 0 failed. oxfmt clean, oxlint 0 warnings / 0 errors, line-cap / max-lines / assertion-safety ratchets OK against main. * test(compaction): route the degraded-reload reopen test to the forks pool The disk-reopen case drives the host-owned SQLite broker, which requires the main thread (openAgentDatabaseSqliteWorkerStore rejects on !isMainThread). Every sibling disk-backed session test is listed in databaseWorkerCoreTestFiles so it runs in the infra forks pool; this new file was missing from the list, so it ran in the agents-support threads pool and hit the admission reject. Add it to the list. * test(compaction): drain the agent database before each reopen in the degraded-reload test On current main both cases fail with "Agent database resources are closing". A queued store writer still opens the SQLite worker store (`persistWorkerRecord` -> `withSessionMetadataWorker` -> `openOpenClawAgentSqliteWorkerStore`) after the test has called the synchronous `closeOpenClawAgentDatabaseByPath`, so its resource registration is refused. Use `closeOpenClawAgentDatabaseByPathAsync`, which waits for pending owners before closing. The sibling reopen tests on main already use it (`agent-session-compaction.admission.test.ts`, `agent-session-tool-result-redaction.test.ts`). Measured on this branch merged into main 8849083, Node 24.19.0, `pnpm test <file> --maxWorkers=1`: before, 3 of 3 runs failed with 2 of 2 tests red; after, 5 of 5 runs passed. All six test files this PR changes passed together once on the same merge (376 tests). * test(compaction): move the degraded-fallback cases beside the safeguard suite Main consolidated the tool-failure tests to one table, so moving them out no longer pays for the degraded-fallback cases inside compaction-safeguard.test.ts: the line-cap ratchet counted 2178 -> 2193 against main b02cc89. The three degraded cases (oversized identifier for a source ask and a run-owned request, retained facts plus the reasonCode log, split-turn context under a trimmed suffix) now live in compaction-safeguard.degraded-fallback.test.ts with their own terminal-attempt harness, replacing main's fail-closed case. Also shrinks the assertion-safety entry for compaction-safeguard.ts from 12 to 10 (the two casts moved to the tool-failures module with SAFETY notes) and fixes the import order oxfmt wants in compact.hooks.test.ts. * test(compaction): remove unused pre-merge harness stub * fix(compaction): preserve degraded notices for direct replies Reuse the notice presentation owner for completion and status formatting. Keep warnings in returned replies when no streaming dispatcher exists, preserve abort fencing, and assert retained summary facts instead of a discarded fallback template. * refactor(compaction): keep recovery owners and tests within line limits --------- Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Alex Mittell <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: Alex Mittell <[email protected]>
What Problem This Solves
#149202 grew
src/infra/update-managed-service-handoff-boundary.test-support.ts, then #149150 added an import about 30 minutes later. Each PR passed its own merge-ref CI, but together they exceeded 700 lines and blocked subsequent merge refs for over an hour. A separate change reached 727 lines inextensions/codex/src/session-catalog-control.ts.User Impact
After #149805, all six canonical
max-linesscopes warn in ordinary lint, including main, PR stripes, local checks, and landing lint. This PR adds the missing non-regression guard: PR CI andcheck-changedreject new violations and growth in files already over their cap, while allowing unchanged or shrinking debt and growth below the cap. There is no application behavior change.Why This Change Was Made
The existing baseline-ratchets job compares the prepared PR merge tree with its validated base. The checker uses oxlint's own counts, canonical caps and exclusions, shared shrink-ratchet helpers, and Git rename mapping. Measurement copies neutralize lint-disable directives so inherited suppressions cannot hide growth. The count baseline is the Git base; extraction automatically lowers future allowances. The separate suppression inventory remains exact and shrink-only.
Reconciled with #149805 by removing the redundant hosted severity env, temporary config projection, custom warning summary, and their dedicated tests. The lint runner is unchanged from main. Logs retain native diagnostics and oxlint's overall warning/error totals. No caps, scope lists, suppression inventory, other rule severities, or runner capacity changed; no new job or heavy shard was added.
Evidence
test/scripts/check-line-cap-ratchet.test.tsandtest/scripts/changed-lanes.test.tspassed all 355 tests, including all 11 ratchet cases. Earlier broader focused proof passed 1,047 tests across five files.node scripts/check-changed.mjspassed the current scripts/root-tests/docs/tooling selection, including typechecking, lint, all unused-export audits, both line-cap ratchets, and unchanged budgets.pnpm check:docs,pnpm check:workflows, andgit diff --checkpassed.Real oxlint against synthetic versions with main's warning configuration:
The original regression failed before implementation because
check-changeddid not schedulecheck:line-cap-ratchet; the same routing assertion passes with the fix. Comparator and real Git/oxlint tests cover shrinking, growing, newly over-cap, under-cap growth, unchanged debt, renames, staged/untracked files, exclusions, inherited merge debt, and suppressed debt. The integration fixture now exercises both warning and error diagnostics.Earlier CI exposed an unrelated MCP discovery regression, fixed on main by #149662; the refreshed Docker lane passed. On an earlier tested head, the real-Gateway desktop resize test expected a 900×500 framebuffer but observed no canvas at
ui/src/e2e/desktop-resize.real-gateway.e2e.test.ts:638; its single permitted retry passed. Those tests were not modified.Rebased the three commits onto main
c4f6e6b38bfc48f9940f1228aef771dfa7143815, producing head81d26977c1122ae44b667c8c19aed65070188985. The only conflict was the pipeline job table: retained main’s current UI-performance and QA-smoke rows while adding the line-cap growth ratchet to the fast-check description. The first two commits are patch-identical; the third only adapts that table context. Fresh autoreview is clean through P2. Exact-head CI run 35086110095 passed on attempt 1: 139 jobs succeeded, 9 skipped, including Docker seed, real-Gateway UI, baseline ratchets, andopenclaw/ci-gate. No rerun was needed. Fresh REST confirms the PR remains open, non-draft, and mergeable with statecleanon this head. Landing remains with the coordinator.The checker measures only changed supported source files. Existing untouched debt stays visible as lint warnings. Extract a coherent sibling module to reduce debt; do not trim coverage or disable the rule. Applying the policy to the plugin-sdk declaration budget or lint-suppression inventory, and automatically filing repair issues, remains follow-up work. Landing awaits coordinator authorization.