feat(open): attach to agent sessions in ttal open session#342
feat(open): attach to agent sessions in ttal open session#342birdmanmandbir merged 3 commits intomainfrom
Conversation
Previously only worker sessions (w-{uuid}-{slug}) were found.
Now falls back to agent sessions (ttal-{team}-{agent}) when
the task has an agent name tag.
PR Review — feat: ttal open session agent session attachmentImportant Issues (3)1. DRY — agent resolution logic duplicated between The tag-iteration loop ( Fix: export // tui/actions.go
if cfg != nil {
if agentSession, found := open.ResolveAgentSession(t.Tags, cfg.TeamName(), cfg.TeamPath()); found {
if tmux.SessionExists(agentSession) {
c := exec.Command("tmux", "attach-session", "-t", agentSession)
return tea.ExecProcess(c, func(err error) tea.Msg { ... })
}
}
}If a circular import prevents this, an 2. Config error swallow is too broad The comment correctly documents the intent (degrade gracefully on first-time setup), but swallowing all Tighten the swallow to cfg, err := config.Load()
if err != nil {
if !errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("could not load config for agent session lookup: %w", err)
}
} else if agentSession, found := resolveAgentSession(...); found {
...
}3. A failed Wrap at the callback, consistent with the existing pattern in return tea.ExecProcess(c, func(err error) tea.Msg {
if err != nil {
return execFinishedMsg{err: fmt.Errorf("attach agent session %q: %w", agentSession, err)}
}
return execFinishedMsg{}
})Suggestions (2)4. Wrap 5. "First match wins" test case doesn't verify ordering Strengths
VERDICT: NEEDS_WORKIssues 1-3 should be addressed before merge. Issue 1 (DRY) is the most impactful for long-term maintainability; issues 2-3 are correctness/UX gaps. |
…config error handling, add error context - Export ResolveAgentSession (accepts []string) so TUI can delegate without duplicating logic - Tighten config.Load error swallow to os.ErrNotExist only — surface corrupted/bad-perms configs - Wrap lookPath error with %w to preserve diagnostic - TUI openSession: use open.ResolveAgentSession (DRY), add session name context to execFinishedMsg errors - Test: add second agent file and reversed-order case to pin first-match-wins ordering guarantee
Triage UpdateFixed
|
Re-review — 417e2c4Fixed
VERDICT: LGTMAll review issues resolved. Implementation is correct and well-structured. |
Triage UpdateAll issues resolved. Merging. |
Summary
ttal open session <uuid>now falls back to agent tmux sessions (ttal-{team}-{agent}) when no worker session exists and the task has an agent name tagresolveAgentSessionhelper ininternal/open/session.gowith full test coverageopenSessionaction to apply the same fallback logic viam.cfgTest plan
TestResolveAgentSessioncovers: no tags, non-agent tags, agent tag match, first match wins, empty team pathmake testpassesmake cipasses