Skip to content

AI-3201: port #2037 to main (keep tool_timeout_ms and declared tools when a session is reopened) - #2046

Merged
kanat merged 2 commits into
mainfrom
kanatkiialbaev/ai-3201-port-2037-to-main
Nov 17, 2026
Merged

kanat merged 2 commits into
mainfrom
kanatkiialbaev/ai-3201-port-2037-to-main

Conversation

@kanat

@kanat kanat commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Ports #2037 (AI-3201) to main.

#2037 merged into accelerate after accelerate was merged into main (#2030). Staging runs accelerate-v0.6.354, which was built from accelerate. Without this port, the next staging deploy from main drops #2037.

accelerate ──●── #2037 ──► v0.6.354 (staging now)
main       ──●── #2036, #2039, … (15 commits)   ← this PR adds #2037
Check Result
git cherry-pick -x b2334add3 on origin/main clean, no conflicts
go build ./..., go vet on touched packages ok
go run ./cmd/openapi no diff
npm run types -- --check (sdks/js) in step with the spec
go test ./internal/session/ ./internal/conversation/ ok
Migration 20270101090000 newest on main (20261231090000 before it); already applied on staging by v0.6.354

The code is #2037 unchanged; it was reviewed and merged there.

Merge with main (df06a47)

main gained #2044 (session tools), which touches the same code:

File Resolution
api/sessions.go declaredTools now maps toolOf, #2044's helper for one tool
session/records.go, records_test.go the recorder keeps both ToolTimeout and Offered
session/tools.go git merged it with no conflict, but bridge.Run unlocked twice and panicked; kept main's single unlock (#2044 holds the lock over both reads)
sdks/swift/core/generated.json regenerated at its pinned generator commit; --check passes

go test -race for session and conversation passes, and so do the integration suites for internal/api, internal/session/... and internal/store.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SWVEMob5wtaNHdUCC1msgG

…opened (#2037)

## Why

This is the last open item on AI-3201. #2004 gave `fork()` a
`tool_timeout_ms` and left this open: a text conversation reopened from
its row (`reopenedFromRow`) lost the caller's `tool_timeout_ms` and the
tools it declared. The row kept neither. A conversation that ended in
another router process, or was stopped, therefore came back waiting 30
s, and its model was offered none of the caller's tools.
`sessions.resume()` sent nothing to the router (JS and Go did a `GET`,
then opened the events socket), so a caller had no way to put them back.

## How it works

```
session row (agent_sessions)
 +- tool_timeout_ms  INTEGER  NULL = default 30 s
 +- caller_tools     JSONB    NULL = none declared (definitions only)
    written by sessionRow on every open / reopen (ON CONFLICT updates both)

carry a conversation on (message, events socket, voice, rewind, resume)
 +- ended, row path        -> row's timeout + tools, then resume's over them
 +- ended, in this process -> its spec's (Written), then resume's over them
 +- still running          -> resume's timeout applied at once (bridge + row),
 |                            tools kept until it ends and is carried on
 +- lost the reopen race   -> resume's timeout applied to the winner,
                              its tools are the winner's

POST /v1/agents/sessions/{id}/resume  { tool_timeout_ms?, tools? }
 +- tool_timeout_ms given  -> wins over the stored one
 +- tools given            -> the caller's win; [] offers none
 +- omitted                -> what it ran with
 +- cannot be carried on   -> answered as getSession (a call with no conversation)

fork(tool_timeout_ms?)     -> unchanged: given wins, else a running parent's,
                              else 30 s (an ended parent's stored one is not read)
```

**Why a `POST .../resume` endpoint.** No request that reopens a
conversation carries tool definitions: the events socket's `tools=` is
names only, and `respond`, `responses`, `rewind` and voice take none.
The socket could carry a timeout in its query, but not tool schemas, and
`resume(id, { watch: false })` opens no socket. So `resume` became a
request with a body, shaped like `fork`: same field names,
`tool_timeout_ms` and `SessionTool[]` as on `createSession`, answered
with the `Session`. The SDKs send it only when they have something to
say. Otherwise they `GET` as before, so a session that cannot be carried
on is still read.

| Change | Result | Test |
| --- | --- | --- |
| Migration `20270101090000_agent_sessions_caller_tools.sql`: two
nullable columns, no default, `lock_timeout 5s`, `ADD COLUMN IF NOT
EXISTS` (the `calls_agent_user_id` pattern) | No row rewritten; a lock
waits at most 5 s | `TestStoreSuite` migrates it |
| `sessionRow` writes both; `SaveSession` updates both on conflict
(`store/sessions.go:103`) | A reopen's row holds what it reopened with |
`TestASessionSavedAgainKeepsTheToolSettingsItWasSavedWithLast`,
`TestASessionSavedWithoutToolSettingsKeepsNone` |
| `reopenedFromRow` restores them (`api/sessions.go:690`) | Carried on
from the row as from the process that held it |
`TestAConversationCarriedOnFromItsRowKeepsItsToolTimeoutAndTools`,
`TestAResumeWithNothingToSayCarriesItOnWithWhatItRanWith` |
| `resumeSession` + `resumed.over` (`:79`, `:583`, `:630`) | The
resume's timeout and tools win |
`TestAResumesToolTimeoutWinsOverTheOneItRanWith`,
`TestAResumesToolsWinOverTheOnesItWasOpenedWith`,
`TestAResumeWithNoToolsOffersNone` |
| `Session.SetToolTimeout` (`session.go:1030`), `bridge.setTimeout` (the
read in `Run` moved under `b.mu`), row write queued on the recorder
behind the session's own row (`records.go:184`) | A running session
waits as the resume says, and keeps it once it ends |
`TestAResumedRunningSessionWaitsForItsToolsAsLongAsTheResumeSays`,
`TestARunningSessionsResumedToolTimeoutOutlivesItsEnding`,
`TestARunningSessionsNewToolTimeoutIsKept` |
| A running session's tools are not replaced | As documented |
`TestAResumedRunningSessionKeepsTheToolsItRunsWith` |
| `declaredTools` pulled out of `specOf` | create and resume read
`SessionTool` the same way | existing `SessionToolsSuite` |
| Fork untouched; its field's description drops "since its row does not
keep one" | An ended parent's fork still has 30 s |
`TestAForkOfAnEndedSessionStillHasTheDefaultToolTimeout`, #2004's fork
tests |
| Who may resume: the owner, as `getSession` | Another user and another
app get 404 | `TestOnlyItsOwnerResumesASession`; `posture_test.go`
covers it from the spec (`x-client-accessible`) |
| JS `sessions.resume(id, { tool_timeout_ms, tools })` (`ResumeOptions`,
exported); `agent.resume` passes its `tools` | POSTs only with a timeout
or declared tools | resource.test.ts "resumes with a tool timeout and
its tools...", "...only a tool timeout...", and the existing resume test
asserts no POST |
| Go `client.Sessions.Resume(ctx, id, ...ResumeOptions)`,
`agents.Sessions.Resume` likewise, both through `stream.Pipeline.Resume`
| Source compatible (variadic, as `agents.Join`); under 1 ms is not
sent, as on fork | `TestAResumesToolTimeoutGoesOverInMilliseconds`,
`TestAResumeDeclaresTheAgentsFunctions`,
`TestAResumeWithNothingToSayReadsTheConversationAsItIs` |
| Regenerated Go, JS, Python, Swift, Kotlin, .NET, PHP, Ruby, Rust | No
drift; Swift `generated.json`'s `generator` unchanged (`a73c9124e8`, the
same `chat` commit) | generator checks |

## Behaviour to know about

- **Deploy order.** The router has to be deployed before the JS and Go
SDKs are released. A JS or Go `resume` that sends `POST .../resume` to
an older router gets a 404.
- **Client wins, within one caller kind.** A resume carrying tools
replaces the declared ones, and an empty list offers none. A JS or Go
`resume` with no functions registered sends no `tools`, so the stored
ones stay for whichever watcher runs them. A JS `resume(id, { watch:
false })` declares no tools, because nothing in that process runs them.
It then reads the session as it is unless a `tool_timeout_ms` is given.
- **Caller kind.** The row's `caller_kind` is the opener's, and a reopen
does not change it.
- Stored tools are restored only for a reopener of that kind
(`reopenedFromRow`). Otherwise a backend's tool carried on by its user's
device would be the device's to answer (`seat.go` `seatRuns`).
- The upsert (`store/sessions.go` `SaveSession`) and the running-session
write (`SetSessionToolTimeout`) change `tool_timeout_ms` and
`caller_tools` only for that kind. A device carrying on its backend's
conversation, by a resume, a message or the events socket, neither
clears the backend's tools nor writes its own over them.
- What a device says runs in the session it reopens and is never written
to the row. A running session's timeout is changed only by the kind of
caller that opened it.
- Tests:
`TestADeviceCarryingOnItsBackendsConversationLeavesTheBackendItsTools`,
`TestADeviceDoesNotSetTheToolsOrTimeoutItsBackendCarriesOnWith`,
`TestABackendsToolsAreNotCarriedOnByItsUsersDevice`,
`TestADeviceDoesNotChangeHowLongItsBackendsToolsAreWaitedFor`,
`TestAnotherKindOfCaller...` (store).
- **Reopen races.** Requests that carry one ended conversation on at the
same time all succeed now. Before, the losers met the winner on the
conversation and got a 400 "conversation is already open". Two browser
tabs, or React StrictMode, would have thrown. A loser now waits up to 3
s for the winner to be held (`carriedOnBy`) and answers with it. The
resume's timeout goes to the winner if the caller kind matches; its
tools do not. A conversation open under another id still gets the 400, 3
s later. A loser fails before it queues a row, so no stale row is
written. `TestResumesOfAnEndedSessionAtOnceAllCarryItOn` checks that
every request gets a 200 and that the row matches the running spec.
- **Row lag.** `reopenedFromRow` flushes this process's recorder before
it reads the row, so a timeout given just before the session ended is
not reverted
(`TestAReopenReadsTheTimeoutAResumeGaveJustBeforeTheSessionEnded`, using
a trigger that holds the write for 1 s). The flush covers only this
process. If the session ended on another router whose write has not
landed yet, the reopen reads the older value. Title and description have
the same window today, which is why I documented it instead of fixing
it.
- **Running sessions.** A resume of a running session takes
`tool_timeout_ms` and returns 200, but it does not offer its `tools` to
the model. The endpoint and the SDK docs say so. `SetToolTimeout` sets
the spec, the bridge and the queued row write in one section under
`labelMu`.
- **Restored tools with nobody to run them.** A reopen with no watcher
(HTTP `respond`, a scheduled task's delivery) offers the caller's tools,
as a reopen in the same process already did. A call fails at once with
"nobody is connected to run it" (`askTool`).
- **JS `agent.resume`** passes the agent's tools, so an agent with
functions now POSTs `resume`. A refusal other than not-found (for
example 402, or a deleted config) is now thrown, where the old `GET`
read the ended row.
- Go's `ResumeOptions.ToolTimeout` of zero keeps the current value, as
`ForkOptions.ToolTimeout` does. JS `tool_timeout_ms: 0` means 30 s, as
on fork.
- `ResumeSessionRequest.tool_timeout_ms` has `minimum: 0`;
`createSession` and `fork` do not.

## Validation

- `go test -tags integration ./internal/api` (all suites, `-parallel
10`, own Postgres 16 and Redis 7 containers): ok, 217 s.
`TestSessionReopenSettingsSuite` also ran with `-race`: ok.
- `go test -tags integration ./internal/store`: ok. `go test
./internal/...` and `GOEXPERIMENT=simd go vet ./...`: ok.
- Second review round (caller kind, losers, flush, unwatched JS): each
fix's tests fail without it, namely the kind-blind upsert (2 api tests
and 1 store test), the kind-blind running-session write (1 store test),
losers not answered (the race test), no flush (the row-lag test) and JS
declaring tools when unwatched. Fable's probe suite passes with `-race`.
- **Mutation checks** (each line removed, the named tests fail): the
restore in `reopenedFromRow` fails 3; `over.over(&spec)` fails 3;
`Set("tool_timeout_ms = EXCLUDED...")` fails the resume-wins test;
`Set("caller_tools = EXCLUDED...")` fails the store test; `over.onto` on
a running session fails 2; the recorder `ToolTimeout` write fails the
outlives-its-ending test. JS: forcing `GET` fails both new tests. Go:
forcing `GET` fails both POST tests.
- `cd sdks/go && go test ./...`: ok. `cd sdks/js && npm test` (Node 22):
665 passed. `npm run types -- --check`: in step.
- Regenerated with each SDK skill's command: Kotlin `generate.py`, Dart
`tool/generate.dart` (Flutter 3.44 container, no change), .NET
`tools/Generate`, PHP `bin/generate.php`, Ruby `script/generate` and
Rust `generate`, all in Docker. Swift via `generate.py` against the
`chat` generator. Python via `plugins/stream/generate.py`.
- Not run locally: `dev.py check` (only generated Python changed), and
the Dart, Kotlin, PHP, Ruby, Rust and .NET `--check` and test modes. CI
runs them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Laurent Schaffner <laurentschaffner@Laurents-MacBook-Pro-Stream.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit b2334ad)
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The change stores session tool timeouts and caller-declared tools for use when a session is reopened. It adds a resume endpoint with optional timeout and tool overrides, and defines behavior for running sessions, caller types, and concurrent resumes. Go, JavaScript, and Rust SDKs add resume support. Tests and documentation cover the server behavior and SDK requests.

Merge Risk: Moderate · up to df06a

Reopened sessions can restore tool declarations that the caller changed or removed at runtime. A resume that races with another reopen can succeed without applying its timeout, and a backend's tools may carry over to a device caller on one reopen path. Fix these before merging; the migration rollback and timeout range issues are lower-risk follow-ups.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

sdks/go/acceleration/generated.go

ast-grep timed out on this file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (2)

Major · Clear inherited tools when the resuming caller kind differs. · sessions.go:615

acceleration/internal/api/sessions.go:615
Major · Security & Privacy · Quick win

Clear inherited tools when the resuming caller kind differs.

The ended-session branch keeps the spec's Tools through Written() and does not compare the original CallerKind with the resuming caller. A backend-declared tool can therefore be inherited by a device caller. seatRuns then lets the device's own seat run it, although its comment says only a backend runs a backend-declared tool. reopenedFromRow already applies this kind check, so this branch should match it.

Suggested fix

 		spec = found.Spec().Written()
+		if found.Spec().CallerKind != KindFrom(ctx) {
+			spec.Tools = nil
+		}
Minor · Handle a running winner found during row reconstruction. · sessions.go:692-693

acceleration/internal/api/sessions.go:692-693
Minor · Functional Correctness · Quick win

Handle a running winner found during row reconstruction.

If another request publishes the reopened session after the first lookup, storedOrLiveSession returns Live. This guard returns errUnknownSession before the Create-race recovery runs. The new resume handler then returns HTTP 200 through getSession, but drops the requested timeout.

Return the running session through carryOn and apply over.onto on this path.

Nitpick comments: 1

sdks/go/client/client_test.go: 1

1802-1802: Trivial · Maintainability & Code Quality · Quick win

Group the new resume tests in a testify suite.

The three new tests are standalone functions and repeat router setup. Put them in one suite with shared setup. Keep the existing wire assertions.

As per coding guidelines, “Group tests in a testify suite (suite.Suite). Shared setup lives in the suite, in one place.”

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between aae632c and 7a93bb0.

Files ignored due to path filters: 10

  • plugins/stream/vision_agents/plugins/stream/_generated/api/default/resume_session.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/__init__.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/fork_session_request.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/resume_session_request.py is excluded by !**/_generated/**
  • sdks/dotnet/src/GetStream.VisionAgents/Generated/Models.cs is excluded by !**/generated/**
  • sdks/js/src/generated/api.ts is excluded by !**/generated/**
  • sdks/kotlin/core/src/main/kotlin/io/getstream/agents/android/core/generated/ForkSessionRequest.kt is excluded by !**/generated/**
  • sdks/php/src/Generated/ResumeSessionRequest.php is excluded by !**/generated/**
  • sdks/ruby/lib/getstream/vision_agents/generated/spec.rb is excluded by !**/generated/**
  • sdks/swift/core/Sources/StreamAgents/Generated/Models/ForkSessionRequest.swift is excluded by !**/generated/**
Files selected for processing: 29

  • .claude/skills/sdk/SKILL.md
  • CHANGELOG.md
  • acceleration/README.md
  • acceleration/api/openapi.yaml
  • acceleration/internal/api/scheduled_delivery.go
  • acceleration/internal/api/session_reopen_settings_test.go
  • acceleration/internal/api/sessions.go
  • acceleration/internal/conversation/conversation.go
  • acceleration/internal/session/records.go
  • acceleration/internal/session/records_test.go
  • acceleration/internal/session/session.go
  • acceleration/internal/session/tools.go
  • acceleration/internal/store/models.go
  • acceleration/internal/store/sessions.go
  • acceleration/internal/store/sessions_test.go
  • acceleration/migrations/20270101090000_agent_sessions_caller_tools.sql
  • sdks/go/acceleration/generated.go
  • sdks/go/agents/agent.go
  • sdks/go/client/client_test.go
  • sdks/go/client/sessions.go
  • sdks/go/stream/accelerated.go
  • sdks/js/src/agent.ts
  • sdks/js/src/index.ts
  • sdks/js/src/session.ts
  • sdks/js/src/sessions.ts
  • sdks/js/tests/resource.test.ts
  • sdks/rust/src/operations.rs
  • sdks/rust/src/types.rs
  • sdks/swift/core/generated.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.


// harnessTools is declared as the session's model is offered it.
func (s *SessionReopenSettingsSuite) harnessTools(name string) []harness.Tool {
return declaredTools(*s.declared(name))

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.

Trivial · Maintainability & Code Quality · Quick win

Build expected tools independently of declaredTools.

The request path and this expected-value helper use the same converter. If declaredTools drops Approval, Client, or another field, both sides lose that field and the comparisons still pass.

Construct the expected harness.Tool explicitly, or assert its fields independently. As per path instructions, flag “tests that would still pass on a broken implementation.”

Source: Path instructions

BEGIN
SET LOCAL lock_timeout = '5s';
ALTER TABLE agent_sessions
ADD COLUMN IF NOT EXISTS tool_timeout_ms INTEGER,

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.

Minor · Data Integrity & Integration · Quick win

Bound tool_timeout_ms to the INTEGER range on session requests.

The tool_timeout_ms fields on create, resume, and fork accept any non-negative int. The tool_timeout_ms column is INTEGER, which stops at 2147483647. A value above that limit can pass validation and then fail the persisted write. The session row then cannot retain the setting it accepted.

Add the same upper bound to each session-level field. The migration has already run on staging, so the API bound is the change to make.

Suggested fix

--- a/acceleration/internal/api/schemas.go
+++ b/acceleration/internal/api/schemas.go
@@ -295 +295 @@
-	ToolTimeoutMs        *int               `json:"tool_timeout_ms,omitempty" doc:"How long the model waits for the result of a tool the caller or a worker runs, in milliseconds. Zero or omitted is 30 seconds. A tool's own timeout_ms replaces it for that tool, which is how one slow tool, such as one that draws a picture, gets longer without every tool waiting as long."`
+	ToolTimeoutMs        *int               `json:"tool_timeout_ms,omitempty" minimum:"0" maximum:"2147483647" doc:"How long the model waits for the result of a tool the caller or a worker runs, in milliseconds. Zero or omitted is 30 seconds. A tool's own timeout_ms replaces it for that tool, which is how one slow tool, such as one that draws a picture, gets longer without every tool waiting as long."`
--- a/acceleration/internal/api/sessions.go
+++ b/acceleration/internal/api/sessions.go
@@ -1642 +1642 @@
-	ToolTimeoutMs   *int                    `json:"tool_timeout_ms,omitempty" doc:"How long the fork's model waits for the result of a tool the caller or a worker runs, in milliseconds, as on createSession. Omitted keeps a running parent's; a fork of a conversation that ended has 30 seconds. Zero is 30 seconds, as on createSession."`
+	ToolTimeoutMs   *int                    `json:"tool_timeout_ms,omitempty" minimum:"0" maximum:"2147483647" doc:"How long the fork's model waits for the result of a tool the caller or a worker runs, in milliseconds, as on createSession. Omitted keeps a running parent's; a fork of a conversation that ended has 30 seconds. Zero is 30 seconds, as on createSession."`
@@ -1658 +1658 @@
-	ToolTimeoutMs *int           `json:"tool_timeout_ms,omitempty" minimum:"0" doc:"How long the model waits for the result of a tool the caller or a worker runs, in milliseconds, as on createSession, in place of what the conversation ran with. Omitted keeps that, which a conversation that ended keeps too. Zero is 30 seconds."`
+	ToolTimeoutMs *int           `json:"tool_timeout_ms,omitempty" minimum:"0" maximum:"2147483647" doc:"How long the model waits for the result of a tool the caller or a worker runs, in milliseconds, as on createSession, in place of what the conversation ran with. Omitted keeps that, which a conversation that ended keeps too. Zero is 30 seconds."`

After this change, regenerate the OpenAPI spec with go run ./cmd/openapi and regenerate the JavaScript types so the committed spec matches the Go structs.

Comment on lines +27 to +28
DROP COLUMN IF EXISTS caller_tools,
DROP COLUMN IF EXISTS tool_timeout_ms;

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.

Major · Data Integrity & Integration · Quick win

Preserve stored settings during rollback.

After sessions use these columns, Down deletes every stored caller-tool declaration and timeout. Reapplying Up recreates empty columns; it cannot restore the settings. Keep the columns during rollback, or preserve their values before removal. (raw.githubusercontent.com)

As per coding guidelines, flag “a down migration that loses data.”

Source: Coding guidelines

Conflicts with #2044 (session tools), resolved keeping both:
- api/sessions.go: declaredTools maps toolOf, main's helper for one tool.
- session/records.go and records_test.go: the recorder keeps ToolTimeout and Offered.
- swift generated.json: regenerated at its pinned generator commit.

session/tools.go merged without a conflict but unlocked twice in bridge.Run:
#2037 unlocked after reading timeout, and main already holds the lock over both reads.
Kept main's version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SWVEMob5wtaNHdUCC1msgG

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7a93bb0 and df06a47.

Files ignored due to path filters: 10

  • plugins/stream/vision_agents/plugins/stream/_generated/api/default/resume_session.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/__init__.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/fork_session_request.py is excluded by !**/_generated/**
  • plugins/stream/vision_agents/plugins/stream/_generated/models/resume_session_request.py is excluded by !**/_generated/**
  • sdks/dotnet/src/GetStream.VisionAgents/Generated/Models.cs is excluded by !**/generated/**
  • sdks/js/src/generated/api.ts is excluded by !**/generated/**
  • sdks/kotlin/core/src/main/kotlin/io/getstream/agents/android/core/generated/ForkSessionRequest.kt is excluded by !**/generated/**
  • sdks/php/src/Generated/ResumeSessionRequest.php is excluded by !**/generated/**
  • sdks/ruby/lib/getstream/vision_agents/generated/spec.rb is excluded by !**/generated/**
  • sdks/swift/core/Sources/StreamAgents/Generated/Models/ForkSessionRequest.swift is excluded by !**/generated/**
Files selected for processing: 11

  • CHANGELOG.md
  • acceleration/api/openapi.yaml
  • acceleration/internal/api/sessions.go
  • acceleration/internal/session/records.go
  • acceleration/internal/session/records_test.go
  • acceleration/internal/session/session.go
  • acceleration/internal/session/tools.go
  • sdks/go/acceleration/generated.go
  • sdks/go/stream/accelerated.go
  • sdks/rust/src/types.rs
  • sdks/swift/core/generated.json

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

ResumeHistory: spec.ResumeHistory,
FloorControl: spec.FloorControl,
ToolTimeoutMs: spec.ToolTimeoutMs,
CallerTools: StoredTools(spec.Tools),

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.

Major · Data Integrity & Integration · Heavy lift

Persist caller-tool changes to caller_tools, not only to the offered-tool records.

AddTools and RemoveTool change spec.Tools and write only agent_session_tools through records.Offered. The caller_tools column is written only by SaveSession, and sessionRow snapshots it once, at open. A cross-process reopen reads that column (api/sessions.go:725), so it restores the original declarations. After AddTools adds B and RemoveTool removes A, the reopened session declares A and loses B.

Record the current caller declarations whenever changeTools succeeds. Add a store update for caller_tools keyed by id and caller_kind, following the pattern of SetSessionToolTimeout. Queue it through the recorder so it keeps the existing bounded write context.

@kanat
kanat merged commit 73e1d8b into main Nov 17, 2026
64 checks passed
@kanat
kanat deleted the kanatkiialbaev/ai-3201-port-2037-to-main branch November 17, 2026 13:40
aleksandar-apostolov added a commit that referenced this pull request Nov 18, 2026
Closes
[AND-1971](https://linear.app/stream/issue/AND-1971/stream-agents-kotlin-070-release-live-ui-session-tools-and-filters)

## Why
Ships to Kotlin what merged since 0.5.0: live generative UI (#2054),
session tools (#2050), session filters (#2001), regenerate and edit with
branches (#1983), rewind (#2012), and `tool_timeout_ms` on fork and
resume (#2004, #2046). 0.7.0 matches the repo release; Dart's
`stream_agents` shipped 0.7.0 in #2052.

`Conversation` is no longer a data class, so Java loses its no-argument
constructor (see CHANGELOG).

## Changes
- `sdks/kotlin/gradle.properties`: `version=0.7.0`.

Merging this publishes `io.getstream:stream-agents-android-core:0.7.0`
to `https://stream-io-repo.com` and tags the commit `sdk-kotlin-v0.7.0`.
It is the first Kotlin release from `main` (#2062).

## Validation
- The `Check the version` job on this pull request: the branch matches
`version`, and 0.7.0 is newer than `sdk-kotlin-v0.5.0` and not yet
published.
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