Skip to content

Add Kotlin to the session rewind page - #2164

Open
happyhuman wants to merge 2 commits into
mainfrom
docs-kotlin-session-rewind
Open

Add Kotlin to the session rewind page#2164
happyhuman wants to merge 2 commits into
mainfrom
docs-kotlin-session-rewind

Conversation

@happyhuman

Copy link
Copy Markdown
Collaborator

What

docs/sessions/session/rewind.md was single-language: one bare Python fenced block, no tab structure, badge div listing Python only. This converts the block into a Python/Kotlin tab group (Python content kept verbatim, only re-indented into the tab), adds the Kotlin badge, and adds a compiled examples/kotlin/snippets/sessions/RewindExample.kt.

Semantics were verified, not assumed

The backlog row asked for this explicitly, and the page makes specific promises. Both check out against the v0.8.0 implementation:

Page says Implementation
"all requests, including rewound requests, are preserved in the log" AbstractRunner.rewindAsync appends a synthetic user-authored event carrying reversing stateDelta / artifactDelta — nothing is deleted
"App-level and user-level state and artifacts are not restored" computeStateDeltaForRewind skips keys prefixed app: / user:

The KDoc also states it mirrors Python's runners.py:rewind_async.

⚠️ One caveat worth a reviewer's eye

Runner.rewindAsync is an interface method whose default implementation throws NotImplementedError — "override to support session rewind". AbstractRunner does override it and InMemoryRunner extends AbstractRunner, so the documented path genuinely works. But anyone implementing Runner directly gets the throwing default. I did not put this in the page, since the page only ever discusses InMemoryRunner; say the word if you'd like it called out.

Also in the row, deliberately excluded

Runner.close was listed alongside rewindAsync. It is a lifecycle concern unrelated to rewinding, so it does not belong on this page.

Verification

Grounded against the v0.8.0 git tag. Full ladder green (L0, L1 compile with KSP, L2 ktlint, L3, L5, L6). L4 runSnippets SKIP — no such Gradle task in this repo.

Tracked as KT-33.

The page was single-language: one bare Python fence, no tab structure,
and a badge div listing Python only. Kotlin has had Runner.rewindAsync
with matching semantics, so the code block is converted into a
Python/Kotlin tab group with the Python content kept verbatim.

Semantics were checked against the implementation rather than inferred
from the method name, since the page makes specific promises. Two hold:
AbstractRunner.rewindAsync appends a synthetic user event carrying
reversing state and artifact deltas, so rewound requests stay in the log
as the "How it works" section describes; and keys prefixed app: or user:
are skipped when the delta is computed, which is exactly the
"Global agent resources" limitation.

Worth knowing for anyone reading the interface: Runner.rewindAsync has a
default implementation that throws NotImplementedError. AbstractRunner
overrides it and InMemoryRunner extends AbstractRunner, so the documented
path works, but a custom Runner built straight on the interface would
not.

Runner.close was on the same backlog row and is left out: it is a
lifecycle concern with nothing to do with rewinding.
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 4b9f27c
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a8745c98771f50008a85ae1
😎 Deploy Preview https://deploy-preview-2164--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@happyhuman happyhuman self-assigned this Aug 20, 2026
The badge said Kotlin v0.8.0, the version adk-docs compiles against,
rather than the introducing release. Checking the tags, rewindAsync is
absent at v0.1.0 and v0.2.0 and first appears in AbstractRunner at
v0.3.0 - so the backlog row that recorded it as a v0.1.0 member was
wrong as well.
@happyhuman

Copy link
Copy Markdown
Collaborator Author

Update: the badge originally read Kotlin v0.8.0 (the version adk-docs compiles against). Corrected to Kotlin v0.3.0, the release rewindAsync actually shipped in — it is absent at v0.1.0 and v0.2.0 and first appears in AbstractRunner at v0.3.0. Note this also means the backlog row recording it as a v0.1.0 member was wrong.

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