Files
multica/server/pkg
VvV e6a0d6f1a3 test(agent): make the ErrWaitDelay regression deterministic (MUL-5631) (#6320)
* test(agent): make the ErrWaitDelay regression deterministic (MUL-5631)

Follow-up to the review on #6276. TestOpenclawExecuteToleratesLingeringStderrHolder
asserted only the outcome — status stays `completed` — but that outcome is
identical whether the ErrWaitDelay branch handled the run or was never reached
at all. Reaching it depended entirely on the stub's descendant outliving the
500ms WaitDelay, so on a loaded runner the descendant could exit first and the
test would pass without exercising the branch it exists for. A silent loss of
coverage, which would let a later change delete the branch with CI still green.

The branch logs a warning that nothing else in the tree emits, so the test now
asserts on that: the log is the only observable proof of which path ran.
newOpenclawTestBackendWithLog tees the logger into a mutex-guarded buffer while
still writing to stderr, so a failure stays readable. The stub's hold also goes
from 1s to 5s, taking the margin over WaitDelay from 2x to 10x — but that only
lowers the odds of a vacuous pass; the assertion is what stops it being silent.

Verified by mutation: redirecting the descendant's stderr away, so it no longer
holds the pipe, leaves all three original assertions passing and fails only the
new one, with `logged warnings were: ""`.

Test-only. openclaw.go and openclaw_stdout.go are byte-identical to main.

* docs(agent): address review nits on the ErrWaitDelay regression test

Two comment-only follow-ups from review of #6320:

- The test's doc comment still said the descendant holds stderr for ~1s;
  the stub was changed to 5s in this PR.
- The warning the test asserts on is split across a string concatenation,
  so the asserted fragment does not turn up in a source grep. Note the
  coupling next to the warning so a future reword sees it before CI does.

No behaviour change.

Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: weiweiwei <weiweiwei@xiaomi.com>
Co-authored-by: Bohan-J <bohan.optimism@gmail.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-08-04 13:27:00 +08:00
..