Repository navigation
Preserve continuation regressions and fix tunnel health lock release - #1029
Conversation
swjnxyf
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
swjnxyf
left a comment
There was a problem hiding this comment.
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.
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
presentationReffence, and schema descriptions match main.observe_jobs; and absence of duplicate turns/effects. Acceptedui/messagedispatch alone is insufficient._wcsidecar, and malformed/mixed selector regressions. Existing reference-conflict tests remain intact.The proposed
_wc.ack,ack_ref,resolve, andcontextstripping tests are already covered by main'ssrc/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.embedded_tunnel/tests.rs:215with the reportedstate_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.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.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.