fix: tmux and term shell out with no context or timeout #454
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#454
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).
internal/tmuxandinternal/termmake 28exec.Commandcalls and 0exec.CommandContextcalls.Examples:
tmux/sessions.go:129,155,189,222;term/term.go:142,232,385,454.Why it matters
handleTmuxSessions,handleTmuxClients, andhandleSessionEventscall into these from the HTTP request path. A wedged or unresponsive tmux server hangs the handler indefinitely — no timeout, and a client disconnect cannot cancel it. Each hung request holds a goroutine and, for the SSE paths, a connection.internal/gitalready gets this right viainternal/gitexec, so this is an inconsistency, not an unsolved problem.Suggested fix
Mirror
internal/gitexec:internal/tmuxexecwithCommand(ctx, args...)applying a default timeout (git usesgitCommandTimeout; pick a comparable bound).internal/tmux/internal/termto take actx.r.Context()fromhandleTmuxSessions/handleTmuxClients/handleSessionEvents; background callers pass their own ctx.Long-lived PTY processes in
internal/termare the exception — they should get the ctx for cancellation but not the short default timeout.Acceptance criteria
exec.Commandcount ininternal/tmux+internal/termis 0 (excluding the PTY spawn, which usesCommandContextwithout a deadline).tmuxbinary fails the handler within the timeout rather than hanging (test with a stub runner that blocks).Effort: M.