Skip to content

Commit 65e709c

Browse files
committed
fix(workflow): cap Claude turns + forbid background/polling in upgrade-deps
Run 24545325671 showed the `Check upgrade dependencies` step stuck for 40+ minutes in a busy-wait loop: Claude had backgrounded `just build` and was polling `ps aux | grep "just build"` / `pgrep` / `sleep` every few seconds to check if it was done. Each poll was a full model round-trip, so the session never ended even though no real work was happening. - Add a 200-turn cap via `--max-turns 200` so a runaway agent session can no longer burn an unbounded amount of Actions time. - Add an explicit "Running long commands" rule to the prompt that forbids backgrounding (`&`, `nohup`, `disown`, etc.) and forbids polling with `ps`/`pgrep`/`sleep` loops. The Bash tool's 20-minute per-call timeout is plenty for `just build` and `pnpm test`, and foreground calls give Claude the exit code and output in one shot.
1 parent 1175d99 commit 65e709c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/upgrade-deps.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,29 @@ jobs:
112112
If any of the three above fails, diagnose the root cause, fix it, and re-run
113113
the final validation. Do not exit with the task marked complete otherwise.
114114
115+
### Running long commands (IMPORTANT)
116+
Run every long-running command (`just build`, `pnpm bootstrap-cli:ci`,
117+
`pnpm test`, `cargo check`, etc.) in the FOREGROUND — a single Bash tool call
118+
that blocks until the command exits. The Bash tool already gives you a 20-minute
119+
timeout per call, which is enough for these builds.
120+
121+
Do NOT do any of the following:
122+
- Spawn a background process (`&`, `nohup`, `disown`, `setsid`, `screen`, `tmux`).
123+
- Poll for process completion with `ps`, `pgrep`, `lsof`, `sleep` loops, or
124+
repeated `ls` checks on build artifacts. Each polling Bash call costs a full
125+
model round-trip and burns minutes without progress.
126+
- "Monitor" a running build from a separate Bash call. If you want to know
127+
whether a build succeeded, just run it in the foreground and read its exit
128+
code and stdout/stderr in the single tool result.
129+
130+
If a foreground command legitimately hits the 20-minute Bash timeout, report
131+
that and stop — do not start polling.
132+
115133
### Commit rule
116134
Do NOT run `git commit` or `git push`. A later workflow step commits every
117135
modified file for you.
118136
claude_args: |
119-
--model opus --allowedTools "Bash,Edit,Replace,NotebookEditCell"
137+
--model opus --max-turns 200 --allowedTools "Bash,Edit,Replace,NotebookEditCell"
120138
additional_permissions: |
121139
actions: read
122140

0 commit comments

Comments
 (0)