[2/3] Add guarded structured execution and resumable interactions - #2992
Draft
George Ng (GeorgeNgMsft) wants to merge 3 commits into
Draft
Conversation
Run typed actions through the existing dispatcher queue with live contract, scope and confirmation guards. Preserve true results, validate and resume interactions without replay, and bind trusted host reconnects to the same logical owner. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Materialize inherited process.emit before signal-exit registration can add an enumerable export during Jest ESM linking. Cover inherited and instrumented own emit properties, wrapper cleanup and real signal-exit callback behavior without host-process side effects. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR lets clients run a specific TypeAgent action directly, while keeping the existing execution queue and safety checks. It asks for confirmation unless an action is explicitly marked read-only, lets users answer questions or forms and resume the same action without running it again, and returns the actual results or a clear failure, cancellation, or uncertain outcome. It also lets the originating client reconnect to unfinished work without giving another client control, and fixes a test-runner issue uncovered by the new coverage.
Stack boundary
Layer 2 of the replacement for #2973, based on #2991 (
georgengmsft-structured-action-contracts,9316cb9adfe5147cfc20ef689cfd48ea08297be5). This PR intentionally targets the layer-1 branch, not main. Layer 3 owns MCP/Direct adapters and integration documentation. Nothing here merges the stack or closes the source PR.Changes
Dispatcher.executeAction,continueAction, andcancelActionmethods and existing dispatcher RPC plumbing. Execute typed actions directly through the existing FIFO/request lifecycle andexecuteActions, without@actionserialization, translation, replay, or implicit prior-turn bindings.ActionResultvalues, entities, and IDs. Preserve nested command errors and fallback failures without reasoning retries. Guard internal children and flow steps, preserving parent flow text/data without replaying consumed children.process.emitin the existing Jest setup before signal-exit can add an enumerable own property during module linking. Preserve instrumentation and normal callback cleanup, with deterministic real-signal-exit regression coverage.Host/API handoff
Join a concrete TypeAgent conversation using
structuredActions: {}and retainJoinConversationResult.structuredActions.resumeTokenonly in trusted memory. Resume by joining the sameconversationIdwithstructuredActions: { resumeToken }; latest authorized connection wins. Existing non-opt-in clients cannot execute structured actions. This is narrow logical ownership within the existing local-server trust model, not a new authenticated multi-user boundary.Execution requires protocol version 1,
scopeId,schemaName,actionName, contractfingerprint, and concrete parameters. Continue with the returnedoperationId, opaqueinteractionId, and typed response; cancellation bypasses the suspended FIFO command. An authorized terminal repeat returns the retained cloned result, never another execution. Lost initial delivery or lost retained state must not be replayed automatically.Bounded state: 100 live operations per context, 10-minute operation/interaction lifetime, latest 100 terminal outcomes retained for 10 minutes, and 100 host logical bindings with a 30-minute idle lifetime. Raw PowerShell flow steps fail closed as unavailable until they have discoverable per-step contracts; typed flow actions and their children are supported.
Validation
pnpm --filter agent-dispatcher run test:localpassed twice: 130 suites and 2,087 tests passed, with one preexisting skipped suite/test. No new skips or test-order changes.emit.system.config.toggleAgentwithout false completion and parent flow text/data versus child results with no replay. Focused re-review found no residual significant issue.The initial combined/default Jest failure is resolved in
eff2a883c63fb96f58909f64657eafefa4bc83eb. Root cause:signal-exit@3, throughproper-lockfile, assigned inheritedprocess.emit, changing enumerable export names between Jest SyntheticModule construction and evaluation. The existing setup handled__signal_exit_emitter__but notemit. The new inherited-property regression fails without the correction; combined and default package runs now pass without splitting discovery into a separate process.