Skip to content

fix(native): wait for MCP app teardown before inline close - #209

Merged
rynfar merged 1 commit into
nativefrom
nw/98-teardown-ack
Nov 4, 2026
Merged

rynfar merged 1 commit into
nativefrom
nw/98-teardown-ack

Conversation

@rynfar

@rynfar rynfar commented Nov 4, 2026

Copy link
Copy Markdown
Owner

An inline MCP app's close notification previously removed its host immediately, so resource cleanup never ran. Port the web host's initialized-only ui/resource-teardown request and matching result/error response handling, with its 2,000 ms deadline.

The pure host settles once and discards late completions after disposal. The native bridge owns one cancellable deadline, checks document generations for messages and deadlines, and releases the receiver and host on close. Show app creates a fresh document. This covers the native inline notification/Show app entry point and preserves environment-bound requests through AppConnection.

TR-MCPAPP remains partial; refs #98, which stays open. Remaining gaps: fullscreen/pip, ui/message, model-context UI, downloads, device permissions/dialogs, live theme updates, and live WebKit verification. Viewport detach, eviction, and unmount still dispose immediately; graceful cleanup there requires a compatible WebView lifetime and is deliberately not claimed.

Validation on head f791bab30612692905eabe5b6975d52109ce6772, rebased once onto actual native 15ae309a5e3ef31f4403543ef355290ec3642618: strict cargo clippy --workspace --all-targets -- -D warnings; cargo test --workspace (1,364 tests); normal and snapshot builds; theme generation check; 42 parity tests; conformance generation check; scoped Rust/ledger formatting; deterministic example and offscreen bridge audit. Two behavior tests failed first on 8408 before the fix (prior-8408/red.log). check:changed was deliberately not run because its repo-wide fallback is prohibited by this assignment; the parent-only root gate was not run here. These skips are not claimed green.

Local evidence only (no uploads or committed assets):

  • /private/tmp/native-factory-2f5f764a/98-teardown/before-current.png — built head before the audit; offscreen fallback only.
  • /private/tmp/native-factory-2f5f764a/98-teardown/after.png — actual bridge audit reaches closed/Show app.
  • /private/tmp/native-factory-2f5f764a/98-teardown/reopened.png — renderer click on Show app restores the offscreen fallback.
  • /private/tmp/native-factory-2f5f764a/98-teardown/transcript.log — deterministic, no-network host example: request → one deadline → result/error/explicit timeout → Close; late acknowledgement/deadline ignored; uninitialized close sends nothing.
  • /private/tmp/native-factory-2f5f764a/98-teardown/after.log — offscreen bridge callback audit for result/error/explicit deadline, stale generations, cancellation, and detach disposal. This bypasses WebKit transport and does not prove live JavaScript delivery.
  • /private/tmp/native-factory-2f5f764a/98-teardown/provenance.json — exact base/head, source and PNG hashes. Earlier 8408 runs are retained separately under prior-8408/.

No real window, new server, provider turn, clipboard, live install, or real-data server was used. Captures use a copied worktree smoke home and the existing 14658 server for read subscriptions.

Built with GPT-6.1 Sol in Codex

@rynfar
rynfar merged commit cf0ce8a into native Nov 4, 2026
@rynfar rynfar mentioned this pull request Nov 4, 2026
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