Skip to content

No lint guards the `${var:-{}}`/`${var:-[]}` brace-default trap that disarmed 34e/3x/17g for a month

Id: TD-PPagop-26082922 · Status: resolved · Filed: 2026-08-29 · Resolved: 2026-09-30 · Ref: https://github.com/Pullwright/agent-ops/pull/1964

What. agent-ops#933/TD-PPagop-26082816 fixed one instance of a bash parameter-expansion default whose word contains an unescaped { or [ — ${parameter:-word} closes on the first unquoted }, so ${var:-{}} silently appends a stray brace to every non-empty value. PR #940 swept the tree with grep -rnE ':-\{\}\}|:-\[\]\]' agent-cycle.sh lib/ scripts/ and found only the one hit, and the spec’s Gotchas table now documents the trap — but nothing stops the shape from being reintroduced tomorrow: shellcheck does not flag it (the buggy line lived under a green shellcheck CI check from the day it shipped), and the sweep grep exists only in #933’s work order and PR prose.

Why it matters. This class of bug is invisible by construction: the empty/unset path — the only one most fixtures exercise — composes the intended default exactly, and every non-empty path corrupts silently. The one instance found cost requirements 34e, 3x and 17g a month of dead code and was the largest single generator of the 2026-08-27/28 escalation surge. A recurrence would be equally silent.

Where. .github/workflows/ shell-lint machinery (scripts/lint-shell.sh / the shellcheck workflow).

Suggested fix. Add the sweep as a permanent CI step beside shellcheck: fail the lint job if grep -rnE ':-\{\}\}|:-\[\]\]' (or a slightly generalised pattern for unescaped {/[ inside a :- default word) matches anything under agent-cycle.sh, review-cycle.sh, lib/, scripts/, test/, pointing the failure message at the spec’s Gotchas row so the fix (initialise ahead of the guard instead of defaulting) is one click away.

Noticed while the Approver was judging https://github.com/Poetic-Poems/agent-ops/pull/940.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/1035.