Skip to content

Commit c58e2f2

Browse files
tclemCopilot
andcommitted
Fix SessionUi::elicitation wire field name
The hand-authored `SessionUi::elicitation` convenience layer was sending the JSON Schema payload as `"schema"` on the wire, but the `session.ui.elicitation` request shape expects `"requestedSchema"`. This is the field name in: - this crate's own generated UIElicitationRequest type (rust/src/generated/api_types.rs:1721, serde renames to `requestedSchema` via #[serde(rename_all = "camelCase")]) - the generated typed RPC wrapper SessionRpcUi::elicitation (rust/src/generated/rpc.rs:1245-1257), which is correct - and the same wire field used by every other SDK we ship So every elicitation call from the SessionUi convenience layer was effectively dead — the CLI saw a missing required `requestedSchema` field. The `confirm` / `select` / `input` helpers all delegate to `elicitation`, so they were dead too. The mock-server test for elicitation round-tripped through the same misnamed field on both ends, so the bug slipped past unit tests (`assert_eq!(request["params"]["schema"], schema)` matched the buggy implementation). The fix is a one-line rename in session.rs plus a test update that now asserts on `requestedSchema` and explicitly rejects a stray `schema` key, so we can't regress the same way. 207 tests pass. doc / clippy / fmt clean. Caught by the gap-analysis re-run before 0.1.0 cut. Wire-shape divergence between hand-authored and generated layers — same class of bug as the workspace RPC fix earlier in this stack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 85483d5 commit c58e2f2

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

rust/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,19 @@ public surface.
315315
`lifecycle_observer`.
316316
- `RELEASING.md` operational runbook for maintainers.
317317

318+
### Fixed
319+
- `SessionUi::elicitation` (and the `confirm` / `select` / `input`
320+
convenience helpers that delegate through it) now sends the user-supplied
321+
JSON Schema as `requestedSchema` on the wire, matching the
322+
`session.ui.elicitation` request shape that all other SDKs ship and that
323+
this crate's own generated `UIElicitationRequest` type expects. The
324+
hand-authored convenience layer was sending it as `schema`, so every UI
325+
helper call was effectively dead — the CLI saw a missing required
326+
`requestedSchema` field. The mock-server test for elicitation
327+
round-tripped through the same misnamed field, so the bug slipped past
328+
unit tests; the test now asserts on `requestedSchema` and explicitly
329+
rejects a stray `schema` key.
330+
318331
### Notes
319332
- Minimum supported Rust version (MSRV): 1.94.0 (pinned via
320333
`rust-toolchain.toml`).

rust/src/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ impl<'a> SessionUi<'a> {
593593
Some(serde_json::json!({
594594
"sessionId": self.session.id,
595595
"message": message,
596-
"schema": schema,
596+
"requestedSchema": schema,
597597
})),
598598
)
599599
.await?;

rust/tests/session_test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,11 @@ async fn elicitation_returns_typed_result() {
12441244
let request = server.read_request().await;
12451245
assert_eq!(request["method"], "session.ui.elicitation");
12461246
assert_eq!(request["params"]["message"], "Enter your name");
1247-
assert_eq!(request["params"]["schema"], schema);
1247+
assert_eq!(request["params"]["requestedSchema"], schema);
1248+
assert!(
1249+
request["params"].get("schema").is_none(),
1250+
"wire field is `requestedSchema`, not `schema`"
1251+
);
12481252
server
12491253
.respond(
12501254
&request,

0 commit comments

Comments
 (0)