Skip to content

Add trusted-answer callback correlation to Rust SDK - #2847

Closed
szabta89 wants to merge 1 commit into
mainfrom
szabta89-friendly-garbanzo
Closed

szabta89 wants to merge 1 commit into
mainfrom
szabta89-friendly-garbanzo

Conversation

@szabta89

Copy link
Copy Markdown
Contributor

Summary

  • pass runtime-owned requestId values through Rust user-input and exit-plan-mode handlers as typed RequestIds
  • expose the three trusted human UI response producers through the Rust generator while keeping sessionId SDK-owned
  • add focused parser, dispatch, callback-correlation, and missing-request-ID coverage

Protocol dependency

This SDK change depends on the runtime trusted-authority commits a7b5af197e78cbc303000cf7cd4cd15daf043c8e and 9a83946b9aeb07aa83d78bf3db82e3041cc09415. No associated runtime PR URL was discoverable.

Testing

  • npm --prefix scripts/codegen run generate:rust
  • cargo test --manifest-path rust/Cargo.toml --features test-support --test session_test trusted_human_ui_methods_preserve_callback_correlation -- --exact
  • cargo test --manifest-path rust/Cargo.toml --features test-support --test session_test user_input_request_dispatches_to_handler -- --exact
  • cargo test --manifest-path rust/Cargo.toml --features test-support --test session_test exit_plan_mode_request_dispatches_to_handler -- --exact
  • cargo test --manifest-path rust/Cargo.toml --features test-support --test session_test reverse_ui_requests_require_runtime_request_id -- --exact
  • cargo check --manifest-path rust/Cargo.toml --lib --examples --features test-support -j 1
  • cargo check --manifest-path rust/Cargo.toml --test e2e --features test-support -j 1

Pass runtime request IDs through user-input and exit-plan handlers and expose the typed trusted human response producers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI max review requested due to automatic review settings October 15, 2026 18:37
@szabta89
szabta89 requested a review from a team as a code owner October 15, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The dependent runtime authority changes remain unverified, and runtime compatibility needs human validation.

2 open findings
What changed in this PR

Adds runtime-owned request correlation to Rust SDK callbacks and trusted-human response APIs.

Changes:

  • Pass typed RequestId values to user-input and plan-exit handlers.
  • Expose three trusted-human response methods while keeping session IDs SDK-owned.
  • Expand callback tests and update handler implementations.
File Description
scripts/​codegen/​rust.ts Allowlist public trusted-human methods.
rust/​tests/​session_test.rs Test correlation, dispatch, and missing IDs.
rust/​tests/​e2e/​mode_handlers.rs Adapt the plan-exit handler signature.
rust/​tests/​e2e/​ask_user.rs Record and check callback IDs.
rust/​src/​session.rs Validate and forward runtime request IDs.
rust/​src/​handler.rs Add request IDs to two handler traits.
rust/​src/​generated/​rpc.rs Expose three trusted-human response methods.
rust/​examples/​chat.rs Adapt the stdin handler signature.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread rust/src/handler.rs
async fn handle(
&self,
session_id: SessionId,
request_id: RequestId,
Comment thread rust/src/session.rs

"userInput.request" => {
let params = request.params.as_ref();
let Some(callback_request_id) = params.and_then(extract_request_id) else {
@szabta89 szabta89 closed this Oct 16, 2026
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