Repository navigation
test(agent-core-v2): make zero-timeout task wait deterministic - #4925
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: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 56196994cd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const completion = new Promise<string>((resolve) => { | ||
| setTimeout(() => resolve('done'), 10); |
There was a problem hiding this comment.
Control completion instead of relying on a 10 ms timer
On a loaded CI worker, the process can be descheduled for more than 10 ms between registering this timer and calling wait(..., 0); the completion timer is then already due and can run before the newly registered zero-delay wait timer, returning completed and preserving the flake this commit is intended to remove. Keep completion manually pending and resolve it only after asserting the zero-timeout snapshot.
Useful? React with 👍 / 👎.
| // Delay completion beyond the microtask queue so the zero-timeout snapshot | ||
| // cannot race Promise.resolve() scheduling in different test runners. |
There was a problem hiding this comment.
Remove the newly added explanatory comment
Unless the original task explicitly requested this comment, adding it violates the repository-wide rule prohibiting comment additions; the descriptive test name and completion setup can express the intent without these lines.
AGENTS.md reference: AGENTS.md:L48-L50
Useful? React with 👍 / 👎.
* fix(agent-core-v2): avoid quadratic cloning during session replay (#4885) * fix(agent-core-v2): avoid quadratic cloning during session replay * fix(agent-core-v2): isolate replay assignments and preserve rollback order * refactor(agent-core-v2): make participant mutable replay explicit opt-in --------- Co-authored-by: kimi-agent-bot <[email protected]> * fix(agent-core-v2): validate Kimi media upload status (#4905) * fix(agent-core-v2): reject failed Kimi image extraction * chore: add Kimi image extraction changeset * fix(agent-core-v2): validate Kimi media upload status * fix(kap-server): forward swarm member task events (#4922) * test(agent-core-v2): make zero-timeout task wait deterministic (#4925) Co-authored-by: kimi-agent-bot <[email protected]> * feat(registry): support search_url and feedback_url on custom registry providers (#4875) * feat(registry): support search_url and feedback_url on custom registry providers * fix(sdk): honor provider.env credentials and custom_headers for feedback_url * refactor(core): submit feedback through the engine Web and desktop reach this machine through kap-server, so feedback submission resolves the active model's provider in the engine and is exposed on the same route and klient method. The SDK facade keeps the managed OAuth path and no longer re-derives provider credentials. * refactor(sdk): drop the unused feedback facade Product clients submit feedback through the engine. The SDK facade and oauth toolkit no longer keep a second managed-only submission path. * refactor(feedback): share engine schemas across route and klient The HTTP body uses the engine field names, so the route forwards it and the klient contract imports the same schemas. * refactor(feedback): drop unused kap and klient surfaces TUI reaches IFeedbackService through the harness. The HTTP routes, klient facade, and the schemas that only served them have no caller. * refactor(feedback): package and upload feedback attachments in the engine * refactor(feedback): keep FeedbackService internal to agent-core-v2 * test(cli): provide execFile in node:child_process mocks The feedback codebase scanner added in this branch calls promisify(execFile) at module scope and is now reachable from the agent-core-v2 index, so partial child_process mocks in these suites failed module evaluation. * feat(feedback): disclose submitted files, attach request_id, and drop text-only option (#4876) * feat(registry): support search_url and feedback_url on custom registry providers * fix(sdk): honor provider.env credentials and custom_headers for feedback_url * refactor(core): submit feedback through the engine Web and desktop reach this machine through kap-server, so feedback submission resolves the active model's provider in the engine and is exposed on the same route and klient method. The SDK facade keeps the managed OAuth path and no longer re-derives provider credentials. * refactor(sdk): drop the unused feedback facade Product clients submit feedback through the engine. The SDK facade and oauth toolkit no longer keep a second managed-only submission path. * refactor(feedback): share engine schemas across route and klient The HTTP body uses the engine field names, so the route forwards it and the klient contract imports the same schemas. * refactor(feedback): drop unused kap and klient surfaces TUI reaches IFeedbackService through the harness. The HTTP routes, klient facade, and the schemas that only served them have no caller. * refactor(feedback): package and upload feedback attachments in the engine * refactor(feedback): keep FeedbackService internal to agent-core-v2 * test(cli): provide execFile in node:child_process mocks The feedback codebase scanner added in this branch calls promisify(execFile) at module scope and is now reachable from the agent-core-v2 index, so partial child_process mocks in these suites failed module evaluation. * feat(feedback): disclose submitted files, attach request_id, and drop text-only option * fix(session-export): keep SESSION_NOT_FOUND for missing non-empty session ids The global-log-only fallback exists for feedback submissions without an active session (empty id). Scoping it to empty ids restores the 40401 envelope that kap-server's export route promises for unknown sessions. * test(agent-core-v2): pin retained request id semantics in llmRequester assertions * chore: sync web dist from code-app code-app: 11563df26b92f0035659083327976a2e9b8e6727 code-app-release: b0b6d9c7a45c96ca48039ff05789c6e90f76ef20 code-app-local-build: 005d2b437493b7ab04d01f70542f3b6356699f4d * ci: release packages (#4918) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(agent-core-v2): align request id back-sync with main --------- Co-authored-by: kimi-agent-bot <[email protected]> Co-authored-by: Haozhe <[email protected]> Co-authored-by: 7Sageer <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Root cause
The zero-timeout test passed
Promise.resolve('done')as task completion and then awaitedcontrolled(), which itself yields through microtasks.AgentTaskService.wait(taskId, 0)races the task's already-settled promise against a zero-delay timer, so the first snapshot depends on runner scheduling. GitHub CI returnedcompletedinstead of the expected immediaterunningsnapshot in attempts 2 and 3.Attempts 1 and 2/3 do not share a product-code root cause: attempt 1 failed in the loop harness's persisted/resumed history comparison, while attempts 2/3 are this task-wait scheduling race. This PR only fixes the deterministic task-wait fixture; it does not change the loop harness or any product behavior.
What changed
running, and a subsequent unbounded wait returnscompleted.Before
After
Verification
corepack pnpm run test --shard=2/5— 170 files passed, 4338 tests passed, 4 skipped (2 files skipped).