Repository navigation
Run --mcp and --cli inside a live main run loop (M01-04d slice 4, PR 1a) - #53
Merged
Merged
Conversation
No bridge removed; MCP JSON, CLI output, exit codes and approval order are unchanged. - Entry.runOnMain: a main-actor Task plus CFRunLoopRun (never dispatchMain, which leaves the main run loop unserviced). --mcp and --cli use it; --cli bench, the self-test and the window app keep their own paths. - MCPServer's state, call, approve and preview helpers and HumanApproval.ask are @mainactor (still synchronous); CLI.run too. - scan_caches measures through a nonisolated helper so the parallel measure doesn't capture main-actor state (fixes a new Sendable warning in code, no baseline entry). - Self-test: the PR 0 run-loop baseline is flipped on purpose (approval now runs in kCFRunLoopDefaultMode; ticks stay 0 until PR 1b); a dispatchMain negative control fails exactly that check. New bench smoke check (bench stays outside the loop).
… probe (M01-04d slice 4) - scan_caches measures in parallel into an OSAllocatedUnfairLock-guarded array (no unsafe pointer, no @unchecked Sendable); output unchanged. - Test-hooks probe delay now runs the main run loop in modal-panel mode until a modal-mode timer fires, so the dialog's timeout mechanism is exercised inside runOnMain; asserted in the delayed-approval checks. - One CLI.subcommand helper decides bench routing for Entry and CLI.run. - runOnMain doc comment states what dispatchMain actually leaves unserviced. - New --cli mcp subprocess check; bench check: 60 s deadline, header asserted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PR 1a of M01-04d slice 4 (0 ✅ → 1a → 1b → 2 → 3 → 4). No bridge removed; MCP JSON, CLI output, exit codes and approval order unchanged. User approval: SAFETY-CRITICAL APPROVED for exactly this scope.
Entry.runOnMain: a main-actorTask+while true { CFRunLoopRun() }— neverdispatchMain(). Used by--mcpand--cli;--cli bench(spinsRunLoop.mainitself), the self-test,--selftest-childand the window app keep their own paths. Bench routing via oneCLI.subcommandhelper.MCPServermutable state,call,approve, preview helpers andHumanApproval.askare@MainActor(still synchronous);CLI.runtoo.askWithDialogand its main-thread guard unchanged.call@MainActorproduced a new Sendable warning inscan_caches' parallel measure. It now measures into anOSAllocatedUnfairLock-guarded array (compiler-checked: no unsafe pointer, no@unchecked); JSON output byte-identical to the old binary.Proof
mode=kCFRunLoopDefaultMode,main=1;ticksstays 0 until PR 1b).dispatchMain()instead of the loop, exactly that check fails (536/1, probemode=nil).--cli bench sdksfinishes within 60 s with its header;--cli mcpping + EOF → one reply, exit 0.Checks (local)
check-approval-sites.shpass;check-no-test-hooks.shpass (Release,--expect-hooks)mc-reviewer: approve;mc-safety-architect(Opus): approve — findings fixed in 2fa0fee; re-review of the fixes in progressBefore merge
--cli mcp, window app)🤖 Generated with Claude Code