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

Originally generated from the feature schemas at runtime commit 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0 in github/copilot-agent-runtime#12968. The runtime integrated current main at 099e4e1ec7548427a58605929d18c668d5399118, fixed complete capability snapshots at c7f1c68d9d316c1294d338923b2609d6e2523141, then hardened attached-session scoping and canonical snapshot documentation at current head 034a636b982daf15340778f0f1b92b9bf30454fc. Each prior head remains an ancestor. CLI 1.0.71 and current published @github/copilot pins do not contain this protocol.

The containing-release gate must now track exact current runtime head 034a636b982daf15340778f0f1b92b9bf30454fc, not prior heads c7f1c68d9d, 099e4e1ec7, or 9391d2e781. Keep this PR draft until the first published CLI package containing the current 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.

@SlowGreek

Copy link
Copy Markdown
Author

Runtime integration update: github/copilot-agent-runtime#12968 is now conflict-free at exact head 099e4e1ec7548427a58605929d18c668d5399118. The original feature commit 9391d2e781b23fc1ebcbd5b4605f848afa40b7d0 remains its direct first parent, but the containing-release gate for this SDK PR must track the first published CLI package containing the integrated head 099e4e1ec7, not merely the stale pre-integration head. The Runtime dependency section has been updated accordingly.

@SlowGreek

Copy link
Copy Markdown
Author

Runtime release-gate update: the exact required containing head is now c7f1c68d9d316c1294d338923b2609d6e2523141, after fixing complete capabilities.changed snapshots to match this SDK's wholesale cache replacement. Integrated merge head 099e4e1ec7 is its direct parent and original feature commit 9391d2e781 remains an ancestor, but packages containing only either prior head are insufficient. The Runtime dependency section has been updated.

@SlowGreek

Copy link
Copy Markdown
Author

Runtime release-gate update: exact required head is now 034a636b982daf15340778f0f1b92b9bf30454fc. It hardens local-attach interruption so wider input cannot override the attached session ID and documents complete snapshot/wholesale cache replacement semantics in the Rust source of truth plus regenerated schema/types. c7f1c68d9d is its direct parent; prior heads remain ancestors but are insufficient for package containment. The Runtime dependency section has been updated.

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