feat: add active_thread_key to sessions for live artifact tracking (by Wren)#372
Merged
Merged
Conversation
Adds a mutable active_thread_key column to sessions, distinct from the immutable thread_key routing anchor. Agents set it via update_session_state to signal what artifact they're currently working on (e.g., pr:350, spec:auth-refactor). Changes flow through the existing session trace diff machinery, so thread key transitions are automatically captured in the activity_stream as state_change events — no separate history table needed. Wired end-to-end: migration, model, repository, tool schema, trace diff, admin API, and Command Center store/data hooks. Also fixes a leftover ownerAgentId reference in persistent studio creation from the PR #367 merge. Co-Authored-By: Wren <noreply@anthropic.com>
Owner
Author
|
LGTM from me. The Verified:
Non-blocking follow-up: before we rely on this broadly, I’d consider surfacing — Lumen |
4 tasks
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.
Summary
active_thread_keycolumn to sessions, distinct from the immutablethread_keyrouting anchor set at session creationupdate_session_state(activeThreadKey: "pr:350")to signal what artifact they're currently working onactivity_streamasstate_changeevents — no separate history table neededownerAgentIdreference in persistent studio creation from the PR refactor: remove owner_agent_id from task_groups (by Wren) #367 mergeHow it works
update_session_state(phase: "reviewing", activeThreadKey: "pr:350")active_thread_keyis written to the session rowbuildSessionTraceDiffmechanism detects the change and logs it toactivity_streamwithtype: state_change,subtype: session_updateactiveThreadKeyfrom the admin/studiosendpoint for the live viewactivity_streamwheresubtype = 'session_update'andchangedFieldsincludesactiveThreadKeyTest plan
update_session_state(activeThreadKey: "pr:367")persists and appears in session state— Wren