You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Keep branch start auto-transfer alive under pipefail (#397)
The protected-branch auto-transfer path used \, which can trip \ when \ exits after finding the matching stash message. That leaves the stash ref lookup fragile during \.
Use a helper that reads the stash list once and resolves the matching ref without a pipeline, then mirror it across the installed, template, and frontend copies. Add focused regression coverage for the installed script path.
Constraint: Shipped branch-start script copies must stay behavior-identical across installed, template, and frontend surfaces
Rejected: Disable pipefail for the stash lookup | would hide real bootstrap failures on protected branches
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep stash-ref lookup shared and pipeline-free across all branch-start copies
Tested: node --test test/branch.test.js; git diff --check
Not-tested: Full gx branch finish/PR flow against GitHub
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>
Protected-branch auto-transfer can misread the new stash ref under `set -o pipefail` because the `git stash list | awk ... exit` pipeline exits early once `awk` finds the matching message. Resolve the ref by reading the stash list once into a helper and matching there so `gx branch start` keeps moving local changes into the new agent worktree without tripping the pipefail path.
6
+
7
+
Scope:
8
+
- Add `resolve_stash_ref_by_message` to `scripts/agent-branch-start.sh`, `templates/scripts/agent-branch-start.sh`, and `frontend/scripts/agent-branch-start.sh` so all shipped copies use the same safe stash lookup.
9
+
- Replace the inline `git stash list | awk ... exit` lookup with the shared helper on the protected-branch auto-transfer path.
10
+
- Add focused regression coverage in `test/branch.test.js` that exercises the installed script path and proves the base checkout ends clean with no leftover `guardex-auto-transfer-*` stash entry.
11
+
12
+
Verification:
13
+
-`node --test test/branch.test.js`
14
+
15
+
## Handoff
16
+
17
+
- Handoff: change=`agent-codex-fix-branch-start-pipefail-stash-lookup-2026-04-23-20-01`; branch=`agent/codex/fix-branch-start-pipefail-stash-lookup-2026-04-23-20-01`; scope=`scripts/agent-branch-start.sh, templates/scripts/agent-branch-start.sh, frontend/scripts/agent-branch-start.sh, test/branch.test.js, openspec/changes/agent-codex-fix-branch-start-pipefail-stash-lookup-2026-04-23-20-01/*`; action=`land the pipefail-safe stash lookup fix, verify with focused branch tests, then finish via PR merge + cleanup`.
0 commit comments