Add assigned_gm field for task ownership / multi-GM event scoping#561
Add assigned_gm field for task ownership / multi-GM event scoping#561kylecarbonneau wants to merge 4 commits into
Conversation
Introduces an AssignedGM string on Task: a free-form slug identifying the GM (manager session) a task belongs to. Threads it through the INSERT, UPDATE, and all SELECT/scan sites, adds the schema migration, and gives ListTasks --assigned-gm / --unassigned filtering via ListTasksOptions. ty stores the slug verbatim and does no validation; the slug-to-GM mapping is the client's concern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds --assigned-gm to `ty create` / `ty update` / `ty list` and --unassigned to `ty list`, an assigned_gm property on the taskyou_create_task MCP tool, and a TASK_ASSIGNED_GM env var passed to event hook scripts so push-channel clients can scope events per GM. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
UpdateTask now records an assigned_gm change in the emitted task.updated
event's metadata ({"old","new"}, matching the existing per-field
convention), so per-GM channels can react to a task becoming theirs,
being reassigned away, or returning to the unassigned pool. The event
only fires when the value actually changed.
runHook also exposes TASK_PREVIOUS_ASSIGNED_GM when the update carries
an assignment change, so hooks can detect the direction of the change
without parsing TASK_METADATA as JSON.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The TUI edit form and the move-to-project clone paths reconstruct a task without an assignment field, which would silently drop assigned_gm and — now that UpdateTask emits an assignment-change event — fire a spurious "unassigned" event on an unrelated edit. Carry the existing assignment through all three paths (TUI edit-save, TUI project move, CLI move-to-project), mirroring how tags is already preserved on the CLI clone. Also drop a stray unused variable in the list-filter test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Did a thorough pass on this — the code itself is clean, correct, and genuinely well-tested (migration is safe/additive, all 9 SELECT/scan projection sites stay in sync, build/vet/tests green). No complaints on execution. My one piece of feedback is bigger-picture: I think this is solving the problem at the wrong layer, and I'd like to redirect before it goes further. Proposing we close this in favor of a tag-based approach. Why redirect
Better-shaped approach: generalize on
|
Adds an
assigned_gm stringfield onTask(with migration), filter flags (ty list --assigned-gm <slug>/--unassigned),--assigned-gmonty create/ty update, anassigned_gmproperty on thetaskyou_create_taskMCP tool, and event support: aTASK_ASSIGNED_GMenv var on every task hook plus atask.updatedevent (and aTASK_PREVIOUS_ASSIGNED_GMenv var) whenever a task's assignment changes.Motivation
With multiple GM sessions running on the same daemon (each a separate Claude session driving its own delegated tasks), every GM currently sees every task event. This adds first-class ownership so per-GM filters (channel-side, kanban UI, CLI) can scope cleanly instead of relying on soft
CLAUDE.mdconventions. The assignment-change event lets a GM's channel react when a task becomes theirs, is reassigned away, or returns to the unassigned pool.tyitself only stores and exposes the field — validation / slug-to-GM mapping is the client's job (e.g. a push-channel server). A companion client-side change would consume the field for the actual filtering.What's included
AssignedGMonTask, threaded throughCreateTask/UpdateTaskand every task SELECT/scan site; migrationALTER TABLE tasks ADD COLUMN assigned_gm TEXT DEFAULT ''.ListTasksOptions.AssignedGM/Unassigned→ty list --assigned-gm <slug>and--unassigned(the latter takes precedence).--assigned-gmonty createandty update; assignment is preserved across the TUI edit and project-move flows.assigned_gmstring property ontaskyou_create_task.TASK_ASSIGNED_GMexported to all task hooks;UpdateTaskemits atask.updatedevent carrying{old, new}when the assignment actually changes, andrunHookadditionally exportsTASK_PREVIOUS_ASSIGNED_GMon those events so hooks can tell the direction of the change without parsingTASK_METADATA.Design notes
tydoes no validation of the slug — it's stored verbatim. The slug→GM mapping belongs to the client.{old, new}change-metadata convention (same shape as title/status/project changes) and only fires when the value actually changed.Testing
Unit tests cover create/get/update/clear persistence, the
--assigned-gm/--unassignedlist filters (including unassigned-overrides-slug precedence), the assignment-change event (fires on change, not on unrelated edits), and that both env vars reach hook scripts.go vet ./...and thedb/executor/events/mcp/cmd/uitest suites pass.