Skip to content

ASH-215: runner.Run context + timeout (hung git can't wedge the daemon)#15

Merged
cstaszak merged 1 commit into
mainfrom
cstaszak/ash-215-runner-timeout
May 22, 2026
Merged

ASH-215: runner.Run context + timeout (hung git can't wedge the daemon)#15
cstaszak merged 1 commit into
mainfrom
cstaszak/ash-215-runner-timeout

Conversation

@cstaszak

Copy link
Copy Markdown
Contributor

runner.Run used exec.Command with no deadline. The git verb's shellout path (status/diff/log/show) called it that way, so a hung git subprocess — stalled network FS, credential prompt, wedged hook — pinned a daemon handler goroutine indefinitely. With [daemon].max_concurrent_handlers set, enough hung calls wedge the whole daemon. Request cancellation also couldn't reach the subprocess.

  • runnerexec.CommandContext. Context derived from opts.Tracer (a cancelled request now kills the subprocess), and a new opts.Timeout adds a hard ceiling — a timed-out run returns a <prog>_timeout proto.Error instead of being misreported as a normal failure. Backwards-compatible: callers that set neither field get context.Background() and behave exactly as before.
  • git — all six shellout call sites pass a 30s shelloutTimeout. Read-side git ops finish well under a second on a healthy repo; 30s only fires on a genuine hang.
  • runner_test — adds a timeout regression test.

Found in the post-public-release code review.

🤖 Generated with Claude Code

runner.Run used exec.Command with no deadline. The git verb's shellout
path (status/diff/log/show) called it that way, so a git subprocess
that hung — stalled network filesystem, credential prompt, wedged
hook — pinned the daemon handler goroutine indefinitely, and with
[daemon].max_concurrent_handlers set, enough hung calls wedge the
daemon. Request cancellation also could not reach the subprocess.

- runner: switch to exec.CommandContext. The context is derived from
  opts.Tracer (so a cancelled request kills the subprocess), and a new
  opts.Timeout adds a hard ceiling — a timed-out run returns a
  "<prog>_timeout" proto.Error rather than being misreported as a
  normal failure.
- git: all six shellout call sites pass a 30s shelloutTimeout. Read-side
  git ops finish well under a second on a healthy repo; 30s only ever
  fires on a genuine hang.
- runner_test: add a timeout regression test.
- Regenerate docs/vocab/inventory.{md,json} — the new "<prog>_timeout"
  error code resolves to git_timeout / go_timeout in the inventory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cstaszak
cstaszak force-pushed the cstaszak/ash-215-runner-timeout branch from 87789ee to ae3ef4b Compare May 22, 2026 00:55
@cstaszak
cstaszak merged commit 945ff96 into main May 22, 2026
5 checks passed
@cstaszak
cstaszak deleted the cstaszak/ash-215-runner-timeout branch May 22, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant