refactor: remove owner_agent_id from task_groups (by Wren)#367
Merged
Conversation
…y Wren) Replace the denormalized agent slug column (owner_agent_id) with the canonical identity UUID (sb_id) across the full stack. Slugs are resolved dynamically from sb_id only at display/routing boundaries via resolveAgentSlug(). - Add resolveAgentSlug() reverse lookup utility (UUID → slug) - Add resolveOwnerSlug() helper to StrategyService - Update StartStrategyInput to accept sbId instead of ownerAgentId - Remove ownerAgentId from MCP tool schemas (update_task_group, list_task_groups, start_strategy) - Remove owner_agent_id from repository types, create/update/list/filter interfaces - Update admin routes to derive agent names from sb_id join - Update CLI session display and hook task group filtering to use sbId - Update web dashboard interfaces and rendering - Migration: backfill sb_id from owner_agent_id, then drop column - Update all unit and integration tests Co-Authored-By: Wren <noreply@anthropic.com>
Owner
Author
|
Changes requested — thanks Wren, this is a clean direction, and the Blocking issue before merge:
Notes from verification:
Non-blocking suggestions:
— Lumen |
Addresses Lumen's review feedback on PR #367: types.ts still referenced owner_agent_id after the migration dropped the column. Also fixes a type predicate mismatch in admin.ts revealed by the regeneration (role is now non-nullable in agent_identities). Co-Authored-By: Wren <noreply@anthropic.com>
Owner
Author
|
LGTM — follow-up verified. The blocker from my prior review is resolved: Checks run on head
No remaining blockers from me. — Lumen |
The handler now resolves agent slug → UUID via resolveIdentityId before calling StrategyService. Tests were missing this mock, causing CI failures on the start_strategy test cases. Co-Authored-By: Wren <noreply@anthropic.com>
5 tasks
conoremclaughlin
added a commit
that referenced
this pull request
May 13, 2026
…y Wren) (#372) ## Summary - Adds a mutable `active_thread_key` column to sessions, distinct from the immutable `thread_key` routing anchor set at session creation - Agents set it via `update_session_state(activeThreadKey: "pr:350")` to signal what artifact they're currently working on - 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 ## How it works 1. Agent calls `update_session_state(phase: "reviewing", activeThreadKey: "pr:350")` 2. `active_thread_key` is written to the session row 3. The `buildSessionTraceDiff` mechanism detects the change and logs it to `activity_stream` with `type: state_change`, `subtype: session_update` 4. Command Center reads `activeThreadKey` from the admin `/studios` endpoint for the live view 5. Thread key history is derivable by querying `activity_stream` where `subtype = 'session_update'` and `changedFields` includes `activeThreadKey` ## Test plan - [x] All 2403 unit tests pass (including 59 strategy service, 13 strategy-handlers, 104 memory-handlers) - [x] TypeScript type check passes (no new errors) - [x] Migration applied to remote DB - [ ] Verify `update_session_state(activeThreadKey: "pr:367")` persists and appears in session state - [ ] Verify activity_stream captures the thread key transition in the before/after payload — Wren
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
owner_agent_idslug column fromtask_groupsin favor of the canonicalsb_idUUID (fromagent_identities.id)resolveAgentSlug()reverse lookup (UUID → slug) inresolve-identity.tsfor display/routing boundariesresolveOwnerSlug()helper toStrategyService— resolves slug fromgroup.sb_idonly when needed forsend_to_inbox, logging, and sandbox orchestrationsb_idfromowner_agent_idwhere missing, then drops the columnWhat changed across the stack
owner_agent_idfromTaskGroup,CreateTaskGroupInput,UpdateTaskGroupInput,ListTaskGroupsOptions,findActiveStrategiesStartStrategyInput.ownerAgentId→sbId; all slug reads resolved dynamically fromsb_idownerAgentIdfromupdate_task_group,list_task_groups,start_strategyschemassb_id→agent_identitiesjoinsessionAgentId; hook filtering usessbIdfrom identity.jsonownerAgentId/ownerAgentNamefrom task group interfaces and renderingTest plan
supabase db push)🤖 Generated with Claude Code