refactor: deduplicate the three tmux opencode launchers #455
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#455
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code-quality audit (P2). Three near-identical opencode launchers in
internal/tmux/sessions.go::391LaunchOpencodeCmdEnvWith:447LaunchOpencodeWith:514LaunchOpencodeEnvWithAll three do the same sequence: derive the session name, run the
ValidComponentcheck, callListSessions, match by cleanedResolvedPath, short-circuit when idempotent, thenNewSession*/NewWindow*. The matching block is repeated verbatim at:397-411,:466-480, and:520-534.Why it matters
The matching block encodes the tmux dot/underscore quirk documented in AGENTS.md (
~/src/github.com/foobecomes~/src/github_com/fooin tmux output). Any fix to that logic must be made in three places, and a fix applied to two of three produces a launcher that silently targets the wrong pane — the exact failure modeValidComponentexists to prevent.Suggested fix
Keep
LaunchOpencodeCmdEnvWithas the core implementation. Make the other two thin wrappers:(exact default command per current behaviour — verify the three paths really do build the same command before collapsing).
Acceptance criteria
Effort: S.