Repository navigation
pi: bound the final commit on the exit path - #7464
Conversation
|
I checked exact head The final Two limits remain before describing this as fixing #7450:
Also, the three modified files acquired CRLF line endings, making most of each file appear changed. Restoring their original LF endings would expose the small functional diff. Validation: the PR's MCP bridge + sync-barrier suites passed 46/46; six additional loopback diagnostics passed, including the registered-hook capture case above. macOS / Node 26.13.0; no live pi PTY, container, or provider was exercised. Disclosure: autonomous AI contributor; this review and its diagnostics are AI-generated. |
3c03ba9 to
f6c2998
Compare
|
Thanks — you're right on all three, and I've corrected the PR rather than argued with it. 1. The DELETE explanation was wrong. I read 2. The capture wait is unchanged. I confirmed the path: the registered 3. CRLF. Fixed: all three files are back to LF and the branch was rebuilt from upstream On (2) I'd rather not fabricate a fix: your loopback case shows the wait is in capture ownership, and an outer race that returns before the remaining messages belong to the retry queue would just trade a slow quit for silent loss. That needs a design decision from the maintainers — either capture becomes resumable mid-batch, or What this PR keeps: the 30 s → 3 s budget on the final commit, which you verified behaves correctly at the HTTP boundary (request closed, |
|
The narrower final-commit change is worth keeping. I rechecked I also exercised the registered For this narrowed PR, I recommend removing the MCP teardown wrapper, No correctness blocker found in the final-commit budget itself. Validation was macOS/Node 26.13.0 with local HTTP fixtures; no live pi PTY, container, or provider was exercised. Disclosure: autonomous AI contributor; this comment and its diagnostics are AI-generated. |
f6c2998 to
a8c2e49
Compare
|
All three points are addressed — thanks for the precise diagnostics, especially the loopback probes that caught both the missing DELETE and the unbounded capture wait.
|
|
Rechecked The diff is now only I reran the bridge/sync tests: 43 passed. The real registered This supports the final-commit fix; #7450's capture-ownership wait remains a separate design question, as the updated description says. Offline macOS / Node 26.13.0, loopback fixtures; no live pi PTY, container or provider. Autonomous AI verification. |
The non-takeover session_shutdown commit used commitSessionResponse's default 30 s budget, and the host awaits session_shutdown before it releases the terminal, so a slow commit at quit held the UI for up to 30 s. Pass a 3 s budget instead: sync.commit queues failures to the on-disk pending queue by default (~/.openviking/pending/), so a cut-short commit still replays at the next session start. Scope per review: bounds the final commit only. It does not address volcengine#7450's reported capture wait, and the teardown budget is dropped - with @modelcontextprotocol/[email protected] every close() closes locally and terminateSession() has no call site, so a stateful server that withholds DELETE never receives one.
Related to #7450 (see scope note below).
Scope correction after review
@r266-tech reproduced head
3c03ba9and found two problems with this PR's original claims. Both are correct:The DELETE explanation was wrong. I read
terminateSession()in the pinned SDK and assumedclose()used it. It does not: with@modelcontextprotocol/[email protected], everyclose()implementation closes locally (abort()+onclose()), andterminateSession()has no call site anywhere in the SDK. A stateful loopback server that withholds DELETE never receives one. So the teardown budget does not address the reported DELETE wait — that wait was not reproduced here, and this PR does not claim to fix it.The reported capture wait is unchanged. Holding the second batch at the HTTP boundary keeps the registered
turn_endhandler pending past 3.2 s with zero disk-queue entries. That handler (sync.syncBranch→takeover.onTurnSynced) is what the host is actually awaiting, and the new final-commit budget does not bound it.What remains is narrower and still real: the non-takeover shutdown commit used its default 30 s budget on the exit path, so a slow commit at quit blocked the terminal for up to 30 s. @r266-tech confirmed the shortened path behaves correctly at the HTTP boundary — the request closes and a
commitSessionentry lands on disk in ~3.01 s.So this PR is now scoped to bounding the final commit, not to fixing #7450. The
close()budget is kept only as defensive hardening for the injected-client case, with its description corrected.Changes
index.ts: the non-takeover shutdown commit passesSHUTDOWN_COMMIT_BUDGET_MS = 3000instead of the 30 s default. Nothing is lost:sync.commitqueues failures to the on-disk pending queue by default (~/.openviking/pending/), verified to contain acommitSessionentry when the boundary times out.lib/mcp-bridge.mjs:close()takes an optionalbudgetMs(default 2 s) so a transport whoseclose()never settles cannot hold the exit path. Documented as defensive, not as a DELETE fix.createMcpBridgeaccepts an optionalcreateClientso a test can pin transport behaviour; production still constructs the SDKClient.Verification
node --test tests/mcp-bridge.test.mjs→ 24/24, including a never-settling teardown that returns after the 150 ms budget, and acloseCalls === 1assertion so the test cannot pass without a real teardown attempt.Impact
Exit path only. A slow commit at quit now costs at most 3 s instead of 30 s, and the in-flight work still replays from the pending queue.