You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad993bb
Browse filesBrowse the repository at this point in the historyBrowse files
fix: defer startup interactions until session setup is delivered (#714)
## Summary
- Hold session-scoped permission requests and elicitations for a freshly
created or forked session until its successful setup response has
actually been written. Both the shared v1-shaped path and direct v2
requests use the same delivery barrier.
- Make MCP startup reporting wait on that barrier before starting OAuth.
The optional MCP startup wait still only waits for native startup status
or its timeout, not for a client dialog, so setup cannot deadlock on
sign-in.
- Hold fresh standard-child announcements behind the parent creation
response using the router's existing readiness mechanism. Creation only
releases readiness; it does not run resume's child snapshot refresh.
- Preserve caller cancellation and discard unsent interactions on close
or disconnect. Track URL completions only after the interaction passes
the startup barrier, and fence stale release callbacks from later
session lifetimes.
- Extend the existing response-write observer to distinguish success
from error responses. Error responses and failed writes do not release
startup UI.
- Update the existing MCP startup documentation. No review/checklist
Markdown file is added.
The ACP v2 session-setup recommendation says Agents SHOULD NOT send
session-scoped requests before the new-session response. Checked against
ACP `d5e9949c`. SDK reference `e23cc640` processes incoming requests
asynchronously, so handler completion alone is not a response-delivery
boundary. The adapter now uses the existing `AcpResponseDelivery`
observer for this policy on both protocol versions.
## Scope
This does not globally pause interactions for already-active sessions on
resume. Existing replay and current-state synchronization ordering
remain intact. Active-resume environment replacement, complete
configuration-change notifications, and remaining session/entity
metadata reconstruction are separate follow-ups.
## Validation
- `npm run typecheck`
- `npm run build`
- `npm test`: 2,310 passed, 39 skipped
- `npm run test:integration`: all 19 passed on the final run
- `npm run codex-test -- -p "Reply with exactly OK. Do not use tools or
modify any files." -o summary`: completed with `end_turn`
- `git diff --check`
- Opt-in E2E tests were not run.
New wire tests exercise both ACP versions with held response writes, MCP
sign-in with and without the startup timeout, fresh child announcements,
and fork interactions. Delivery tests cover unrelated sessions,
cancellation/close/disconnect before sending, stale release callbacks,
and unsent URL completions. Existing response-boundary tests cover
failed writes and error responses.
The first integration run failed the existing shell-approval assertion
about output in the completed tool-call update. Two subsequent full
integration runs passed without changing that test.
|`<= 0` or ommitted| Do not wait. The request completes immediately once the session is created, before any requested MCP server reaches a terminal state. |
34
+
|`<= 0` or omitted| Do not wait for the requested MCP servers to reach a terminal state. |
35
35
|`> 0`| Wait up to that many milliseconds for a terminal state. If the timeout elapses first, the request completes without waiting further. |
36
36
37
37
There is no built-in default timeout: an omitted field means do not wait
@@ -54,6 +54,9 @@ A server that starts successfully gets no report. When a server fails because it
54
54
supports URL elicitation, the adapter first starts the MCP OAuth sign-in. It reports the server only if the sign-in fails.
55
55
The `session/new`, `session/resume`, and `session/load` sessions get these reports. The `session/fork` sessions do not.
56
56
57
+
On ACP connections, reports and OAuth sign-in for a newly created session wait until its `session/new` response
58
+
has been written. The optional startup wait does not wait for the sign-in.
59
+
57
60
To see the live status of every MCP server, send the `/mcp` command. `/mcp reconnect` reloads the MCP configuration and
58
61
restarts the servers that failed, stopped, or changed.
0 commit comments