Commit 39f09c4
committed
Avoid duplicate jq pass in bg-pending short-circuit
hooks/loop-codex-stop-hook.sh previously called
has_pending_background_tasks AND count_pending_background_tasks
back-to-back on the short-circuit path. Both wrap
list_pending_background_task_ids, so every pending-bg stop was
running jq over the transcript twice.
Collapse into a single list_pending_background_task_ids call:
capture the id list once, use its non-emptiness for the
short-circuit decision, and derive the count with `wc -l`. The
public helpers has_pending_background_tasks and
count_pending_background_tasks stay for other callers.
No behaviour change. systemMessage wording and exit codes
identical.
Validation (all six suites green):
- bash tests/run-all-tests.sh -> 1718 passed, 0 failed
- bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed
- HOME=/nonexistent/readonly ... -> 39 passed, 0 failed
- TZ=America/Los_Angeles ... -> 39 passed, 0 failed
- TZ=Asia/Tokyo ... -> 39 passed, 0 failed
- CLAUDE_PROJECT_DIR=/tmp/outer-unrelated ... -> 39 passed, 0 failed
Version stays at 1.16.0.1 parent 74671f7 commit 39f09c4
1 file changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
141 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
0 commit comments