Repository navigation
refactor(agents): move recovery tests to owners - #123022
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 4:20 AM ET / 08:20 UTC. ClawSweeper reviewWhat this changesThis PR replaces copied embedded-agent incomplete-turn runner suites with direct tests of recovery, terminal-resolution, and assistant-failure owners, and consolidates Discord send tests into one shared Vitest module. Merge readinessKeep open for maintainer handling: the test-ownership refactor is consistent with the current recovery owners and has no discrete source-level regression finding, but the maintainer label and unfinished exact-head checks still gate landing. Priority: P3 Review scores
Verification
How this fits togetherEmbedded agent attempts pass through recovery and terminal-resolution policy before OpenClaw produces a channel reply or an intentional silent outcome. The Discord test surface validates the transport’s outgoing message, asset, reaction, and retry behavior using one shared mock lifecycle. flowchart LR
A[Agent attempt] --> B[Recovery policy]
B --> C[Assistant failure handling]
C --> D[Terminal resolution]
D --> E[Channel delivery]
F[Discord send test module] --> E
E --> G[Reply or intentional silence]
Decision needed
Why: The PR carries the protected maintainer label and current-head verification is incomplete, so automated cleanup should not close or land it. Before merge
Agent review detailsSecurityNone. PR surfaceSource +481, Tests -1084. Total -603 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep incomplete-turn assertions at the recovery, terminal-resolution, and assistant-failure owners, retain the registered single-module Discord test split, and land after current-head checks complete green. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors test ownership rather than reporting a new current-main product failure; its body reports focused Gateway scenarios as supporting validation. Is this the best way to solve the issue? Yes. The run loop calls the recovery, terminal-resolution, and assistant-failure owners directly, so placing assertions at those owners removes duplicated runner logic without changing production behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3b6e54041f18. LabelsLabel justifications:
EvidenceWhat 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 (3 earlier review cycles)
|
267a528 to
1e25ba2
Compare
1e25ba2 to
cb25ec4
Compare
|
Land-ready proof for
|
|
Merged via squash.
|
* test(agents): move recovery tests to owners * test(discord): split send coverage by surface * test(discord): share send mock lifecycle * test(discord): isolate draft timer coverage
What Problem This Solves
Resolves a test-ownership problem where three incomplete-turn suites exercised a 489-line copied run loop instead of the production recovery, terminal-resolution, and assistant-failure owners. The mirror manually implemented retries, prompt mutation, provider API selection, failover checks, and terminal results, so it could pass when production behavior changed and required lockstep test-only repairs.
Exact-head CI also exposed two unrelated
maintest-infrastructure failures while landing this cleanup: a Discord send test exceeded the max-lines limit, and Discord draft suites could freeze for 120 seconds because their fake clock also owned the status-reaction terminal hold.Why This Change Was Made
The empty-response, reasoning-recovery, and silent-reply synthetic suites are deleted. Their unique contracts now run directly against typed production owners:
NO_REPLY, reply-optional side effects, reasoning exhaustion with terminal presentation, missing-assistant persistence, and settled-tool finalization requests;The old split-suite CI rows are removed, and the now-internal model resolver mock is no longer exported from the remaining temporary harness support.
To repair the red
mainlint gate without a suppression, Discord send coverage is physically split at an existing top-level boundary while retaining one Vitest module and one broad mock lifecycle: thread/admin coverage stays in the discovered test file, and guild assets, stickers, polls, and retry cases live in a registered test-support module imported by it. This avoids the shared-worker mock collision that occurred when the sections were separate test files.The final Discord no-output timeout had a different owner. Draft-stream tests used a context that enabled status reactions, while their delay helper froze the global clock. They were therefore awaiting a reaction terminal hold that the test did not own. Draft suites now use a draft-specific context with status reactions disabled; reaction-specific tests keep explicit external clock control. Three duplicate shared-controller assertions were removed, and tracked-target coverage now retargets to a genuinely different message.
User Impact
No user-visible behavior change. Recovery policy tests now fail when the real owner changes, not when a copied loop drifts. Discord draft tests no longer depend on an unrelated reaction timer lifecycle, and retained reaction tests protect Discord-owned target binding rather than re-proving generic controller timing.
Evidence
3017a05e890012e334b34ed2be4b668fab6d6caa.git diff --checkpassed.AI-assisted: yes. Every removed harness case was classified against direct owner coverage or a stronger real QA scenario before deletion.