Repository navigation
fix(editormcp): send a tool call's change notices when it ends - #2716
Merged
Merged
Conversation
houko
force-pushed
the
fix/flaky-editormcp-tests
branch
from
December 1, 2026 00:26
a27ac7f to
8b4edce
Compare
4 of 5 tasks
houko
force-pushed
the
fix/flaky-editormcp-tests
branch
from
December 1, 2026 01:24
9d4d2f5 to
c5117ee
Compare
Contributor
Author
|
The |
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.
Fixes the one test in
pkg/editor/editormcpthat is still flaky on main, and records why the othereditormcpfailures CI showed over the last two days need no change here.TestChangeStream: flaky, fixed here
Failed on Linux CI after the merge train repairs (7323027) on unrelated branches, for example runs 46347725233 and 46492636674:
notice &{Meta:map[nsgo.dev/by:agent nsgo.dev/revision:15] URI:editor://selection}, want editor://selection by person.Root cause. A tool call is not one editor call.
scene_editreaches the editor throughServer.Editorfor its permission and live step checks, its checkpoint turn, its edit, its reply and the save warning, and each of those runs ended by waking the change notice sender. Those repairs made an agent's notices wait for the outermost agent call on the editor's goroutine, so when the sender drained the queue between two runs of the same tool call, the subscriber got the selection twice from onescene_edit, the second at a later revision.Fix.
callWithSessionManagedmarks the context of the outermost tool call with atoolCall.asAgentkeeps the notices of a run whose context belongs to a tool call still running, andendToolCallwakes the sender when the call returns. A tool another tool calls shares the outer call's mark, so only the outermost call sends. Work a call starts that outlives it, with the call's context, sees the call as ended and wakes the sender itself; a tool call nested in an agent run on the editor's goroutine leaves its notices to that run, as nested agent runs already did. The person's changes still wake the sender at once.TestChangeStreamSendsOneNoticePerToolCallholds a tool between two editor runs and fails if a notice arrives in between.Verification. On a Mac Studio, the new test fails without the fix (
notice ... editor://selection sent while the call was still running, 10 of 10 runs); with it,go tool nsgo test ./pkg/editor/editormcp -- -run '^TestChangeStream' -count=50 -race -cpu=1,2,8passed 300 of 300, and the whole package passes under-race. Linux and Windows CI on this PR run both tests in the test and race detector jobs.Other editormcp failures: already fixed on main, no change here
TestPhoneWebBuildPlayModeBridgeHeadlessBrowserIntegration(Windows only, 10 runs incl. main): two causes, both fixed on main on 2026-11-30.go tool nsgo build -target webfailed when Depot's external Go cache could not rename its own entries (Access is denied), fixed by 8debaf1 (the nested build uses the native Go cache); andTempDir RemoveAllhit Chrome's cache files still held by its child processes after the browser was killed, fixed by a15e376 (the profile lives outsidet.TempDirand its removal waits for the sharing locks to clear). The test stops the browser itself (stopAndWaitin a cleanup). No failure since.TestProxyBindsSessionToTaskIDFromEnv(one Linux race run, 46336317708): the race detector blamed it for a race the previous test left behind,TestMCPTasksSubmitRunsDefaultRunnerAndAdvancesQueueclosing the server off the editor's goroutine while the headless drain finished a task. Fixed by cf7ec00, which closes it insideRunHeadless.TestServerOpenFollowsTheProject(Linux race runs 46312333478 and 46355661365):Server.Closeclosed SDK sessions still being bound byConnect, a data race and a nil dereference. Fixed by 8db9183 (close endpoint sockets and only fully bound direct sessions).TestProxyBindsSessionToTaskIDFromEnvandTestServerOpenFollowsTheProjecton Windows (every Windows run, 2026-11-29 04:06 to 07:30 UTC, incl. main): genuine, not flaky. The endpoint socket path under the Windows temp directory was longer than the 103 bytes a socket path may have; fixed by f4df555, which keeps the test endpoint directory short on Windows.TestServerListsToolsAndResources,TestProxyFindsTheEditor,TestSceneEditReportsOverrideLocationAndNoOpHistory,TestBuiltInAgentEndToEndWithNSGoTestSecretsAndMCPTools, andTestChangeStreambefore 2026-11-30 01:30 UTC: genuine, not flaky. They failed on every platform on every run, main included, while main was broken by merged branches that added tools without updating the tool lists, fused scene version tests, and changed notice and instanced object handling. The repairs on 2026-11-30 (30e4250, 7323027 and the commits around them) fixed them.