Skip to content

fix: treat an empty send model as absent for schema-materializing models - #1

Open
yexisu wants to merge 1 commit into
vastsa:mainfrom
yexisu:fix/send-empty-model
Open

yexisu wants to merge 1 commit into
vastsa:mainfrom
yexisu:fix/send-empty-model

Conversation

@yexisu

@yexisu yexisu commented Oct 4, 2026

Copy link
Copy Markdown

Fixes the send-half of vastsa/PI-Desktop#978 (empty-value materialization of the SessionTask schema).

Problem

The send guard is presence-based: args.model !== undefined rejects with INVALID_ARGUMENT. Some provider/model pairings materialize every schema key with empty values, so a send that was meant to omit model still carried "model":"" and was rejected — 36 of 38 send calls on the reported pairing.

Fix

spawn already treats "" as absent via optionalText (models.js). The send guard now matches that semantics: only a non-empty model conflicts with the session's existing model. A real reselection attempt is still rejected, unchanged.

Tests

  • Extended any existing session supports bidirectional messages without reselecting models: a send with model: "" succeeds and the session keeps its existing model; a non-empty model still rejects with INVALID_ARGUMENT.
  • node --test test/: 39/39 passed.

Some providers materialize every SessionTask schema key with empty
values, so send carried "model":"" even when the assistant intended to
omit it. The presence-based guard rejected those deliveries with
INVALID_ARGUMENT — 36 of 38 send calls on one provider/model pairing
(vastsa/PI-Desktop#978). spawn already treats "" as absent via
optionalText; the send guard now matches that semantics. A non-empty
model still conflicts with the session's model.
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.

1 participant