Repository navigation
test(agents,gateway,state,cli): remove low-value tests (batch d509) - #183174
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 896dc3a4e4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { sessionId, sessionTarget } = runParams; | ||
| const { normalizeUsage } = await import("../usage.js"); | ||
| useOpenAIPlatformAuthFixture(); | ||
| const accounting = vi.fn<(fact: CompactionAccountingFact | undefined) => void>(); |
There was a problem hiding this comment.
Preserve the native-usage finalization integration proof
For native attempts that return usage without private context-accounting events, replacing the real accounting owner with a spy removes the existing createCommandCompactionAccounting → candidate.finish → updateSessionStoreAfterAgentRun regression proof. The replacement can pass even if finalization stops persisting the native prompt-token count or overwrites a replacement writer's session. The remaining command/session-store.test.ts cases supply synthetic accounting facts rather than consuming this runner's emitted fact. Retain one test through the real finalization composition; src/agents/AGENTS.md explicitly requires preserving and testing the exact production composition when moving integration coverage.
AGENTS.md reference: src/agents/AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR consolidates fixtures and removes repeated assertions across agent, Gateway, state, auto-reply, and CLI tests. Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep open: this maintainer-directed consolidation is useful, but it removes an independent ACP cache regression guard. Priority: P3 Before merge
Findings
Provenance
Agent review detailsHow this fits togetherVitest fixtures exercise agent execution, Gateway requests, CLI commands, and database owners, then compare their results with independent expectations. flowchart LR
A[Test fixtures] --> B[Agent and CLI owners]
A --> C[Gateway owners]
B --> D[State and lifecycle owners]
C --> D
D --> E[Behavior assertions]
E --> F[Hosted CI]
Technical reviewBest possible solution: Keep the consolidation while retaining a focused worker-reader SQL budget check for warmed ACP metadata across unrelated writes. Do we have a high-confidence way to reproduce the issue? The pinned source comparison establishes the lost SQL-budget guard; no tests were executed under the read-only review instructions. Is this the best way to solve the issue? Fixture consolidation is appropriate, but row equality cannot replace the independent work-count contract that protects the ACP optimization. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9ff9d8837459. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceTests -3083. Total -3083 across 55 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 11:22 PM ET / October 25, 2026, 03:22 UTC. |
Consolidate repeated message, terminal, catalog and lifecycle fixtures while retaining all expanded cases and security assertions. Static/requester capacity rows retain their distinct retirement paths; LSP error rows retain pending and future request rejection.
Keep TypeSafe source preparation in test/decision-typesafe-admission.integration.test.ts and transport/auth assertions in extensions/typesafe/src/remote.transport.test.ts. OpenAI/OpenRouter integration tests retain header precedence, SDK bridges, and missing-profile no-dispatch proof. Keep static LRU coverage in agent-bundle-mcp-manager.lifecycle.test.ts. Retain legacy string sanitization in the prepared snapshot case. Consolidate fixtures and remove duplicate instrumentation without removing distinct auth, lifecycle, or privacy assertions.
Unify malformed LSP frames and visible-text cases, reuse existing HTTP/model fixtures, and consolidate static catalog selection. Preserve each framing, auth, privacy, and lifecycle branch assertion. Drop the old-config publication replay covered by agent-bundle-mcp-runtime.test.ts's late catalog publication test. Keep persistence failure recovery in the normalized-tool and sessions_spawn regressions; retain owned/unowned classification and memory effect assertions.
Share terminal receipt fixtures and bounded-result assertions. Cover capped tool history in the retained live-loop/current-owner case; retain both cleared-handle lifecycle and diagnostic-owner rejection rows. Remove redundant internal call-shape checks without dropping authority, accounting, privacy, or recovery outcomes.
Reuse recovery defaults and the same-directory recovery runtime fixture. Keep in-memory successor adoption, hook payloads and MCP retirement assertions on the real recovery route. Drop duplicate transport and chat-materialization layers covered by openai-responses-client.terminal-error.test.ts and run/model-setup.selected-model.test.ts. Keep retry ceilings at run/attempt-recovery.test.ts, timeout capacity at run/lane-controller.test.ts, and acquisition cancellation at run.prepared-harness-source-delivery.integration.test.ts. Retain budget fencing at run.attempt-normalization.direct.test.ts and subscription facts at embedded-agent-subscribe.handlers.compaction.test.ts. Keep terminal and Unicode variants in tool-result-truncation.test.ts, precheck decisions in run/preemptive-compaction.test.ts, and non-draining successor hook lifetime in compaction-successor.lifetime.test.ts.
Keep initial model discovery guards, compaction failure redaction, and compatibility mismatches. Remove second-stage normalization replay covered by model-fallback-candidates.test.ts, and success scaffolding covered by model.test.ts and compact.auth-preparation.test.ts. Keep each router receipt branch while leaving generic route formatting to agent-run-terminal-receipt.test.ts. Replace the duplicated tool wrapper inside the mocked attempt with canonical outcome callbacks; agent-tools.before-tool-call.network-error.test.ts retains wrapper-to-guard integration. Preserve capped-history, child authority, cancellation, and raw backend settlement assertions.
Consolidate repeated integrity observation, database fixtures, resource cleanup, and role-specific lease expiry setup. Preserve distinct storage, authority, and lifecycle cases. The duplicate schema-callback payload assertion remains covered by expectSuccessfulReopen in openclaw-state-db-open.test.ts.
Keep real lifecycle owners and consolidate same-path maintenance and dreaming fixtures. Retain all unique seal compatibility, quarantine-v2, authority, rollback, and process-ordering checks. Named remaining proof: openclaw-agent-db.test.ts validates corrupt replacements before writes and revalidates replacements after unregister; openclaw-agent-db.checkonce.test.ts covers idle-retirement admission. Pinned-WAL reopen proof remains in integrity-cache. preflight.startup-integrity covers malformed seals; killed-process recovery covers absent proof. agent-deletion-journal-initialization covers missing-history discovery. openclaw-state-db-readonly covers exact dangling Workshop indexes, database-preflight.explicit-file covers newer unreadable catalogs, and state-read.quarantine-cleanup covers cleanup-error reporting. sqlite-wal owns generic checkpoint scheduling and state-db-cache.cleanup owns healthy sibling disposal. user-profile-list.resident and user-profile-writes.owner retain committed display/merge facts; unique alias-authority assertions moved into the existing commit-revocation case.
Merge integrity-cache into integrity-lease in the same isolated infra project, retaining all cases and removing only the obsolete path entry. Share SQL observation and cleanup. Reuse lexical resource disposal and the existing agent-directory fixture. Minimize the deferred-rollback fixture and remove repeated internal query-count assertions while preserving authority and stored-state outcomes.
Port s0094 commits bc4d2355e47e53acf62d1d36ab84341fbc46a712 and 8cb53caefe984720eb821852dd2cadacf23cb2f2 onto the campaign lane. The first commit is already represented in the lane. Preserve newer catalog client fixtures and the full HEAD-modified delayed catalog pending, refresh, offline, and revoked-viewer proof; apply remaining duplicate-layer removals and consolidations. Validation: oxlint and oxfmt --check passed on all eight touched files; git diff --check passed. Tests intentionally not run under CI-only instructions.
Consolidate proxy and bind fixtures, inherited-tool expectations, session seeding and worktree assertions without removing distinct behavior. Preserve all authority, lifecycle, persistence and streaming cases; this shard is already heavily factored and remains below the requested 25% LOC reduction. CI-only campaign: plain oxlint, oxfmt and diff checks pass; tests and coverage are intentionally deferred to hosted CI.
Consolidate warning fixtures, allowlist diagnostic tables, rejected-branch setup, and replay message builders without removing expanded cases or distinct assertions. Retain separate lifecycle, authority, credential, cache, and durability cases. CI-only validation: plain oxlint, oxfmt, and diff checks. Shard LOC 5415 to 5133 (-5.2%); the requested 25% cut would require removing distinct boundary proof.
Keep checkpoint replay in attempt-tool-call-replay-sanitization.compaction.test.ts; keep NO_REPLY answer custody in embedded-agent-subscribe.astra-async-tails.test.ts; keep restart presentation in terminal-preparation.yield.test.ts; keep raw exec privacy in embedded-agent-subscribe.handlers.tools.test.ts. Progress-card-tool receipt tests own clear, note, and failed-save callbacks; retained plan continuation tests own follow-up decisions. Tool-media-payloads owns media merging. Remove log-label-only attribution and the guest ReferenceError row that never reached the execution gate; retain cancellation and direct/catalog denial proof. Trim unused fixture fields and consolidate delayed cancellation into the existing revoked-identity cases. CI-only: plain oxlint, formatting and diff checks; no test runs. Shard now 4633 lines versus 5415 original (-14.4%), still below the 25% target.
Keep cache-touch failure admission in attempt.model-diagnostic-lifecycle and attempt-execution-phase tests; retain successful request-start TTL expiry here. Exercise threshold deferral in the existing precheck lifecycle case. Join partial presentation and settlement publication assertions on the same real subscription flow. Reuse typed fixture builders; replace repeated plan transactions with direct real-session guards while retaining save/continuation integration. Keep transport thinking mapping in simple-completion-execution tests and logical orchestration smoke here. Lower-level tool-call-id and session-transcript-repair tests retain repeated-ID behavior. Test pure warning formatting at its owner and retain payload custody integration. CI-only: formatting, plain oxlint, and diff checks; no test runs. Original shard 5415 lines to 4352 (-19.6%); 25% target remains unmet.
Consolidate repeated write-admission fixtures, native OAuth refresh barriers, pooled-reader checks, session pin assertions and order fixtures. Preserve all distinct auth, persistence and concurrency cases. CI-only static validation: oxfmt, plain oxlint and diff-check; runtime proof deferred to hosted CI. Reduce shard test LOC from 5489 to 5369; further cuts would remove distinct owner and lifecycle boundaries.
Share branch-shaped session tables and cache lifecycle proof; remove duplicate probe and implementation-count layers while preserving observable owner boundaries. Coverage keepers: profiles.test canonicalizes every alias-equivalent provider state mutation; inherited-owner custom-ID success now asserts caller and persisted health reset. Portable OAuth fence replacement retains the removed login probe's no-host-SQL assertion. Session selection retains removed explicit pins. Runtime materialization publication retains inherited notification, and cached isolation now proves invalidation in the same lifecycle. CI-only: oxfmt, plain oxlint and diff-check pass; no tests or coverage run. Cumulative shard LOC 5489 to 5110; 25-percent target remains unmet.
Replace repeated write-admission state/config callback shells with a native fixture, retaining each case's agent set and drain-before-local-reset ordering. Consolidate owner-field projections without dropping their checks. Remove callback counts and intermediate snapshot projections already proved by the same tests' persisted authoritative winner, final inherited usage, isolated stores and rotated credential outcomes. Fresh cross-suite review did not justify dropping distinct migration, secrets restore/graft or worker-settlement paths. CI-only static gates: oxfmt, plain oxlint and diff-check passed. No tests or coverage run. Shard LOC 5489 to 5038; target remains unmet.
Port s0097 commits 2ca267e8d50e66eefc3576572c43f751b5acbdd9, 6ea0c94bb6d00b9c23612a7613be8180fc0ddd57, and 3d6965365e1b880ce076fd8df0745ade132dd4cd onto the campaign lane. The first cleanup was already present; preserve the lane request-reader consolidation while applying the remaining fixture and replay cleanup. CI-only validation: oxlint and oxfmt --check passed for all 11 touched files; git diff --check passed. Runtime tests and coverage were not run. Independent review found no actionable P0 issues.
Remove duplicated snapshot cancellation and cleanup cases retained in openclaw-state-db-readonly.signal-custody.test.ts: late preparation during removal, cancellation during query/cleanup, cancellation before callback admission, and tracked abort-listener drainage. Share the broker error-reply fixture and synchronous snapshot wrapper without changing their assertions. Retain distinct admission, WAL, registration, and resident-profile authority/durability cases; the honest line reduction is 338/5974 (5.7%), below the requested 25%. Validation: plain oxlint, oxfmt, and git diff --check passed. Tests and coverage intentionally not run under the campaign CI-only instruction.
Share lazy snapshot preparation, filesystem failure probes, transport and aggregate fixtures. Use the existing temp-directory lifecycle for readonly cases and consolidate adoption scenarios without dropping their distinct assertions. Remove wire-shape and request-shape replays already proved by retained hydrated failures and admission outcomes. Revisited PASS 17 moves 1-5. No additional duplicate sibling layer or retired subject was established. Retain admission ordering, leases, SQL durability, cancellation and privacy behavior. This follow-up removes 119 lines; combined with the prior commit the shard is 5974 -> 5517 lines (7.7%), still below the requested 25%. Validation: oxfmt, plain oxlint and git diff --check passed. No tests, coverage or builds run under CI-only instructions.
Carry the foreign-owner refusal and retained-lease assertions into the existing failed-release retry table. The real trigger-abort cleanup path remains in openclaw-agent-db-open-authority.test.ts: retains both authority refusal and recoverable lease cleanup failure. Keep the independent async worker-admission corruption and reopen paths. Reuse same-directory physical-index corruption and SQL assertion helpers, and represent the error transport fixtures as typed tuple rows. Preserve all codec identities, fields and privacy assertions. Static validation only: oxfmt, plain oxlint, git diff --check pass; no tests or builds run. Original shard 5974 -> 5474 lines (8.4%); the 25% target remains unmet because further examined deletions would remove distinct authority, durability or interleaving proof.
Consolidate reset-model setup, ACP visibility fixtures, provider-failure inputs, and registry cleanup without removing expanded cases. Keep distinct authority, persistence, redaction, and lifecycle assertions in the retained tables.\n\nStatic-only campaign: oxlint, oxfmt, and diff checks pass; runtime proof is deferred to hosted CI.
Keep ACP custody in dispatch-acp-delivery.custody.test.ts, successor fences in reply-run-registry.successor-barrier.test.ts, and ClawHub command contracts in commands-plugins.install-clawhub-spec.test.ts. Retain actor mutation, model override, authentication, and captured-steer behavior in their existing owner suites. Consolidate command authority fixtures and remove internal worker call-shape instrumentation. Static lint and formatting only; runtime proof remains with hosted CI.
Reuse the existing negative-call assertion helper and simplify the package fixture existence probe. Preserve every case: this shard guards distinct update authority, recovery, lifecycle ordering, and publication boundaries; no safe whole-layer deletion was established.
Remove the full execution readiness replay: update-command-predecessor-readiness observes HTTP ready/unready ownership without spending the deadline; update-command-readiness.windows owns explicit/default budgets; update-command-original-service keeps split-root certification and recovery; the retained execution schema test checks verification before stop and mutation. Keep healthy-plugin/no-network and metadata-environment warnings at execution, with a focused preflight rejection test. Plain metadata failures and unclassified errors remain in update-command-plugin-preflight. Remove retired inference-repair probing, unrelated canary rows, logger metadata inventories, and duplicate post-release process-extinction assertions. Triage menu failure asserts the actual absent receipt and repair call rather than building an unused executable.
Consolidate repeated proxy validation setup and output checks while keeping all five distinct text cases. Reuse local approval, browser-build, remote-auth, and update-profile fixtures; unwrap singleton bare-root tables. Preserve all approval, redaction, plugin publication, and lifecycle assertions. CI-only shard: formatting, plain oxlint, and diff checks passed; runtime proof is deferred to hosted CI. Shard reduction is 77 lines (1.3%), below target because the remaining cases protect distinct boundaries.
Remove completion cache-write cases duplicated by completion-cli.write-state.test.ts and config-convergence cases duplicated by update-cli.config-convergence.test.ts, retaining their existing security and lifecycle proof in those owners. Keep one CLI preset path while store.sqlite.test.ts covers each query algorithm. Browser manifest and dependency-identity variants remain covered by build-plugin-control-ui.test.ts, build-external-plugin-local-dist.test.ts and plugins-control-ui-reproducibility.test.ts. Trim generic table geometry and parser replays, fixture self-checks and snapshot-like output assertions while retaining CLI redaction and authority checks. CI-only validation: plain oxlint, oxfmt and git diff --check passed. No tests, coverage, builds, or typechecks run. Cumulative shard LOC is 5810 to 4738 (18.5 percent); the 25 percent target remains unmet because no further safe duplicate layer was identified.
Remove duplicate MCP projection and capture cases covered by bundle-mcp.codex.test.ts and bundle-mcp.gemini.test.ts. Remove duplicate credential, model-policy, admission-race and context-window cases covered by prepare.model-routing-authority.test.ts. Consolidate local fixtures without dropping unique authority, history or lifecycle assertions. CI-only validation: plain oxlint, oxfmt and diff-check. Shard LOC 5753 to 4925; campaign static declarations 145 to 125 and expanded cases 222 to 201. The 25 percent line target is not reached; remaining cases protect distinct boundaries. Pre-existing emptyCliPreparation import has no export in prepare-mcp.test-support.ts; left unchanged for coordinator triage.
Table matched preparation, supervisor-fence and bounded-retry branches. Remove internal call-count and RPC rendering replays while retaining authority, ordering and outcome assertions. Keepers: session-history.test.ts recovers SQLite-only compacted history across every CLI reader; session-store-history-boundary.test.ts preserves private history provenance across a public upsert/patch; transcript-write-context.test.ts scopes writer fences to matching keys and targets. CLI reliability settles reply obligations; result-fallback-classifier.test.ts owns clean-empty fallback classification. cli-session.test.ts owns stable MCP resume-hash reuse, bundle-mcp.user-config.test.ts owns loopback override precedence, and bundle-mcp-config.test.ts owns transport mapping. CI-only: plain oxlint, oxfmt and diff-check pass; no test runs. Additional 198 lines removed, cumulative shard 5753 to 4727 (17.8 percent). The 25 percent target remains unmet; retained cases cover distinct security, durability and lifecycle boundaries.
Drop cleanup changes identified by independent review and first-head CI. Restore authority, persistence, cancellation, process-tree, build invalidation and integrity coverage. Keep the remaining batch reduction unchanged.
be6ce1a to
736e423
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 736e42381e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Transport terminal normalization is owned by openai-responses-client.terminal-error.test.ts. | ||
| const erroredAssistant = buildEmbeddedRunnerAssistant({ | ||
| model: model.id, | ||
| stopReason: emptyOutput ? "length" : "error", |
There was a problem hiding this comment.
Preserve the real transport-to-recovery integration proof
For disconnected or output-limited Responses attempts, constructing the terminal assistant directly removes the existing streamOpenAIResponses → runAgentLoopContinue → runner recovery proof. The replacement passes even if AgentCore drops the transport's error code or diagnostics and consequently prevents recovery. The referenced transport tests inspect the transport result directly, so they do not cover this composition. Retain one real-composition case, or extract that exact composition into a tested named helper, as required by the agent test guide.
AGENTS.md reference: src/agents/AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| ?.split("│") | ||
| .slice(1, -1) | ||
| .map((cell) => cell.trim()), |
There was a problem hiding this comment.
Preserve terminal-independent directory table assertions
On Windows without modern-terminal environment markers, resolveDefaultBorder() in packages/terminal-core/src/table.ts deliberately selects ASCII borders. Removing the TERM=xterm fixture while retaining this Unicode-only split makes the directory display tests compare [] against the expected cells even though production rendering is correct. Restore the terminal fixture or accept both supported separators.
Useful? React with 👍 / 👎.
…penclaw#183174) * test(agents): deslop s0095 tests Consolidate repeated message, terminal, catalog and lifecycle fixtures while retaining all expanded cases and security assertions. Static/requester capacity rows retain their distinct retirement paths; LSP error rows retain pending and future request rejection. * test(agents): remove duplicate s0095 coverage layers Keep TypeSafe source preparation in test/decision-typesafe-admission.integration.test.ts and transport/auth assertions in extensions/typesafe/src/remote.transport.test.ts. OpenAI/OpenRouter integration tests retain header precedence, SDK bridges, and missing-profile no-dispatch proof. Keep static LRU coverage in agent-bundle-mcp-manager.lifecycle.test.ts. Retain legacy string sanitization in the prepared snapshot case. Consolidate fixtures and remove duplicate instrumentation without removing distinct auth, lifecycle, or privacy assertions. * test(agents): consolidate s0095 branch fixtures Unify malformed LSP frames and visible-text cases, reuse existing HTTP/model fixtures, and consolidate static catalog selection. Preserve each framing, auth, privacy, and lifecycle branch assertion. Drop the old-config publication replay covered by agent-bundle-mcp-runtime.test.ts's late catalog publication test. Keep persistence failure recovery in the normalized-tool and sessions_spawn regressions; retain owned/unowned classification and memory effect assertions. * test(agents): deslop s0096 tests Share terminal receipt fixtures and bounded-result assertions. Cover capped tool history in the retained live-loop/current-owner case; retain both cleared-handle lifecycle and diagnostic-owner rejection rows. Remove redundant internal call-shape checks without dropping authority, accounting, privacy, or recovery outcomes. * test(agents): consolidate s0096 owner-boundary coverage Reuse recovery defaults and the same-directory recovery runtime fixture. Keep in-memory successor adoption, hook payloads and MCP retirement assertions on the real recovery route. Drop duplicate transport and chat-materialization layers covered by openai-responses-client.terminal-error.test.ts and run/model-setup.selected-model.test.ts. Keep retry ceilings at run/attempt-recovery.test.ts, timeout capacity at run/lane-controller.test.ts, and acquisition cancellation at run.prepared-harness-source-delivery.integration.test.ts. Retain budget fencing at run.attempt-normalization.direct.test.ts and subscription facts at embedded-agent-subscribe.handlers.compaction.test.ts. Keep terminal and Unicode variants in tool-result-truncation.test.ts, precheck decisions in run/preemptive-compaction.test.ts, and non-draining successor hook lifetime in compaction-successor.lifetime.test.ts. * test(agents): trim s0096 repeated setup layers Keep initial model discovery guards, compaction failure redaction, and compatibility mismatches. Remove second-stage normalization replay covered by model-fallback-candidates.test.ts, and success scaffolding covered by model.test.ts and compact.auth-preparation.test.ts. Keep each router receipt branch while leaving generic route formatting to agent-run-terminal-receipt.test.ts. Replace the duplicated tool wrapper inside the mocked attempt with canonical outcome callbacks; agent-tools.before-tool-call.network-error.test.ts retains wrapper-to-guard integration. Preserve capped-history, child authority, cancellation, and raw backend settlement assertions. * test(state): deslop s0099 tests Consolidate repeated integrity observation, database fixtures, resource cleanup, and role-specific lease expiry setup. Preserve distinct storage, authority, and lifecycle cases. The duplicate schema-callback payload assertion remains covered by expectSuccessfulReopen in openclaw-state-db-open.test.ts. * test(state): remove duplicate s0099 assertion layers Keep real lifecycle owners and consolidate same-path maintenance and dreaming fixtures. Retain all unique seal compatibility, quarantine-v2, authority, rollback, and process-ordering checks. Named remaining proof: openclaw-agent-db.test.ts validates corrupt replacements before writes and revalidates replacements after unregister; openclaw-agent-db.checkonce.test.ts covers idle-retirement admission. Pinned-WAL reopen proof remains in integrity-cache. preflight.startup-integrity covers malformed seals; killed-process recovery covers absent proof. agent-deletion-journal-initialization covers missing-history discovery. openclaw-state-db-readonly covers exact dangling Workshop indexes, database-preflight.explicit-file covers newer unreadable catalogs, and state-read.quarantine-cleanup covers cleanup-error reporting. sqlite-wal owns generic checkpoint scheduling and state-db-cache.cleanup owns healthy sibling disposal. user-profile-list.resident and user-profile-writes.owner retain committed display/merge facts; unique alias-authority assertions moved into the existing commit-revocation case. * test(state): consolidate s0099 integrity and lifecycle fixtures Merge integrity-cache into integrity-lease in the same isolated infra project, retaining all cases and removing only the obsolete path entry. Share SQL observation and cleanup. Reuse lexical resource disposal and the existing agent-directory fixture. Minimize the deferred-rollback fixture and remove repeated internal query-count assertions while preserving authority and stored-state outcomes. * test(gateway): remove duplicate s0094 test layers Port s0094 commits bc4d2355e47e53acf62d1d36ab84341fbc46a712 and 8cb53caefe984720eb821852dd2cadacf23cb2f2 onto the campaign lane. The first commit is already represented in the lane. Preserve newer catalog client fixtures and the full HEAD-modified delayed catalog pending, refresh, offline, and revoked-viewer proof; apply remaining duplicate-layer removals and consolidations. Validation: oxlint and oxfmt --check passed on all eight touched files; git diff --check passed. Tests intentionally not run under CI-only instructions. * test(gateway): deslop s0097 tests Consolidate proxy and bind fixtures, inherited-tool expectations, session seeding and worktree assertions without removing distinct behavior. Preserve all authority, lifecycle, persistence and streaming cases; this shard is already heavily factored and remains below the requested 25% LOC reduction. CI-only campaign: plain oxlint, oxfmt and diff checks pass; tests and coverage are intentionally deferred to hosted CI. * test(agents): deslop s0098 tests Consolidate warning fixtures, allowlist diagnostic tables, rejected-branch setup, and replay message builders without removing expanded cases or distinct assertions. Retain separate lifecycle, authority, credential, cache, and durability cases. CI-only validation: plain oxlint, oxfmt, and diff checks. Shard LOC 5415 to 5133 (-5.2%); the requested 25% cut would require removing distinct boundary proof. * test(agents): remove duplicate s0098 test layers Keep checkpoint replay in attempt-tool-call-replay-sanitization.compaction.test.ts; keep NO_REPLY answer custody in embedded-agent-subscribe.astra-async-tails.test.ts; keep restart presentation in terminal-preparation.yield.test.ts; keep raw exec privacy in embedded-agent-subscribe.handlers.tools.test.ts. Progress-card-tool receipt tests own clear, note, and failed-save callbacks; retained plan continuation tests own follow-up decisions. Tool-media-payloads owns media merging. Remove log-label-only attribution and the guest ReferenceError row that never reached the execution gate; retain cancellation and direct/catalog denial proof. Trim unused fixture fields and consolidate delayed cancellation into the existing revoked-identity cases. CI-only: plain oxlint, formatting and diff checks; no test runs. Shard now 4633 lines versus 5415 original (-14.4%), still below the 25% target. * test(agents): consolidate s0098 owner-boundary proof Keep cache-touch failure admission in attempt.model-diagnostic-lifecycle and attempt-execution-phase tests; retain successful request-start TTL expiry here. Exercise threshold deferral in the existing precheck lifecycle case. Join partial presentation and settlement publication assertions on the same real subscription flow. Reuse typed fixture builders; replace repeated plan transactions with direct real-session guards while retaining save/continuation integration. Keep transport thinking mapping in simple-completion-execution tests and logical orchestration smoke here. Lower-level tool-call-id and session-transcript-repair tests retain repeated-ID behavior. Test pure warning formatting at its owner and retain payload custody integration. CI-only: formatting, plain oxlint, and diff checks; no test runs. Original shard 5415 lines to 4352 (-19.6%); 25% target remains unmet. * test(auth-profiles): deslop s0100 tests Consolidate repeated write-admission fixtures, native OAuth refresh barriers, pooled-reader checks, session pin assertions and order fixtures. Preserve all distinct auth, persistence and concurrency cases. CI-only static validation: oxfmt, plain oxlint and diff-check; runtime proof deferred to hosted CI. Reduce shard test LOC from 5489 to 5369; further cuts would remove distinct owner and lifecycle boundaries. * test(auth-profiles): consolidate s0100 owner proof Share branch-shaped session tables and cache lifecycle proof; remove duplicate probe and implementation-count layers while preserving observable owner boundaries. Coverage keepers: profiles.test canonicalizes every alias-equivalent provider state mutation; inherited-owner custom-ID success now asserts caller and persisted health reset. Portable OAuth fence replacement retains the removed login probe's no-host-SQL assertion. Session selection retains removed explicit pins. Runtime materialization publication retains inherited notification, and cached isolation now proves invalidation in the same lifecycle. CI-only: oxfmt, plain oxlint and diff-check pass; no tests or coverage run. Cumulative shard LOC 5489 to 5110; 25-percent target remains unmet. * test(auth-profiles): share s0100 state fixtures Replace repeated write-admission state/config callback shells with a native fixture, retaining each case's agent set and drain-before-local-reset ordering. Consolidate owner-field projections without dropping their checks. Remove callback counts and intermediate snapshot projections already proved by the same tests' persisted authoritative winner, final inherited usage, isolated stores and rotated credential outcomes. Fresh cross-suite review did not justify dropping distinct migration, secrets restore/graft or worker-settlement paths. CI-only static gates: oxfmt, plain oxlint and diff-check passed. No tests or coverage run. Shard LOC 5489 to 5038; target remains unmet. * test(gateway): consolidate remaining s0097 fixtures and replays Port s0097 commits 2ca267e8d50e66eefc3576572c43f751b5acbdd9, 6ea0c94bb6d00b9c23612a7613be8180fc0ddd57, and 3d6965365e1b880ce076fd8df0745ade132dd4cd onto the campaign lane. The first cleanup was already present; preserve the lane request-reader consolidation while applying the remaining fixture and replay cleanup. CI-only validation: oxlint and oxfmt --check passed for all 11 touched files; git diff --check passed. Runtime tests and coverage were not run. Independent review found no actionable P0 issues. * test(state): deslop s0101 tests Remove duplicated snapshot cancellation and cleanup cases retained in openclaw-state-db-readonly.signal-custody.test.ts: late preparation during removal, cancellation during query/cleanup, cancellation before callback admission, and tracked abort-listener drainage. Share the broker error-reply fixture and synchronous snapshot wrapper without changing their assertions. Retain distinct admission, WAL, registration, and resident-profile authority/durability cases; the honest line reduction is 338/5974 (5.7%), below the requested 25%. Validation: plain oxlint, oxfmt, and git diff --check passed. Tests and coverage intentionally not run under the campaign CI-only instruction. * test(state): consolidate s0101 fixtures and repeated assertions Share lazy snapshot preparation, filesystem failure probes, transport and aggregate fixtures. Use the existing temp-directory lifecycle for readonly cases and consolidate adoption scenarios without dropping their distinct assertions. Remove wire-shape and request-shape replays already proved by retained hydrated failures and admission outcomes. Revisited PASS 17 moves 1-5. No additional duplicate sibling layer or retired subject was established. Retain admission ordering, leases, SQL durability, cancellation and privacy behavior. This follow-up removes 119 lines; combined with the prior commit the shard is 5974 -> 5517 lines (7.7%), still below the requested 25%. Validation: oxfmt, plain oxlint and git diff --check passed. No tests, coverage or builds run under CI-only instructions. * test(state): consolidate redundant lease cleanup proof and fixtures Carry the foreign-owner refusal and retained-lease assertions into the existing failed-release retry table. The real trigger-abort cleanup path remains in openclaw-agent-db-open-authority.test.ts: retains both authority refusal and recoverable lease cleanup failure. Keep the independent async worker-admission corruption and reopen paths. Reuse same-directory physical-index corruption and SQL assertion helpers, and represent the error transport fixtures as typed tuple rows. Preserve all codec identities, fields and privacy assertions. Static validation only: oxfmt, plain oxlint, git diff --check pass; no tests or builds run. Original shard 5974 -> 5474 lines (8.4%); the 25% target remains unmet because further examined deletions would remove distinct authority, durability or interleaving proof. * test(auto-reply): deslop s0102 tests Consolidate reset-model setup, ACP visibility fixtures, provider-failure inputs, and registry cleanup without removing expanded cases. Keep distinct authority, persistence, redaction, and lifecycle assertions in the retained tables.\n\nStatic-only campaign: oxlint, oxfmt, and diff checks pass; runtime proof is deferred to hosted CI. * test(auto-reply): remove duplicate s0102 test layers Keep ACP custody in dispatch-acp-delivery.custody.test.ts, successor fences in reply-run-registry.successor-barrier.test.ts, and ClawHub command contracts in commands-plugins.install-clawhub-spec.test.ts. Retain actor mutation, model override, authentication, and captured-steer behavior in their existing owner suites. Consolidate command authority fixtures and remove internal worker call-shape instrumentation. Static lint and formatting only; runtime proof remains with hosted CI. * test(update): deslop s0103 tests Reuse the existing negative-call assertion helper and simplify the package fixture existence probe. Preserve every case: this shard guards distinct update authority, recovery, lifecycle ordering, and publication boundaries; no safe whole-layer deletion was established. * test(update): consolidate s0103 owner-boundary proof Remove the full execution readiness replay: update-command-predecessor-readiness observes HTTP ready/unready ownership without spending the deadline; update-command-readiness.windows owns explicit/default budgets; update-command-original-service keeps split-root certification and recovery; the retained execution schema test checks verification before stop and mutation. Keep healthy-plugin/no-network and metadata-environment warnings at execution, with a focused preflight rejection test. Plain metadata failures and unclassified errors remain in update-command-plugin-preflight. Remove retired inference-repair probing, unrelated canary rows, logger metadata inventories, and duplicate post-release process-extinction assertions. Triage menu failure asserts the actual absent receipt and repair call rather than building an unused executable. * test(cli): deslop s0105 tests Consolidate repeated proxy validation setup and output checks while keeping all five distinct text cases. Reuse local approval, browser-build, remote-auth, and update-profile fixtures; unwrap singleton bare-root tables. Preserve all approval, redaction, plugin publication, and lifecycle assertions. CI-only shard: formatting, plain oxlint, and diff checks passed; runtime proof is deferred to hosted CI. Shard reduction is 77 lines (1.3%), below target because the remaining cases protect distinct boundaries. * test(cli): remove duplicated s0105 suite layers Remove completion cache-write cases duplicated by completion-cli.write-state.test.ts and config-convergence cases duplicated by update-cli.config-convergence.test.ts, retaining their existing security and lifecycle proof in those owners. Keep one CLI preset path while store.sqlite.test.ts covers each query algorithm. Browser manifest and dependency-identity variants remain covered by build-plugin-control-ui.test.ts, build-external-plugin-local-dist.test.ts and plugins-control-ui-reproducibility.test.ts. Trim generic table geometry and parser replays, fixture self-checks and snapshot-like output assertions while retaining CLI redaction and authority checks. CI-only validation: plain oxlint, oxfmt and git diff --check passed. No tests, coverage, builds, or typechecks run. Cumulative shard LOC is 5810 to 4738 (18.5 percent); the 25 percent target remains unmet because no further safe duplicate layer was identified. * test(cli-runner): deslop s0107 tests Remove duplicate MCP projection and capture cases covered by bundle-mcp.codex.test.ts and bundle-mcp.gemini.test.ts. Remove duplicate credential, model-policy, admission-race and context-window cases covered by prepare.model-routing-authority.test.ts. Consolidate local fixtures without dropping unique authority, history or lifecycle assertions. CI-only validation: plain oxlint, oxfmt and diff-check. Shard LOC 5753 to 4925; campaign static declarations 145 to 125 and expanded cases 222 to 201. The 25 percent line target is not reached; remaining cases protect distinct boundaries. Pre-existing emptyCliPreparation import has no export in prepare-mcp.test-support.ts; left unchanged for coordinator triage. * test(cli-runner): trim redundant s0107 proof layers Table matched preparation, supervisor-fence and bounded-retry branches. Remove internal call-count and RPC rendering replays while retaining authority, ordering and outcome assertions. Keepers: session-history.test.ts recovers SQLite-only compacted history across every CLI reader; session-store-history-boundary.test.ts preserves private history provenance across a public upsert/patch; transcript-write-context.test.ts scopes writer fences to matching keys and targets. CLI reliability settles reply obligations; result-fallback-classifier.test.ts owns clean-empty fallback classification. cli-session.test.ts owns stable MCP resume-hash reuse, bundle-mcp.user-config.test.ts owns loopback override precedence, and bundle-mcp-config.test.ts owns transport mapping. CI-only: plain oxlint, oxfmt and diff-check pass; no test runs. Additional 198 lines removed, cumulative shard 5753 to 4727 (17.8 percent). The 25 percent target remains unmet; retained cases cover distinct security, durability and lifecycle boundaries. * test: retain independent coverage and current-main fixtures Drop cleanup changes identified by independent review and first-head CI. Restore authority, persistence, cancellation, process-tree, build invalidation and integrity coverage. Keep the remaining batch reduction unchanged. * test(cli-runner): drop unused history fixture type after rebase
What Problem This Solves
Batch d509 consolidates repeated test fixtures and duplicate assertion layers across agents, auth profiles, Gateway, state, auto-reply, update, and CLI tests. Distinct authority, privacy, persistence, recovery, and lifecycle contracts remain at their owning boundaries. No production behavior or public API changes.
Replayed and rebased onto pinned main
c668bc0565187494726a7d065841ff7c551357f5. Applied 29 of 30 requested commits, preserving their messages. Skipped7caf15c9b33db4d5aa3d66f18f4c07c8b9a12ec3because its duplicate-import fix is already present at the base (empty cherry-pick).Evidence
pnpm install --frozen-lockfile --prefer-offline: passed.node_modules/.bin/oxfmt --write <55 final changed files>: passed; no additional formatting changes.node_modules/.bin/oxlint -c .oxlintrc.json <55 final changed TS/JS files>: exit 0.git diff --check c668bc0565187494726a7d065841ff7c551357f5: passed.openclaw/ci-gatesupplies runtime/type proof. No runtime speedup or measured coverage-preservation claim is made.Shard inventory
Counts compare only final retained files against pinned main. Declarations are static source counts, not expanded cases. Test LOC includes shared support. Source reports explicitly say coverage was not run under CI-only instructions; no numeric coverage totals exist to quote.
s0094: retained changed files
src/gateway/server-methods/session-change-event.test.tss0095: retained changed files
src/agents/prepared-model-runtime.run-resources.test.tssrc/agents/tool-terminal-outcome.test.tssrc/agents/bash-tools.exec-cron-grant.test.tssrc/agents/mcp-auth-profile.integration.test-support.tss0096: retained changed files
src/agents/embedded-agent-runner/run-entry.test.tssrc/agents/embedded-agent-runner/runs.generation.test.tssrc/agents/embedded-agent-runner/tool-result-context-guard.test.tssrc/agents/embedded-agent-runner/run-orchestrator.projection.test.tss0097: retained changed files
src/gateway/net.test.tssrc/gateway/server.sessions.delete-worktree-lifecycle.test.tssrc/gateway/server.talk-permission-parity.test-support.tssrc/gateway/session-sharing-store-cache.test.tssrc/gateway/session-utils-row.materialize.test.tssrc/gateway/http-stream.test-support.tssrc/gateway/mcp-http.configured-mcp-authority.test.tssrc/gateway/server-restart-sentinel.media-binding.test.tss0098: retained changed files
src/agents/embedded-agent-runner/run/attempt-normalization.test.tssrc/agents/embedded-agent-runner/run/attempt.tool-search-run-plan.test.tssrc/agents/embedded-agent-runner/run/tool-error-warning.test.tssrc/agents/embedded-agent-runner/run/attempt-context-guards.test.tssrc/agents/embedded-agent-runner/run/attempt-plan-completion.test.tssrc/agents/embedded-agent-runner/run/attempt-stream-settle.test.tss0099: retained changed files
src/state/openclaw-agent-db-maintenance.test.tssrc/state/openclaw-agent-execution.close-wedge.test.tssrc/state/openclaw-state-db-read-connection.cache.test.tssrc/state/dreaming-startup-admission.test.tssrc/state/user-channel-identities.test.tss0100: retained changed files
src/agents/auth-profiles/runtime-snapshots.test.tssrc/agents/auth-profiles/upsert-with-lock.sqlite.test.tssrc/agents/auth-profiles/store-owner-publication.test.tssrc/agents/auth-profiles/store.async-read.test.tssrc/agents/auth-profiles/store-state-owner.test.tss0101: retained changed files
src/state/openclaw-state-db-readonly.test.tssrc/state/openclaw-agent-execution.registration.test.tssrc/state/openclaw-agent-db.worker-admission.test.tss0102: retained changed files
src/auto-reply/reply/session-reset-model.test.tssrc/auto-reply/reply/commands-compact.lifecycle.test.tssrc/auto-reply/reply/queue.pending-inputs.test.tssrc/auto-reply/reply/reply-turn-admission.worker.test.tss0103: retained changed files
src/cli/update-cli/update-command-foreground.test.tssrc/cli/update-cli/update-command-execution-validation.test.tssrc/cli/update-cli/update-command-execution.test.tssrc/cli/update-cli/update-command-triage.test.tssrc/cli/update-cli/update-finalization-lifecycle.test.tss0105: retained changed files
src/cli/exec-approvals-cli.pending-resolve.test.tssrc/cli/directory-cli.test.tssrc/cli/plugin-invocation-resources.owner.test.tssrc/cli/plugins-cli.inspect.test.tss0107: retained changed files
src/agents/cli-runner/cli-native-tool-approval.test.tssrc/agents/cli-runner/cli-run-settlement.test.tssrc/agents/cli-runner/history-boundary.native-login.test.tssrc/agents/cli-runner/history-boundary.test.tssrc/agents/cli-runner/execute-plugin.policy.test.tssrc/agents/cli-runner/execute.pending-cancellation.test.tsReplay conflict decisions
Kept all non-conflicting cleanup edits. Dropped the cleanup edits for the conflicting files below, retaining their current-main implementation (or earlier retained changes from this batch). Main's changed fixture owners, expanded scenarios, and newer assertions win; no old fixture architecture was reintroduced merely to obtain a reduction.
agent-bundle-mcp-manager.capacity.test.ts(current fixture architecture and capacity/retirement tests);decision-inference.integration.test.ts(expanded TypeSafe unsupported-input/rejection boundary).model-resolution-consistency.test.ts,compaction-successor.test.ts,prompt-cache-observability.test.ts,run.overflow-compaction.test.ts(changed model/compaction fixtures and newer lifecycle/cache assertions).openclaw-agent-db.lease-owner.test.ts,openclaw-state-db-open.test.ts(current lease fixtures and expanded schema/integrity/native/maintenance cleanup failures).doctor.test.ts,session-catalog.test.ts,system-agent-approval.test.ts,system-agent-setup-resolution.test.ts,terminal.test.ts,update.test.tsunder Gateway server-methods (newer fixture shape, policy combinations, terminal and handoff assertions).attempt-tool-call-replay-sanitization.test.ts,attempt.tool-search-catalog-abort.test.ts,prompt-failure.test.ts(current replay fixtures, result middleware, and visible retry guidance).oauth.concurrent-agents.test.ts,order.test.ts,session-override.test.ts, later changes toupsert-with-lock.sqlite.test.ts(current auth fixtures, pin/cooldown scenarios, and host-SQL guard). The initial non-conflicting upsert cleanup remains.server.agent-artifact-apis.test.ts,server.placement-abandonment.test.ts(current worker-service/restart fixtures and explicit placement transitions).openclaw-state-db-readonly.snapshot-admission.test.ts, later changes toopenclaw-state-db-readonly.test.ts,openclaw-agent-admission-order.diagnostic.test.ts(current snapshot/admission fixtures and captured cleanup authority).agent-runner-execution-provider-failures.test.ts,dispatch-acp-delivery.test.ts,reply-run-registry.abort.test.ts,commands-plugins.install.test.ts,commands-session-lifecycle.test.ts(current failure/lifecycle fixtures and channel-conversation binding distinction).update-cli-package.test-support.ts(current package fixture owner).proxy-cli.runtime.test.ts,update-cli.post-core-handoff.test.ts,completion-runtime.test.ts(current proxy/config preservation/completion fixtures).bundle-mcp.test.ts,prepare.durable-context.test.ts, later changes tocli-run-settlement.test.ts,prepare.existing-session.test.ts(current backend injection and session authority proof).No baseline files, production seams, or routing files are changed. The integrity-cache test remains intact.
First-head CI and corrective review
Initial CI run https://github.com/openclaw/openclaw/actions/runs/40156236636 exposed replay defects in table callback signatures, a missing config fixture helper, auth usage and messaging fixture types, WAL callback shape, inherited-owner bookkeeping, and worker-error expectations. Each failing changed-file cleanup was dropped rather than weakening assertions. The compaction fixture's type-aware lint failure is also removed by restoring that file.
The independent review found a missing tool-history seed and configured-remote assertion mismatch, plus lost checks for native usage persistence under writer replacement, cancellation during cold acquisition, post-close tool authority, report-only cron action gating, process-tree death, transitive UI dependency invalidation, and same-path corrupted-database replacement. All nine findings were accepted. These 21 files were restored exactly to pinned main, including the integrity-cache suite and its routing entry:
src/agents/embedded-agent-runner/run.compaction-loop-guard.test-support.tssrc/agents/embedded-agent-runner/run.recovery-cancellation.test-support.tssrc/auto-reply/reply/reply-tool-authority.worker.test.tssrc/cli/run-main.bare-root.test.tssrc/gateway/tool-resolution.exclude.test.tssrc/cli/update-cli/update-command-service-custody.test.tssrc/cli/plugins-control-ui-build.test.tssrc/state/openclaw-agent-db.integrity-lease.test.tssrc/state/openclaw-agent-db.integrity-cache.test.tstest/vitest/vitest.database-worker-core-paths.mjssrc/agents/agent-bundle-lsp-runtime.test.tssrc/agents/embedded-agent-utils.test.tssrc/agents/models-config.providers.implicit.discovery-scope.test.tssrc/agents/auth-profiles/store-update.test.tssrc/agents/auth-profiles/usage.write-admission.test.tssrc/agents/embedded-agent-runner/run/attempt-stream-finalize.test.tssrc/agents/embedded-agent-runner/run/payloads.test.tssrc/state/openclaw-state-db.wal.test.tssrc/state/openclaw-state-worker-error.test.tssrc/agents/auth-profiles/usage.inherited-owner.test.tssrc/gateway/server-methods/approval.test.tsCorrection commit:
be6ce1a5e75d2fbc9e836bda3b474da33e0f6e5c. Corrective review found no actionable P0–P2 findings; formatting, plain lint and diff checks pass. Fresh-head hosted CI is the runtime gate; no local tests/typechecking/coverage or remote leases were run. The PR-context check initially rejected noncanonical headings and passed after the headings were corrected.Rebase after main advanced
The prior corrected head
be6ce1a5e75d2fbc9e836bda3b474da33e0f6e5chad no red checks and only its final PostgreSQL lane pending when GitHub reported a merge conflict. Rebased ontoc668bc0565187494726a7d065841ff7c551357f5. Kept main's newly added resumed-session history tests and imports insrc/agents/cli-runner/history-boundary.test.ts; removed only the unusedInternalSessionEntryimport. Other range-diff differences are surrounding context from main. No authority, persistence, or history behavior was removed to resolve this conflict.New head:
736e42381e23d90f40de2308300201e263ec79bc. Formatting, plain oxlint and diff checks pass again. Prior CI remains prior-head evidence; new-head CI must complete before merge.