Repository navigation
test: stabilize task wait and session reload checks - #4901
Conversation
|
Codex Review Summary: ✅ CompletedThis 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. |
commit: |
Port MoonshotAI#4901, MoonshotAI#4909 and MoonshotAI#4911: complete the task before asserting a zero-timeout wait sees the completed snapshot, restore the instructions reload spy after the failure assertion, poll the search index until it is ready before asserting the page, and run remote-session git probes through a host process that refuses gh. Record MoonshotAI#4840 as equivalent (the refresh path already rebuilds from the effective binding here) and pin it with a regression case, record MoonshotAI#4883 as ported with the compaction profile already present, and record MoonshotAI#4830 as blocked on the absent loop requester/request-attribution layering. Clear the generated-bundle, release-sync and working-notes rows with their applicable verdicts.
Requirement or Bug
Related to #4820. Its CI run
43237351561failed two unrelated tests on attempt 1 and passed both on rerun. This PR makes the two tests deterministic without changing production behavior.Bug Reproduction Steps
test (2)(attempt 1 job): the zero-timeout task wait test expectedrunningbut receivedcompleted.test (5)(attempt 1 job): the workspace reload test expected aninstructions reload failedrejection, butreloadSession()resolved.Both outcomes depend on asynchronous ordering, so repeated runs can pass or fail with the same code.
Root Cause
wait(0)races that completion against a zero-millisecond timer. The test did not control which finished first, so eitherrunningorcompletedcould be returned.instructions.reloadmethod. Watcher-driven reloads can invoke the same method before the explicitreloadSession()call, consume the rejection, and let the explicit call succeed.This is a fundamental fix for the test non-determinism: control the terminal-state precondition and the lifetime of the injected failure. No production workaround is introduced.
Code Changes
packages/agent-core-v2/test/agent/task/taskManager.test.ts: wait for the task to reachcompletedthroughmanager.wait()before checking the zero-timeout completed fast path. The adjacent test continues to cover the pendingrunningresult.packages/node-sdk/test/sdk-rpc-client-v2.test.ts: keep the instructions reload rejection active until the rejection assertion finishes, then restore the original method and verify successful recovery.Behavior Changes and Affected Users
None. This PR changes tests only; users and production callers observe no behavior change. No defaults are flipped and no behavior is removed, so no escape hatch or changeset is needed.
Affected coverage:
Verification
taskManager.test.ts53/53;sdk-rpc-client-v2.test.ts105/105.--shard=2/5and--shard=5/5).@moonshot-ai/agent-core-v2and@moonshot-ai/kimi-code-sdktypecheck passed.Checklist
gen-changesetsrules: no changeset is needed for this tests-only PR.