Skip to content

test(cli): wait for interrupted turns to become idle - #27

Merged
woai3c merged 1 commit into
mainfrom
test/wait-for-interrupt-idle
Aug 20, 2026
Merged

test(cli): wait for interrupted turns to become idle#27
woai3c merged 1 commit into
mainfrom
test/wait-for-interrupt-idle

Conversation

@woai3c

@woai3c woai3c commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • wait for the permission-interrupt turn to finish unwinding before submitting the recovery prompt
  • apply the same idle-screen condition to the sub-agent interruption case
  • keep the tests aligned with the existing zero-loss queue-to-draft behavior

Verification

  • focused PTY interruption suite passed 6 consecutive runs

@ ci /Users/bin/Desktop/res/x-code-cli
pnpm typecheck && pnpm lint:check && pnpm format:check && pnpm test

@ typecheck /Users/bin/Desktop/res/x-code-cli
tsc -b && tsc -p packages/core/tests/tsconfig.json && tsc -p packages/cli/tests/tsconfig.json && tsc -p packages/cli/tests/e2e/tsconfig.json

@ lint:check /Users/bin/Desktop/res/x-code-cli
eslint .

@ format:check /Users/bin/Desktop/res/x-code-cli
prettier --check .

Checking formatting...
All matched files use Prettier code style!

@ test /Users/bin/Desktop/res/x-code-cli
pnpm build && vitest run

@ build /Users/bin/Desktop/res/x-code-cli
pnpm -r run build

Scope: 2 of 3 workspace projects
packages/core build$ tsc -b && node scripts/copy-native.mjs
packages/core build: Done
packages/cli build$ node esbuild.config.js
packages/cli build: Done

RUN v4.0.18 /Users/bin/Desktop/res/x-code-cli

✓ |unit| packages/core/tests/knowledge.test.ts (5 tests) 1995ms
✓ reloads manual topic edits and isolates a topic as soon as it becomes invalid 880ms
✓ commits manual-only edits and tombstones their previously recalled topic content 384ms
✓ late-recalls a protected exact tool entity without requiring a selector model 445ms
✓ |unit| packages/core/tests/peer-registry.test.ts (13 tests) 2753ms
✓ bounds listLive ping concurrency and returns only authenticated pong identities 641ms
✓ honors the overall listLive deadline and caller abort 1629ms
✓ |unit| packages/core/tests/image-compress.test.ts (19 tests) 2830ms
✓ compresses a PNG that exceeds the byte budget 328ms
✓ compresses JPEG to fit a small budget via quality ladder 822ms
✓ PNG sources prefer lossless re-encode over JPEG 619ms
✓ reports original and final dimensions 422ms
✓ |unit| packages/core/tests/memory-search.test.ts (8 tests) 2393ms
✓ returns bounded section snippets for specific queries 518ms
✓ uses the semantic selector across the bounded manifest without lexical routing 536ms
✓ falls back to bounded lexical results when semantic selection fails 436ms
✓ rejects wildcard and candidate-expanding requests structurally 469ms
✓ |unit| packages/core/tests/snapshot.test.ts (23 tests) 2629ms
✓ |unit| packages/core/tests/memory-job-store.test.ts (7 tests) 812ms
✓ |unit| packages/core/tests/file-lock.test.ts (3 tests) 734ms
✓ serializes real child processes even when a legacy owner file remains 616ms
✓ |unit| packages/core/tests/memory-transaction-store.test.ts (3 tests) 1024ms
✓ serializes concurrent commits into distinct generations 641ms
✓ |unit| packages/core/tests/glob-tool.test.ts (7 tests) 1154ms
✓ truncates results when exceeding the cap (200) 932ms
✓ |unit| packages/core/tests/peer-service.test.ts (14 tests) 1543ms
✓ uses one shutdown budget and still notifies healthy senders when the first sender times out 327ms
✓ |unit| packages/core/tests/memory-store.test.ts (14 tests) 4022ms
✓ refreshes derived descriptions and MEMORY.md after a conflict replacement 484ms
✓ treats nested headings as part of a fact until a same-level boundary 544ms
✓ reuses an existing fact ID when the structural subject and predicate match 454ms
✓ moves a replaced fact across topics and deletes the empty old topic 470ms
✓ leaves unrelated manually formatted topic files byte-identical 340ms
✓ commits each durable job at most once across crash replay 530ms
✓ |unit| packages/core/tests/agent-loop.test.ts (24 tests) 2308ms
✓ reconnects an interrupted text stream and persists one combined assistant response 1009ms
✓ suppresses an exact prefix replay after reconnect 1002ms
✓ |unit| packages/core/tests/plugins-install-load.test.ts (33 tests) 4146ms
✓ detects an added plugin between two scans and folds it into the skill registry 423ms
✓ accepts an install when the declared sha matches the cloned HEAD 488ms
✓ rejects an install when the declared sha does not match 424ms
✓ skips the check entirely when no sha is declared (back-compat with sha-less marketplaces) 468ms
✓ |unit| packages/core/tests/pty-provider.test.ts (4 tests | 1 skipped) 537ms
✓ terminates and confirms descendants through the managed PTY tree boundary 374ms
✓ |unit| packages/core/tests/session-store.test.ts (38 tests) 2481ms
✓ |unit| packages/core/tests/posix-process-group-provider.test.ts (2 tests) 279ms
✓ |unit| packages/core/tests/mcp-integration.test.ts (9 tests) 471ms
✓ |unit| packages/core/tests/architecture-boundaries.test.ts (2 tests) 524ms
✓ keeps the core runtime import graph acyclic 375ms
✓ |unit| packages/core/tests/plugins-integration.test.ts (9 tests) 254ms
✓ |unit| packages/core/tests/hooks.test.ts (28 tests) 411ms
✓ |unit| packages/core/tests/shell-session-manager.test.ts (26 tests) 171ms
✓ |unit| packages/core/tests/memory-worker.test.ts (16 tests) 199ms
✓ |unit| packages/core/tests/shell-provider.test.ts (9 tests | 6 skipped) 41ms
✓ |unit| packages/core/tests/skills.test.ts (29 tests) 106ms
✓ |unit| packages/core/tests/grep.test.ts (9 tests) 94ms
✓ |unit| packages/core/tests/settings-io.test.ts (2 tests) 60ms
✓ |unit| packages/core/tests/session-provenance.test.ts (6 tests) 141ms
✓ |unit| packages/core/tests/file-ingest.test.ts (21 tests) 91ms
✓ |unit| packages/core/tests/peer-transport.test.ts (11 tests) 206ms
✓ |unit| packages/core/tests/process-tool-calls.test.ts (34 tests) 120ms
✓ |unit| packages/core/tests/commands.test.ts (14 tests) 134ms
✓ |unit| packages/core/tests/read-file.test.ts (15 tests) 138ms
✓ |unit| packages/core/tests/compression.test.ts (15 tests) 111ms
✓ |unit| packages/cli/tests/plugin-cli-update.test.ts (10 tests) 226ms
✓ |unit| packages/core/tests/plugins-consent.test.ts (11 tests) 130ms
✓ |unit| packages/core/tests/plugins-marketplace.test.ts (23 tests) 46ms
✓ |unit| packages/core/tests/post-turn-memory.test.ts (7 tests) 52ms
✓ |unit| packages/core/tests/mcp-config-writer.test.ts (19 tests) 53ms
✓ |unit| packages/core/tests/plugins-manifest.test.ts (16 tests) 47ms
✓ |unit| packages/core/tests/peer-tools.test.ts (10 tests) 85ms
✓ |unit| packages/core/tests/tool-result-images.test.ts (10 tests) 58ms
✓ |unit| packages/cli/tests/input-history.test.ts (4 tests) 144ms
✓ |unit| packages/core/tests/web-search.test.ts (22 tests) 25ms
✓ |unit| packages/core/tests/browser-profile-lease.test.ts (4 tests) 40ms
✓ |unit| packages/core/tests/permissions.test.ts (75 tests) 44ms
✓ |unit| packages/core/tests/provider-compat.test.ts (8 tests) 31ms
✓ |unit| packages/core/tests/truncate.test.ts (13 tests) 20ms
✓ |unit| packages/core/tests/context-usage.test.ts (17 tests) 20ms
✓ |unit| packages/core/tests/peer-authority.test.ts (51 tests) 15ms
✓ |unit| packages/core/tests/tool-search.test.ts (37 tests) 31ms
✓ |unit| packages/core/tests/plan-tools.test.ts (18 tests) 54ms
✓ |unit| packages/core/tests/project-storage.test.ts (9 tests) 15ms
✓ |unit| packages/core/tests/shell-tool-execution.test.ts (5 tests) 51ms
✓ |unit| packages/cli/tests/use-file-completion.test.ts (13 tests) 8ms
✓ |unit| packages/core/tests/knowledge-loader.test.ts (1 test) 9ms
✓ |unit| packages/core/tests/shell-session-primitives.test.ts (10 tests) 39ms
✓ |unit| packages/core/tests/tool-result-sanitize.test.ts (14 tests) 20ms
✓ |unit| packages/core/tests/memory-index.test.ts (3 tests) 15ms
✓ |unit| packages/core/tests/peer-protocol.test.ts (9 tests) 15ms
✓ |unit| packages/core/tests/list-dir.test.ts (4 tests) 8ms
✓ |unit| packages/core/tests/goal-runner.test.ts (8 tests) 31ms
✓ |unit| packages/core/tests/browser-registry.test.ts (11 tests) 9ms
✓ |unit| packages/core/tests/cache-control.test.ts (22 tests) 6ms
✓ |unit| packages/core/tests/permission-persistence.test.ts (3 tests) 15ms
✓ |unit| packages/core/tests/mcp-permissions.test.ts (5 tests) 8ms
✓ |unit| packages/cli/tests/shutdown-coordinator.test.ts (2 tests) 41ms
✓ |unit| packages/cli/tests/file-completion.test.ts (20 tests) 12ms
✓ |unit| packages/core/tests/shell-utils.test.ts (41 tests) 14ms
✓ |unit| packages/core/tests/browser-visual-check.test.ts (13 tests) 14ms
✓ |unit| packages/cli/tests/terminal-untrusted-render.test.ts (4 tests) 15ms
✓ |unit| packages/core/tests/shell-output-buffer.test.ts (10 tests) 14ms
✓ |unit| packages/core/tests/memory-extractor.test.ts (4 tests) 19ms
✓ |unit| packages/core/tests/peer-inbox.test.ts (9 tests) 12ms
✓ |unit| packages/core/tests/web-fetch.test.ts (17 tests) 14ms
✓ |unit| packages/cli/tests/plugin-install-source.test.ts (9 tests) 5ms
✓ |unit| packages/core/tests/goal-verifier.test.ts (11 tests) 10ms
✓ |unit| packages/core/tests/peer-service-sanitize.test.ts (1 test) 7ms
✓ |unit| packages/cli/tests/cli-args.test.ts (2 tests) 11ms
✓ |unit| packages/cli/tests/print-lifecycle.test.ts (3 tests) 4ms
✓ |unit| packages/core/tests/memory-retriever.test.ts (9 tests) 12ms
✓ |unit| packages/core/tests/vision-fallback.test.ts (9 tests) 6ms
✓ |unit| packages/core/tests/mcp-trust.test.ts (9 tests) 6ms
✓ |unit| packages/core/tests/loop-guard.test.ts (12 tests) 6ms
✓ |unit| packages/core/tests/shell-session-request.test.ts (8 tests) 10ms
✓ |unit| packages/cli/tests/stdout-writer-spacing.test.ts (5 tests) 20ms
✓ |unit| packages/core/tests/system-prompt.test.ts (9 tests) 5ms
✓ |unit| packages/core/tests/peer-identity.test.ts (4 tests) 9ms
✓ |unit| packages/cli/tests/chat-input-geometry.test.ts (12 tests) 5ms
✓ |unit| packages/cli/tests/turn-coordinator.test.ts (7 tests) 6ms
✓ |unit| packages/core/tests/mcp-config-schema.test.ts (10 tests) 11ms
✓ |unit| packages/core/tests/browser-agent.test.ts (8 tests) 8ms
✓ |unit| packages/cli/tests/usage-report.test.ts (1 test) 23ms
✓ |unit| packages/core/tests/mcp-arg-parser.test.ts (40 tests) 7ms
✓ |unit| packages/core/tests/cache-stats.test.ts (10 tests) 5ms
✓ |unit| packages/core/tests/audio-transcribe.test.ts (8 tests) 10ms
✓ |unit| packages/core/tests/goal-state.test.ts (6 tests) 6ms
✓ |unit| packages/core/tests/sub-agent-shell-closure.test.ts (6 tests) 7ms
✓ |unit| packages/core/tests/lru-cache.test.ts (6 tests) 3ms
✓ |unit| packages/core/tests/thinking.test.ts (16 tests) 4ms
✓ |unit| packages/cli/tests/launch-cwd.test.ts (3 tests) 2ms
✓ |unit| packages/core/tests/edit-apply.test.ts (8 tests) 13ms
✓ |unit| packages/core/tests/stream-retry.test.ts (4 tests) 7ms
✓ |unit| packages/core/tests/api-errors.test.ts (33 tests) 8ms
✓ |unit| packages/core/tests/windows-supervisor-protocol.test.ts (3 tests) 4ms
✓ |unit| packages/core/tests/usage.test.ts (6 tests) 6ms
✓ |unit| packages/core/tests/messages.test.ts (9 tests) 4ms
✓ |unit| packages/core/tests/memory-recall-state.test.ts (6 tests) 8ms
✓ |unit| packages/cli/tests/echo-wrap.test.ts (3 tests) 6ms
✓ |unit| packages/cli/tests/shell-session-ui.test.ts (4 tests) 2ms
✓ |unit| packages/core/tests/config.test.ts (21 tests) 4ms
✓ |unit| packages/core/tests/peer-policy.test.ts (4 tests) 4ms
✓ |unit| packages/core/tests/context-window.test.ts (13 tests) 4ms
✓ |unit| packages/core/tests/goal-tools.test.ts (2 tests) 3ms
✓ |unit| packages/cli/tests/peer-lifecycle.test.ts (6 tests) 6ms
✓ |unit| packages/cli/tests/peer-queue.test.ts (5 tests) 7ms
✓ |unit| packages/core/tests/mcp-expand-env.test.ts (8 tests) 5ms
✓ |unit| packages/core/tests/browser-diagnostics.test.ts (2 tests) 4ms
✓ |unit| packages/core/tests/memory-inference.test.ts (7 tests) 6ms
✓ |unit| packages/core/tests/tool-result-pruning.test.ts (7 tests) 2ms
✓ |unit| packages/core/tests/memory-selector.test.ts (1 test) 5ms
✓ |unit| packages/core/tests/mcp-env-safety.test.ts (9 tests) 6ms
✓ |unit| packages/core/tests/provider-registry.test.ts (2 tests) 3ms
✓ |unit| packages/cli/tests/authority-dialog.test.ts (4 tests) 3ms
✓ |unit| packages/cli/tests/prompt-input-decoder.test.ts (5 tests) 2ms
✓ |unit| packages/core/tests/diff.test.ts (6 tests) 6ms
✓ |unit| packages/cli/tests/scope-flag.test.ts (3 tests) 2ms
✓ |unit| packages/core/tests/windows-job-provider.test.ts (8 tests | 6 skipped) 4ms
✓ |unit| packages/core/tests/media-type.test.ts (8 tests) 3ms
✓ |unit| packages/core/tests/shell-shutdown-registry.test.ts (2 tests) 3ms
✓ |unit| packages/core/tests/mcp-oauth-provider.test.ts (3 tests) 7ms
✓ |unit| packages/core/tests/plugins-paths.test.ts (10 tests) 3ms
✓ |unit| packages/cli/tests/terminal-stream-errors.test.ts (2 tests) 2ms
✓ |unit| packages/core/tests/browser-operation-lock.test.ts (2 tests) 4ms
✓ |unit| packages/core/tests/mcp-name-mangling.test.ts (6 tests) 2ms
✓ |unit| packages/core/tests/goal-coordinator.test.ts (2 tests) 3ms
✓ |unit| packages/cli/tests/browser-command.test.ts (3 tests) 4ms
✓ |unit| packages/core/tests/plan-storage.test.ts (3 tests) 2ms
✓ |unit| packages/core/tests/light-compact.test.ts (6 tests) 4ms
✓ |unit| packages/core/tests/terminal-sanitize.test.ts (5 tests) 2ms
✓ |unit| packages/core/tests/shell-error.test.ts (3 tests) 4ms
✓ |unit| packages/cli/tests/busy-command.test.ts (2 tests) 1ms
✓ |unit| packages/cli/tests/plugin-search.test.ts (1 test) 2ms
✓ |unit| packages/cli/tests/pty-screen.test.ts (1 test) 2ms
✓ |unit| packages/cli/tests/spill-heal.test.ts (8 tests) 4ms
✓ |unit| packages/cli/tests/peer-inbox-adapter.test.ts (4 tests) 4ms
✓ |unit| packages/core/tests/message-helpers.test.ts (3 tests) 1ms
✓ |unit| packages/cli/tests/agent-tool-lifecycle.test.ts (7 tests) 12ms
✓ |unit| packages/core/tests/goal-input.test.ts (1 test) 3ms
✓ |unit| packages/core/tests/capabilities.test.ts (8 tests) 3ms
✓ |unit| packages/core/tests/tool-errors.test.ts (2 tests) 2ms
✓ |unit| packages/cli/tests/background-terminal-command.test.ts (3 tests) 2ms
✓ |unit| packages/cli/tests/model-switch-state.test.ts (2 tests) 4ms
✓ |unit| packages/core/tests/debug-log-truncate.test.ts (6 tests) 3ms
✓ |unit| packages/cli/tests/goal-command.test.ts (2 tests) 3ms
✓ |unit| packages/cli/tests/shell-session-transition.test.ts (4 tests) 3ms
✓ |unit| packages/core/tests/utils.test.ts (1 test) 1ms
✓ |unit| packages/cli/tests/session-format.test.ts (7 tests) 2ms
✓ |unit| packages/core/tests/api-exports.test.ts (1 test) 2ms
✓ |unit| packages/cli/tests/utils.test.ts (5 tests) 2ms
✓ |unit| packages/cli/tests/peer-renderer.test.ts (2 tests) 2ms
✓ |unit| packages/cli/tests/use-stream-buffer-boundary.test.ts (2 tests) 1ms
✓ |faults| packages/cli/tests/faults/auth-errors.test.ts (2 tests) 854ms
✓ reports 401 once without retrying or leaking credentials 513ms
✓ reports 403 once without retrying or printing the provider response object 341ms
✓ |faults| packages/cli/tests/faults/rate-limit.test.ts (3 tests) 3524ms
✓ retries a 429 with Retry-After and succeeds within the bounded attempt count 594ms
✓ uses bounded backoff for a 429 without Retry-After 2371ms
✓ aborts a pending 429 retry without sending another request 559ms
✓ |faults| packages/cli/tests/faults/stream-interrupt.test.ts (5 tests) 20280ms
✓ reconnects after the request-level retry budget is exhausted 15533ms
✓ continues an interrupted text stream and keeps recovery context request-only 1383ms
✓ reconnects safely when streamed tool JSON never became a complete call 1353ms
✓ cancels reconnect backoff without issuing another request 1601ms
✓ threads abort to a tool that started after a complete tool call 410ms
✓ |faults| packages/cli/tests/faults/timeout-cleanup.test.ts (5 tests) 33102ms
✓ retries a transient 500 and completes successfully 2549ms
✓ bounds 503 retries and leaves a readable session 14332ms
✓ reports connection refusal without leaking SDK internals 14339ms
✓ cancels a stalled response and releases the HTTP connection 336ms
✓ treats an idle stream as disconnected and reconnects 1545ms
✓ |package| packages/cli/tests/package/install-smoke.test.ts (8 tests) 9581ms
✓ installs both bin aliases and runs version/help outside the repository 929ms
✓ runs a fake-provider print task from the installed package 348ms
✓ executes a tty shell tool through the bundled provider 628ms
✓ keeps first-run state inside the isolated project and X_CODE_HOME 485ms
✓ |pty| packages/cli/tests/pty/tui-provider-errors.test.ts (5 tests) 9803ms
✓ shows a safe 401 error and accepts the next prompt 971ms
✓ shows a safe 403 error and remains interactive 1014ms
✓ retries a transient 429 with Retry-After and recovers in place 941ms
✓ shows Reconnecting while a dropped response stream recovers 1883ms
✓ escapes a stalled provider request, closes its socket, and recovers 4993ms
✓ |pty| packages/cli/tests/pty/tui-resize-reflow.test.ts (5 tests) 8994ms
✓ floating frame: narrow then widen during streaming (VS Code "+") 2021ms
✓ floating frame: rows change at the same time as columns 1988ms
✓ floating frame: zigzag narrow/wide 2022ms
✓ keeps resize cleanup when another render lands inside the deferred window 998ms
✓ preserves visible transcript while height grows after a width reflow 1964ms
✓ |pty| packages/cli/tests/pty/tui-peer-messaging.test.ts (4 tests) 7949ms
✓ registers named agents and lets two locally trusted sessions exchange without authority dialogs 2165ms
✓ renders authority metadata and payload injection as inert visible escapes 2215ms
✓ shows a held-message Accept decision without model authority 1833ms
✓ shows a held-message Refuse decision without model authority 1735ms
✓ |pty| packages/cli/tests/pty/tui-input.test.ts (8 tests) 7423ms
✓ completes first-run setup and restores the parent shell on a clean exit 649ms
✓ edits CJK and emoji text without splitting a grapheme 862ms
✓ clears drafts with Unix and Windows shell shortcuts 785ms
✓ keeps bracketed multiline paste order through submission 827ms
✓ forks completed context while the current request is still streaming 1401ms
✓ clears stale cells after deleting from a soft-wrapped line 822ms
✓ navigates submitted history without mutating the stored entry 1262ms
✓ completes file names containing spaces, CJK, and special characters 812ms
✓ |pty| packages/cli/tests/pty/tui-interrupt.test.ts (6 tests) 6733ms
✓ cancels while waiting for the first token and accepts another prompt 1030ms
✓ cancels a response after streamed text without committing the remaining chunks 1170ms
✓ cancels a pending permission without executing the tool 1095ms
✓ keeps an interrupted shell session alive until /stop terminates its process tree 1251ms
✓ propagates cancellation into a running sub-agent 1136ms
✓ keeps session JSONL valid and usable after an interrupted turn 1050ms
✓ |pty| packages/cli/tests/pty/tui-permissions.test.ts (5 tests) 5047ms
✓ shows the exact command and target before an ask-level shell action 888ms
✓ returns a structured denial to the agent without executing writeFile 880ms
✓ scopes always-allow to edits and still asks for an unrelated shell command 1361ms
✓ denies with inline feedback and returns it to the agent 1022ms
✓ rejects workspace writes before approval in plan mode 894ms
✓ |pty| packages/cli/tests/pty/tui-phantom-frame.test.ts (2 tests) 3916ms
✓ keeps exactly one input box after long-echo commit + typing + history arrows 1358ms
✓ keeps exactly one input box when typing while the answer streams 2557ms
✓ |pty| packages/cli/tests/pty/tui-resize.test.ts (3 tests) 3223ms
✓ preserves an in-progress input while shrinking and expanding 866ms
✓ does not duplicate streamed output when resized mid-response 1328ms
✓ keeps slash and file completion menus operable across resize 1028ms
✓ |pty| packages/cli/tests/pty/tui-ime-park.test.ts (2 tests) 1808ms
✓ parks the hidden hardware cursor on the caret cell after typing 720ms
✓ keeps the cursor parked on the caret while the spinner ticks mid-stream 1087ms
✓ |pty| packages/cli/tests/pty/tui-clear.test.ts (1 test) 1210ms
✓ clears the visible viewport even with racing renders around the clear 1209ms
✓ |pty| packages/cli/tests/pty/tui-diff-width.test.ts (1 test) 929ms
✓ diff bg band extends to the terminal edge on a wide terminal 928ms

Test Files 177 passed (177)
Tests 1656 passed | 13 skipped (1669)
Start at 00:51:19
Duration 111.86s (transform 8.25s, setup 0ms, import 33.61s, tests 161.26s, environment 15ms) passed (177 files, 1656 passed, 13 skipped)

This fixes the Windows timing failure exposed by #25 without changing runtime behavior.

@woai3c
woai3c merged commit 3a75380 into main Aug 20, 2026
15 of 16 checks passed
@woai3c
woai3c deleted the test/wait-for-interrupt-idle branch August 20, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant