Repository navigation
Sessions and agents: catch up with sdk-sessions - #326
igalshilman wants to merge 24 commits into
Conversation
…ts checkpoint goes on from them
…e compiled statements Also 8.7.2: a transaction that changed the schema drops the kept statements when it ends.
…its own, as (no answer)
…TATE_SESSIONS_HEARTBEAT sets the interval
…nts Restate keeps
… result Sessions: ride_commit and flush_riders, internal. A write that rides the next commit of a database, and an urgent one that is written alone once no commit has started within a number of event-loop iterations.
…calls' records are tested at their own level
…kpoint that follows them
There was a problem hiding this comment.
Important
The new heartbeat timer waits a full interval from when a working scope opens, not from the attempt's last write. As a result the silence can now reach almost twice the interval, which could get attempts shut down in deployments that shorten Restate's inactivity timeout. Details inline.
Approach: sound. Each parity item lives where the existing mechanism does: riders in Attempt's transaction path, writes batched inside the checkpointer, and prompt scoping in the calls ledger. Each comes with focused in-process tests.
Reviewed changes
Reviewed every source change and the new and changed tests. I ran the in-process suites for sessions, riders, calls, LangGraph writes, crash and commits: 167 passed.
- Shared core 8.7.3 and
RESTATE_SQL_L0_BYTES:state_options()insrc/sessions.rsreads the L0 share once and passes it to everysql::Database::open. - Heartbeat timer: one
TimerHandlenow serves back-to-backworkingscopes, andRESTATE_SESSIONS_HEARTBEAT(ms) sets the interval. - Riders:
ride_commit/flush_riderslet bookkeeping ride the next commit's transaction. An urgent rider is written on its own afterURGENT_HOPSloop iterations if no commit comes.AttemptDatabase.executeturns into a transaction while a rider is pending. - Call records: that a call answered, and that its record is forgotten, now ride the commit that stores the result. Matching and
outcomesare scoped per prompt viafor_prompt. - LangGraph checkpointer:
aput_writesrows wait as pending, so the nextaputstores them in its own transaction, or they are stored alone after_HOPSiterations. - LangGraph resume:
snapshot.tasksreplacessnapshot.next, so a run whose last step's writes were stored without its checkpoint goes on from those writes. - Blank replies: the built-in LangGraph agent sends blank
AIMessages and empty answers as(no answer).
claude-opus-5-5 | 𝕏
…interval, and once for scopes opened together
There was a problem hiding this comment.
✅ No new issues found. The heartbeat concern from the prior review is fixed and covered by tests.
Reviewed changes
Reviewed the one commit since the prior review, which reworks when the first heartbeat of a run of working scopes is sent. tests/sessions_driver.py -m "not server": 90 passed.
- First beat timed from the last write:
_start_heartbeatsnow arms the first beat for_wrote_at + every, or beats at once if that time has passed. The silence again stays within one interval, as theworkingdocstring promises. - One beat for scopes opened together:
_heartbeatsets_wrote_atafter a successfulact. A scope reopened in the same iteration after a long silence therefore no longer beats a second time. - Tests: added
works_after_silenceplus two tests. One checks that a scope opened part way into a silence beats when the silence reaches the interval. The other checks that scopes opened back to back after a long silence send a single beat.
claude-opus-5-5 | 𝕏

Brings
restate.sessionsandrestate.agentslevel with sdk-sessions (TypeScript), which they follow. Each item below is one commit and stands on its own.Fixes
(no answer).Fewer commits
ride_commit,flush_ridersinrestate.sessions.internal). Only the record of a new call still commits before the call is made, and a transaction under way carries it.aput_writesreturns once its rows are stored.Parity
workingscopes;RESTATE_SESSIONS_HEARTBEATsets the interval.RESTATE_SQL_L0_BYTES.Tests
New tests for each item;
tests/agents_commits.pypins what a turn costs in commits for each framework, with plain tools and with Restate tools, and checks at every commit that no tool result is stored beside a call record that is not marked done.