SDK: Add scoped main-turn interruption#2014
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1e1fcdd-b581-4c40-90e3-bde51729fd00
|
Maintainer action requested: this PR is the canonical SDK/codegen prerequisite for github/copilot-agent-runtime#12968 and github/github-app#8664. The author account has READ permission in this repository, so it cannot enable merge-queue auto-merge. Once the final containing CLI package is pinned, canonical codegen is fresh, required checks pass, and review conversations are resolved, please enable repository auto-merge/merge queue. The hourly steward will keep the branch current and address CI/review feedback; no protection bypass is requested. |
There was a problem hiding this comment.
Pull request overview
Adds Rust SDK support for scoped main-turn interruption while preserving background work.
Changes:
- Adds typed interruption RPC types and
Session::interrupt_main_turn. - Exposes interruption capability state.
- Adds documentation and protocol/capability tests.
Show a summary per file
| File | Description |
|---|---|
rust/src/session.rs |
Adds the high-level interruption API. |
rust/src/types.rs |
Exposes request, result, and capability types. |
rust/src/generated/rpc.rs |
Adds generated typed RPC dispatch. |
rust/src/generated/api_types.rs |
Adds generated protocol types and constants. |
rust/tests/session_test.rs |
Tests RPC and capability behavior. |
rust/tests/e2e/elicitation.rs |
Updates capability construction. |
rust/README.md |
Documents interruption usage. |
Review details
- Files reviewed: 5/7 changed files
- Comments generated: 2
- Review effort level: Medium
| .await | ||
| .expect("replacement capabilities should update within timeout"); | ||
|
|
||
| assert!(caps.ui.is_none()); |
There was a problem hiding this comment.
The final runtime contract at 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0 makes every capabilities.changed payload a complete SessionCapabilities snapshot, matching create/resume/getForeground. A sparse merge would retain stale capabilities after the host removes one, so wholesale replacement is intentional. The updated regression test now receives a full { interruptMainTurn: true, ui: ... } snapshot followed by a full { interruptMainTurn: false } snapshot and verifies that the omitted UI capability is removed.
There was a problem hiding this comment.
Final runtime contract clarification: every capabilities.changed payload is a complete snapshot, so wholesale replacement is intentional. Canonical PR #2015 now documents and tests replacement (including clearing omitted prior UI state) at 6b5ad304; partial merge semantics must not be carried forward. #2014 is superseded after this parity transfer.
| "capabilities.changed", | ||
| serde_json::json!({ | ||
| "interruptMainTurn": true, | ||
| "ui": { "elicitation": true } | ||
| }), |
There was a problem hiding this comment.
Addressed by regenerating rust/src/generated/session_events.rs from the final runtime session-event schema at 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0. CapabilitiesChangedData now exposes interrupt_main_turn: Option<bool>. The test subscribes to the event stream, decodes both notifications through event.typed_data::<CapabilitiesChangedData>(), and asserts the typed true/false values before checking the live cache. All three generated Rust files are byte-identical to draft PR #2015.
There was a problem hiding this comment.
Dedup update: draft PR #2015 is now the canonical SDK lane. Its rust/src/generated/session_events.rs, generated from final runtime head 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0, exposes CapabilitiesChangedData::interrupt_main_turn and supersedes this PR’s older generated event surface. The stronger typed-event regression coverage and complete-snapshot rationale are being transferred there; no further code changes will be made on #2014.
There was a problem hiding this comment.
|
Canonical SDK lane: this PR will absorb the final runtime-head codegen from draft #2015 ( |
|
Canonical-lane correction after final-head comparison: draft #2015 is now canonical because it is generated from runtime |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a1e1fcdd-b581-4c40-90e3-bde51729fd00
|
Final dedup decision and parity confirmation: PR #2014 is canonical. Head |
Transfer the stronger wire, error, capability, typed-event, and queue-semantics coverage from superseded PR github#2014 while preserving the final-runtime-head generated schema and conventional high-level API. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 52417727-d5b4-482e-8391-0011d0984a5d
|
Parity is now verified in canonical draft #2015 at |
|
Superseded by canonical PR #2015. #2015 is generated from final runtime head |
Summary
session.interruptMainTurnRust RPC surface from github/copilot-agent-runtime#12968 final head9391d2e781b23fc1ebcbd5b4605f848afa40b7d0Session::interrupt_main_turn(InterruptMainTurnOptions),InterruptMainTurnRequest,InterruptMainTurnResult, andSessionCapabilities::interrupt_main_turninterruptMainTurnthrough generatedCapabilitiesChangedDataand replace the live capability cache from each completecapabilities.changedsnapshotsession.abortrecursive/destructive and propagate-32601without any abort fallbackflushQueued, both interruption results, create/resume/change capabilities, older servers, unsupported methods, and typed event decodingFinal-head parity
The generated Rust files were produced from the committed API and session-event schemas at runtime head
9391d2e781b23fc1ebcbd5b4605f848afa40b7d0. These files are byte-identical to draft SDK PR #2015:rust/src/generated/api_types.rsrust/src/generated/rpc.rsrust/src/generated/session_events.rsPR #2014 additionally retains the broader regression matrix and README coverage.
Mixed-version behavior
Older CLIs and unsupported remote sessions return JSON-RPC MethodNotFound (
-32601). The Rust API propagates that error exactly and never falls back tosession.abort. A missing capability isNone, local support isSome(true), and unsupported remote support isSome(false).capabilities.changedis a completeSessionCapabilitiessnapshot at the final runtime contract, so the SDK intentionally replaces rather than sparsely merges its cache.Publication gate
The current SDK pin remains
@github/copilot1.0.71, which does not contain the method; CLI/package1.0.72-0also predates the final runtime head. Once the first containing package is published, the only remaining gate is to update the repository-standard dependency/version/hash pins and rerun canonical full codegen from that package. Until then, the codegen freshness check is expected to remain blocked.Validation
cargo test --features test-support --test session_test(118 passed)cargo clippy --all-targets --features test-support,bundled-in-process -- --no-deps -D warnings -D clippy::unwrap_used -D clippy::disallowed_macros -D clippy::await_holding_invalid_typeRUSTDOCFLAGS='-D warnings' cargo doc --no-deps --all-featuresPrerequisite for github/github-app#8664 and github/github-app#9104.