yoi/.yoi/tickets/closed/20260607-012131-workspace-panel-local-role-session-registry/thread.md

12 KiB

Created

Created by LocalTicketBackend create.


Plan

Preflight / implementation intent

Classification: implementation-ready with coordination risk.

Intent:

  • Add a local, workspace-scoped role session registry and Ticket claim index for yoi panel orchestration state.
  • Store registry data under the configured user data directory, not under git-tracked .yoi/tickets files and not under the runtime directory.
  • Model Ticket -> at most one active local Pod claim while allowing Pod/session -> 0..N related Tickets.
  • Represent pre-Ticket Intake sessions even before a Ticket exists.
  • Join Ticket state, local registry data, and Pod metadata in panel state/actions where practical, without introducing automatic polling/spawn.

Requirements:

  • Define a stable workspace key/path for registry storage under manifest::paths::data_dir() or an equivalent existing user-data boundary.
  • Keep local Pod names, socket paths, runtime status, and local claim state out of git-tracked Ticket frontmatter/thread files.
  • Make claim creation race-aware: when starting Intake for an existing Ticket, claim before spawn/restore; if a claim exists, do not start a second Pod silently.
  • Treat stale claims explicitly with diagnostics/reclaim affordance rather than auto-replacing them.
  • Intake is not 1:1 with Ticket: support no related Ticket and multiple related Tickets in the local model.
  • Preserve the current interim access path where ticket-* Pods are visible in the panel.

Code map:

  • crates/manifest/src/paths.rs: existing data/config/runtime directory boundary; registry should use durable user data, not runtime.
  • crates/tui/src/multi_pod.rs: Intake launch path (prepare_intake_launch / finish_intake_launch), panel snapshot construction, selected actions.
  • crates/tui/src/workspace_panel.rs: Ticket rows, related Pod display, workflow_state = intake row behavior, Panel view model.
  • crates/client/src/ticket_role.rs: Ticket role launch context and Pod naming; useful integration point but should not write git-tracked Ticket assignment.
  • Existing Pod list/status model is in crates/tui/src/multi_pod.rs / workspace_panel.rs; use it for liveness/restorability rather than persisting live status as authority.

Boundaries / non-goals:

  • Do not store local Pod assignment in Ticket metadata/thread.
  • Do not assume Intake Pod and Ticket are 1:1.
  • Do not add polling that auto-starts Intake for workflow_state = intake Tickets.
  • Do not replace Orchestrator scheduling.
  • Do not implement the real Companion Pod lifecycle here.
  • Do not remove selected-Pod direct-send here; workspace-panel-remove-direct-pod-send owns that and is being implemented in parallel.

Coordination note:

  • workspace-panel-remove-direct-pod-send is active in branch work/workspace-panel-remove-direct-pod-send and may touch multi_pod.rs / workspace_panel.rs. Keep this registry implementation as additive/localized as possible and report any likely merge conflicts.

Validation:

  • Add focused unit tests for registry serialization/path behavior, one-active-claim-per-Ticket invariant, and non-1:1 Intake/Ticket relation.
  • Run focused cargo test -p tui workspace_panel --lib and relevant new registry tests; run cargo test -p tui multi_pod --lib if integration touches panel runtime paths; run formatting/checks appropriate for the diff.

Intake summary

Implementation intent is clear: add a user-data workspace-scoped local role/session registry and Ticket claim index, enforce one active local Pod claim per Ticket, allow one Intake session to relate to multiple Tickets or none, and keep local Pod assignment out of git-tracked Ticket records.


State changed

Ticket intake complete; workflow_state intake -> ready.


Implementation report

Delegation

Implementation delegated to child Pod panel-role-session-registry-coder-20260607 in worktree .worktree/workspace-panel-local-role-session-registry on branch work/workspace-panel-local-role-session-registry.

Scope:

  • Add a durable user-data workspace-scoped local role session registry and Ticket claim index.
  • Enforce one active local Pod claim per Ticket while allowing a role session/Intake Pod to relate to zero or more Tickets.
  • Keep local Pod assignment out of git-tracked Ticket metadata/thread.
  • Preserve no-polling semantics and the interim ticket-* Pod visibility path.

Coordination note: workspace-panel-remove-direct-pod-send is active in parallel and may touch multi_pod.rs / workspace_panel.rs; the child was instructed to keep the registry implementation additive/localized and report likely conflicts.

The child should commit implementation work in the child worktree and report diff/tests. Merge, review, Ticket closure, and cleanup remain with the parent/human workflow.


Implementation report

Review delegation

External review delegated to panel-role-session-registry-reviewer-20260607 with read-only scope over the repository.

Review focus:

  • Validate the local user-data registry and Ticket claim model against the ticket intent.
  • Check one-active-claim-per-Ticket behavior, non-1:1 Intake/Ticket support, claim-before-spawn behavior, stale claim handling, and workspace-key/path choices.
  • Confirm local Pod assignment is not written to git-tracked Ticket metadata/thread.
  • Explicitly review semantic/merge conflicts with current develop, because workspace-panel-remove-direct-pod-send has already landed and touched multi_pod.rs / workspace_panel.rs after this implementation branch was created.

The reviewer is instructed not to modify files and to return approve/request-changes guidance with evidence and merge-readiness notes.


Review: request changes

Request changes.

Blockers:

  1. Semantic conflict with current develop: direct Pod send is reintroduced. workspace-panel-remove-direct-pod-send has landed, but this branch still carries the old direct-send path and adds back DirectSendRequest, prepare_send, finish_send, DirectSendError, NextUserAction::SendToPod, and Pod-row direct-send behavior. The registry branch must be rebased/resolved so it preserves current panel behavior: no selected-Pod direct send, Pod rows open/attach only.

  2. The role session record is missing required fields. The Ticket requires local role sessions to include at least role, pod name, origin, created/updated timestamps, and related Ticket refs. Implemented RoleSessionRecord only has pod_name, role, optional session_id, and ticket_ids. Add origin, created_at, updated_at, and keep related Ticket refs compatible with the non-1:1 Intake/Ticket model.

  3. Launch failure / registry recording can lose local coordination state. Existing-Ticket path claims before launch, but launch_intake_with_handoff releases the claim on any launch error. launch_ticket_role_pod_with_options can fail after spawn_pod succeeds during connect, pre-run/send, or run-acceptance, leaving a live/restorable/stale Pod with no claim and allowing a later second launch. Successful pre-Ticket Intake registry recording is also best-effort only, so a successful launch can silently fail to be represented.

Non-blocking concerns:

  • Claim creation uses create_new, which is good for one-claim invariant, but the file is visible before JSON content is fully written; transient partial reads can produce poor diagnostics.
  • role-sessions.json updates are read-modify-write without locking, so concurrent record_session calls can lose refs.
  • Workspace key/path behavior is likely acceptable for local user-data but should be a conscious decision; symlinked/moved workspaces create distinct registries, and full workspace_root is stored in JSON.

Positive evidence:

  • Registry files are under user data dir, not .yoi/tickets.
  • The implementation does not modify git-tracked Ticket files for local Pod assignment.
  • Normal existing-Ticket Intake checks existing claim and refuses a second Pod, with status derived from current Pod list.
  • Panel display preserves interim ticket-* heuristic while adding claim Pod names.
  • Pre-Ticket Intake names are unique and do not require Ticket id.

Merge readiness: not merge-ready. Needs rebase/semantic conflict fix against current develop, schema additions, and failure-behavior hardening, followed by focused tests and build validation.


Review: approve

Approved after fixup commit 2f3f54b.

Reviewer verified:

  • The selected-Pod direct-send path is not reintroduced; no DirectSendRequest, prepare_send, finish_send, DirectSendError, or NextUserAction::SendToPod panel path remains.
  • Pod rows use open/attach-style behavior and Companion non-empty submit remains rejected with the Companion lifecycle diagnostic.
  • RoleSessionRecord includes role, pod_name, origin, created_at, updated_at, related_tickets, and optional session_id.
  • RoleSessionOrigin distinguishes pre-Ticket Intake from existing-Ticket claims.
  • Related Tickets are represented as a vector, preserving 0..N Ticket relationships.
  • Existing-Ticket claim is created before launch and is not broadly released after launch failures that may have spawned a Pod.
  • Pre-Ticket successful launch surfaces registry recording failure as a warning/diagnostic.
  • Claim files avoid visible partial JSON by writing a temp file then linking into place.
  • role-sessions.json updates use a local lock guard.
  • Live/restorable/stale status is derived from current Pod list/metadata at panel render time.
  • Local Pod assignment is stored under user data panel workspace storage, not .yoi/tickets.
  • git merge-tree --write-tree develop work/workspace-panel-local-role-session-registry exits 0, and no semantic conflict with current direct-send removal was found.

Non-blocking follow-ups:

  • Registry lock has no stale-lock recovery.
  • Temp claim files may remain after a crash before link/cleanup, though they are not read as claim JSON.

State changed

Ticket closed; workflow_state set to done.


Closed

Implemented, externally reviewed, merged, and validated.

Summary:

  • Added a local workspace-scoped panel role session registry under user data.
  • Added local Ticket claim files to enforce at most one active local Pod claim per Ticket.
  • Supported pre-Ticket Intake sessions and 0..N related Tickets per role session.
  • Preserved ticket-* Pod heuristic visibility while adding local claim status display.
  • Existing-Ticket Intake now claims before launch and refuses to silently start a second Pod when a live/restorable/stale claim exists.
  • Local Pod assignment is not written into git-tracked Ticket metadata/thread.
  • Preserved the already-merged no-direct-selected-Pod-send behavior.

Merged implementation:

  • 4890590 tui: add panel role session registry
  • 2f3f54b fixup! tui: add panel role session registry
  • Merge commit: merge: panel role session registry

Review:

  • Initial review requested changes for direct-send semantic conflict, incomplete registry schema, and launch failure/recording behavior.
  • Fixup addressed blockers.
  • Follow-up review approved with only non-blocking follow-ups: stale-lock recovery and temp claim file housekeeping.

Validation after merge:

  • cargo test -p tui role_session_registry --lib
  • cargo test -p tui workspace_panel --lib
  • cargo test -p tui multi_pod --lib
  • cargo fmt --check
  • git diff --check
  • target/debug/yoi ticket doctor