Skip to content

Rust: Add Scoped Main-Turn Interruption#2015

Draft
SlowGreek wants to merge 2 commits into
github:mainfrom
SlowGreek:slowgreek-sync-main-turn-interrupt
Draft

Rust: Add Scoped Main-Turn Interruption#2015
SlowGreek wants to merge 2 commits into
github:mainfrom
SlowGreek:slowgreek-sync-main-turn-interrupt

Conversation

@SlowGreek

@SlowGreek SlowGreek commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Canonical Rust SDK consumer lane for github/copilot-agent-runtime#12968 and github/github-app#8664:

let result = session
    .interrupt_main_turn(InterruptMainTurnOptions::default())
    .await?;
  • Repository-conventional non-exhaustive InterruptMainTurnOptions { flush_queued: bool } with builder API
  • Generated typed session.interruptMainTurn RPC and InterruptMainTurnRequest / InterruptMainTurnResult
  • SessionCapabilities::interrupt_main_turn: Option<bool> on create/resume snapshots
  • Generated typed CapabilitiesChangedData::interrupt_main_turn: Option<bool> event payload
  • Complete capabilities.changed snapshots replace the capability cache wholesale by final runtime contract
  • No fallback to recursive Session::abort; unsupported or old runtimes surface JSON-RPC MethodNotFound

Parity coverage

Transferred the valuable docs/tests from superseded #2014 while preserving this PR's final-head generated files:

  • Exact flushQueued omission through session.rpc().interrupt_main_turn(InterruptMainTurnRequest::default())
  • High-level default serializes flushQueued: false; builder serializes true
  • interrupted: true and false
  • Explicit -32601 propagation with proof that no session.abort follows
  • Create true, resume/unsupported false, old omission None
  • Full-snapshot replacement plus event.typed_data::<CapabilitiesChangedData>()
  • README queue semantics, recursive-abort distinction, and capability-state guidance

Runtime dependency

Generated from the schemas at final runtime head 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0 in github/copilot-agent-runtime#12968. CLI 1.0.71 and current published @github/copilot pins do not contain this protocol. Keep this PR draft until the first published CLI package containing that exact runtime head exists; then update package/version/hash pins through repository conventions and run canonical full codegen. The generated-files freshness check is expected to remain red until that publication gate opens.

Validation

  • cargo +nightly-2026-04-14 fmt --check
  • cargo clippy --all-features --all-targets -- -D warnings
  • cargo test --all-features --test session_test (119 passed)
  • GITHUB_ACTIONS=true cargo test --all-features
  • RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --all-features

Generate the typed session.interruptMainTurn RPC surface, expose Session::interrupt_main_turn with explicit options and result, and track SessionCapabilities.interrupt_main_turn across create and capabilities.changed snapshots.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2704b44e-61a0-4b2f-952b-befba7f5c813
@SlowGreek

Copy link
Copy Markdown
Author

Deduplication note: #2014 is the canonical SDK integration PR and owns ongoing review/maintenance. This draft is temporarily frozen as the final-runtime-head codegen reference. Its generated session_events capability surface and final InterruptMainTurnOptions API will be transferred into #2014 alongside #2014’s broader tests/documentation. Once parity is verified, this PR will close as superseded; no duplicate merge is intended.

@SlowGreek

Copy link
Copy Markdown
Author

Canonical SDK lane. Please preserve this PR’s final-head generated event schema and InterruptMainTurnOptions API. Before readying, transfer from #2014: omitted/false/true wire tests, true/false results, -32601/no-abort-fallback proof, create/resume/old/change capability coverage, typed CapabilitiesChangedData assertion, and README queue/abort/capability documentation. Complete-snapshot replacement on capabilities.changed is intentional per the final runtime contract. #2014 will close after verified parity.

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
@SlowGreek

Copy link
Copy Markdown
Author

Initial canonical parity transfer is complete at 6b5ad304.

Evidence:

  • final-head generated files remain unchanged, including typed CapabilitiesChangedData::interrupt_main_turn: Option<bool> and generated rpc::InterruptMainTurnRequest;
  • exact omitted/false/true flushQueued, true/false results, -32601 propagation/no-abort fallback, create/resume/old/change capability states, complete-snapshot replacement, and typed-event decoding are covered;
  • README now documents queue semantics, recursive abort distinction, and local/unsupported/old capability values;
  • Rust format, Clippy, 119-test session integration suite, complete replay-only Rust suite, and rustdoc pass.

The runtime gate is still closed: github/copilot-agent-runtime#12968 remains open at required head 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0, and no published containing @github/copilot package exists. This PR therefore remains draft and the generated-files freshness check is expected to stay red.

Maintainer action requested after the publication gate opens: the author account has repository viewerPermission: READ, so it cannot enable merge-queue auto-merge. Once canonical pins/codegen are fresh and required checks/review are green, please review and enable repository auto-merge/merge queue. No protection bypass is requested; the hourly steward will keep this lane current.

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.

2 participants