Repository navigation
AA-153020 [ai-sdk] accept trackSessionEnd in agent.session() options - #157
Merged
Merged
Conversation
Session already honored trackSessionEnd at runtime, and the Codex guide, the CodexSDKTracker JSDoc and amplitude-ai.md pass it, but BoundAgent.session() omitted it from its options type. Type and document it, matching Python's track_session_end, and test that run() calls with trackSessionEnd: false send no Session End until agent.trackSessionEnd. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear AA-153020. Found while working on #156.
Sessionalready honorstrackSessionEnd: false:run()then skips the automatic[Agent] Session End. Several places pass it toagent.session(...):CodexSDKTrackerJSDocamplitude-ai.mdBut
BoundAgent.session()left the option out of its type, so a strict type check rejects those examples. This PR adds the option to the type with a doc comment. Python already acceptsagent.session(track_session_end=False).Runtime behavior is unchanged. This is a type and doc-comment change only, with no new behavior.
Test
New case in
test/bound-agent.test.ts: tworun()calls on sessions withtrackSessionEnd: falsesend no Session End, thenagent.trackSessionEnd(...)sends exactly one.Checks
bound-agent.test.ts(28 tests),tsc --noEmit,check:generatedand lint all pass.Independent of #156; either can merge first.