Skip to content

Preserve continuation regressions and fix tunnel health lock release - #1029

Merged
yyjeqhc merged 9 commits into
yyjeqhc:mainfrom
Xiiiing:codex/restore-mcp-app-auto-resume
Oct 11, 2026
Merged

yyjeqhc merged 9 commits into
yyjeqhc:mainfrom
Xiiiing:codex/restore-mcp-app-auto-resume

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Tunnel readiness reads and writes could leave a lock held after returning when an unrelated concurrent process spawn inherited the open-file description. An immediate write then failed with state_io. Both paths now explicitly unlock on scope exit, including error returns, while keeping nonblocking exclusion and private-file validation. A deterministic regression retains duplicate handles across shared/exclusive lock scopes and checks normal/error exits plus refusal to truncate while another operation holds the lock.

The continuation restoration is already in #1028. The continuation portion preserves four documentation files and three test files; its runtime implementation, Agent presentationRef fence, and schema descriptions match main.

  • Document the real-Host dogfood/publication gate for Agent and Job continuation: 30-second foreground, 5-minute foreground, and 5-minute background cases; original-turn completion; exact Agent Wake consume or exact Job wait delivery followed by actual observe_jobs; and absence of duplicate turns/effects. Accepted ui/message dispatch alone is insufficient.
  • Exercise an owned Job through Gateway durable-wait registration and Direct presentation, then verify existence-hiding denial for a foreign principal.
  • Extend Direct presentation tests with read-only/idempotent hints, scope-filtered discovery, Forbidden calls without OAuth scopes, and Apps on/off invocation paths, retaining the existing exact resource and manifest assertions.
  • Add compatible Agent ref-only initialization ordering, boundary, nullable-tuple, _wc sidecar, and malformed/mixed selector regressions. Existing reference-conflict tests remain intact.
  • Correct current Agent resource references to v20 and distinguish historical aliases from current retired-URI rejection.

The proposed _wc.ack, ack_ref, resolve, and context stripping tests are already covered by main's src/mcp_tests/invocation_envelope.rs, introduced in #1027. Its normalization, parser stripping, malformed-input, pre-deduplication count, and byte/character-bound regressions were verified; no duplicate test-only PR is needed.

Validation:

  • cargo test --locked -p webcodex-environment --lib: 269 passed at default concurrency, including the reported catalog-only diagnosis and new lock regression.
  • A controlled Linux probe retained a duplicate readiness read handle. Before the fix, the original test failed at embedded_tunnel/tests.rs:215 with the reported state_io; with the same probe after the fix, it passed. Ordinary isolated/package runs had passed before the fix, so those reruns alone were not treated as evidence of correctness.
  • The new lock regression also failed with the former close-only behavior before explicit unlocking was added.
  • Rust formatting and diff checks passed for the lock fix.

Previously verified continuation coverage (unchanged by the lock fix):

  • cargo test --locked -p webcodex --lib mcp::tests::model_surface:: -- --nocapture: 16 passed.
  • cargo test --locked -p webcodex --lib mcp::tests::result_app:: -- --nocapture: 25 passed, including the new owned-wait regression.
  • cargo test --locked -p webcodex --lib mcp::tests::invocation_envelope:: -- --nocapture: 6 passed.
  • node --test src/mcp_tests/agent_continuation_app.test.mjs src/mcp_tests/job_terminal_continuation_app.test.mjs: 200 passed.
  • Rust formatting and diff checks passed; Markdown links: 211 files, 864 local links, 0 missing.

The continuation test/documentation portion does not claim a new real-Host acceptance run. The retained procedure requires candidate-build evidence for future continuation behavior or Host integration changes; earlier Host experiments and CI results are not reported as validation of this head.

@swjnxyf swjnxyf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal maintainer review completed against current origin/main. I found no design or correctness blocker. This version preserves the intended narrow restoration: present_agent_continuation / present_job_terminal_continuation are dedicated Direct MCP App presentation tools, wait primitives remain Gateway, app-only bind/state/acquire/prepare/finish authority remains hidden and re-authorized, and the presenting-turn contract explicitly requires a normal assistant final response rather than treating the card/tool result as terminal. The v20 Agent View also correctly tolerates omitted ui/notifications/tool-input.arguments without revoking an established/ref-bootstrapping identity.

Current-main integration merged cleanly in the review worktree. Validation on that integrated tree: Agent App JS 182/182; continuation tool-contract tests 18/18; Agent continuation MCP Rust tests 9/9; Job-terminal continuation MCP tests 4/4; model-surface routing tests 16/16; formatting, diff checks, and 864 Markdown links pass. No review commit was needed here.

This PR substantially overlaps #1028. I am approving its implementation quality, but I am not merging it: if #1028 lands first, this branch should be treated as overlapping/superseded rather than merging both implementations independently.

@swjnxyf swjnxyf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up after #1028 landed on main: do not merge #1029 as-is now. Before #1028 merged, I completed a full current-main integration review and found the implementation technically sound (Agent App JS 182/182; continuation contracts 18/18; Agent MCP 9/9; Job continuation 4/4; model-surface 16/16; formatting/diff/links passed). However, #1028 now implements the same restoration on main, including the omitted-arguments Host edge-case fix and Agent App v20 added during maintainer review.

Re-testing #1029 against the post-#1028 main produces direct content conflicts across the continuation tool contracts, discovery/model surface, Agent/Job App tests, Agent v20 HTML/resource registry, and continuation docs. This is expected overlap, not a newly discovered defect in the original implementation. The branch should therefore be reduced/rebased to only genuinely unique follow-up material, or closed as superseded; resolving the conflicts by choosing the #1029 side wholesale would risk reintroducing already-reviewed differences into the now-merged continuation surface.

Revert the net changes of yyjeqhc#1029 before syncing main and retaining the independent acceptance documentation and regression coverage.
Preserve the real-Host gate, owned Gateway wait to Direct presentation regression, scoped discovery and invocation coverage, and compatible Agent ref initialization cases from yyjeqhc#1029. Keep production behavior from yyjeqhc#1028, including the presentationRef fence and selector descriptions. Update current Agent resource documentation to v20 and retired-URI rejection.
@yyjeqhc yyjeqhc changed the title Restore dedicated MCP App continuation tools and Agent card initialization test(mcp): preserve continuation acceptance and authority regressions Oct 11, 2026

@swjnxyf swjnxyf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the rewritten head cab176225 after the overlapping continuation implementation was reverted. The final diff against post-#1028 main is now exactly the intended salvage scope: four documentation files and three test files only; production continuation implementation, Agent v20 resource, presentationRef fence, and schema/runtime behavior remain unchanged from main.

The retained material is worthwhile and non-duplicative: (1) a concrete real-Host dogfood/publication gate for Agent and Job continuation, including normal original-turn finalization, 30s/5m foreground/background cases, exact Agent Wake consume or exact Job wait delivery plus actual Job observation, and no duplicate effect; (2) stronger Direct presentation routing/scope/annotation regressions; (3) an end-to-end owned Gateway wait -> Direct Job presentation -> foreign-principal existence-hiding denial test; and (4) compatible Agent ref-only ordering/boundary/nullable/sidecar selector regressions while preserving main's ref-conflict fence.

I also checked the documentation claims against the current registry: Agent v20 is current and retired resource aliases are rejected. The PR correctly does not duplicate the proposed _wc wrapper tests because current main's invocation_envelope suite already covers normalization, stripping, malformed input, pre-deduplication limits, and byte/character bounds.

Independent validation on this head: Agent+Job App JS 200/200; model-surface 16/16; result-app 25/25 including the new Job authorization case; invocation-envelope 6/6; cargo fmt --check, git diff --check, and 864 Markdown links all pass. No remaining review blocker found. CI #2795 is still running, but from review/correctness perspective this is ready to merge.

Explicitly unlock readiness files on successful and failed reads/writes so duplicated or concurrently inherited descriptors cannot retain completed-operation locks. Preserve nonblocking exclusion and all private-file validation. Add deterministic shared/exclusive lock regressions with retained duplicate handles and verify the original catalog-only diagnosis with a controlled inherited-handle probe.
@yyjeqhc yyjeqhc changed the title test(mcp): preserve continuation acceptance and authority regressions Preserve continuation regressions and fix tunnel health lock release Oct 11, 2026
@yyjeqhc
yyjeqhc merged commit 7a9426b into yyjeqhc:main Oct 11, 2026
13 checks passed
@Xiiiing
Xiiiing deleted the codex/restore-mcp-app-auto-resume branch October 12, 2026 06:42
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.

3 participants