Skip to content

fix(sdk-js): merge a live UI patch onto the router's base; sample apps name their tools - #2196

Merged
oliverlaz merged 2 commits into
mainfrom
oliver/js-catchup-tool-groups
Nov 23, 2026
Merged

oliverlaz merged 2 commits into
mainfrom
oliver/js-catchup-tool-groups

Conversation

@oliverlaz

Copy link
Copy Markdown
Member

Why

An audit of main against the JS SDK, react_assistant and the React/RN docs found three gaps:

  • Sample sessions are refused. Since Tool groups, call state, stats and app-wide tools #2088 (tool groups, router accelerate-v0.6.365+), a session under an agent config fails with 400 tool_not_configured when it declares a tool that no tools: group names (acceleration/internal/session/manager.go:482). swift_assistant and swift_demo declare no groups. Their apps (iOS, Android, Flutter, React and React Native) all pass their own tools to sessions.create, so every one of those sessions is refused.
  • JS merges live UI patches onto the wrong card. Kotlin fixed this in fix(android): live UI patch bases and call cards with mixed OpenUI and A2UI #2089; JS still had it. Conversation merged a patch onto the latest OpenUI card it held. The router uses the latest card it completed and didn't cut off, whatever its format. So with an A2UI card in between, or after an interrupted reply, the live preview showed a card that Stream Chat's copy then replaced.
  • react_assistant approvals from history are dropped. It answered approvals with session.decide(id) without call, so the SDK leaves an approval shown from history unanswered (after a reload, or one asked on another device). The RN app fixed this in chore(examples): answer approvals with chat.decide in the React Native apps #2007.

Changes

  • Tool groups:
    • swift_assistant/agent.yaml gets a device group: get_local_context, get_location, list_events, add_reminder, send_email, reserve_table.
    • swift_demo/agent.yaml gets a support group: lookup_order, issue_refund.
    • Re-sync with go run ./configure.
  • sdks/js Conversation:
    • Interrupted turns with UI are remembered as cut off.
    • A patch's base is the latest earlier turn whose UI is complete and was not cut off, of any format.
    • When the base isn't OpenUI, the patch turn's UI is cleared, including a preview already merged onto an older card. This mirrors Kotlin's writeUi.
  • react_assistant:
    • Approvals go through chat.decide.
    • Edit and regenerate are on (the transport branches), and stay off for incognito chats.
    • README updated.
  • CHANGELOG: entries for both fixes.

Validation

  • sdks/js: npm test passes, 801/801.
    • New test: a patch after an interrupted reply merges onto the card before it.
    • New test: an A2UI card that completes late drops the patch's merged preview.
    • Both fail on main and pass with this change.
  • react_assistant:
    • npm run typecheck, vitest run (50/50) and vite build pass.
    • The test that pinned "edits off" is replaced by one test for each case (normal and incognito).
  • Tool groups: both agent folders load with the Go SDK's agents.Load, which reads the new tools groups. Not run against a live router.

…s name their tools

- Conversation merges an OpenUI patch onto the latest earlier card that
  completed and was not interrupted, whatever its format, as the router and
  Kotlin (#2089) do. A patch whose base is not OpenUI shows no UI.
- swift_assistant and swift_demo agent.yaml name the apps' session tools in
  a tool group, which the router requires since #2088.
- react_assistant answers approvals with chat.decide, so a call shown from
  history is answered, and offers edit/regenerate outside incognito.
@oliverlaz
oliverlaz merged commit 51abc67 into main Nov 23, 2026
7 checks passed
@oliverlaz
oliverlaz deleted the oliver/js-catchup-tool-groups branch November 23, 2026 13:13
oliverlaz added a commit that referenced this pull request Nov 23, 2026
…or (#2210)

## Why
`Agent.Sync` skips a directory whose `.agent_sync` stamp matches the
folder's hash, but the stamp doesn't record which router it was written
for. Syncing `examples/voice_agents/swift_assistant` to a local router
and then to the hosted one (`go run ./configure` with a different
`STREAM_ACCELERATION_URL`) printed success and sent nothing. The hosted
config kept `tools: []`, so every sample-app session there failed with
`400 tool_not_configured` until `.agent_sync` was deleted by hand. The
JS SDK already guards against this: it trusts a matching stamp only when
the stored config's `sync_hash` matches too.

## Changes
- `sdks/go/agents/config.go`: when the stamp matches, the stored config
must also carry the same `sync_hash`. Otherwise the folder is synced.
- `agent_test.go`: the fake router now records `sync_hash` on sync, as
the real one does (`acceleration/internal/api/sync.go`).
- `CHANGELOG.md` bug-fix entry.
- `.claude/skills/sdk/SKILL.md`: a note for Python, .NET, Ruby, Rust and
PHP to check their stamp logic.

## Validation
- New test
`TestAnUnchangedDirectoryIsSyncedToARouterItWasNeverSyncedTo`: sync to
router A, then the same folder to router B. B must get the sync, and
must not get it again on a third run. It fails on main ("the router that
never had the directory got 0 syncs") and passes with this change.
- `go test ./...` and `go vet ./...` in `sdks/go` pass.
- Found while verifying #2196 against the hosted router.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants