Skip to content

fix(codex): avoid two-line grep -c count breaking record-session integer test - #484

Merged
fujibee merged 1 commit into
fujibee:mainfrom
lmncaj:fix/record-session-grep-count
Jul 26, 2026
Merged

fix(codex): avoid two-line grep -c count breaking record-session integer test#484
fujibee merged 1 commit into
fujibee:mainfrom
lmncaj:fix/record-session-grep-count

Conversation

@lmncaj

@lmncaj lmncaj commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • codex-record-session.sh counts candidate thread ids with [ "$(grep -c . "$tids_file" 2>/dev/null || echo 0)" -eq 1 ]. On zero matches grep -c prints 0 and exits 1, so the fallback stacks a second 0 and the test dies with [: 0 / 0: integer expected — on every actas in a cwd with no matching Codex rollout.
  • Capture the count first (|| true) and default only the no-stdout case (${tid_count:-0}, missing/unreadable file). The 1-match and ambiguous >1 behaviors are unchanged.
  • Regression test: the zero-match case stays silent and exits 0. Fails on the old code. No other grep -c … || echo combinations remain in the repo.

Test plan

  • bats tests/test_codex_resume.bats — 10/10
  • bash -n scripts/drivers/types/codex/codex-record-session.sh, git diff --check clean

@fujibee
fujibee merged commit 96fa5e5 into fujibee:main Jul 26, 2026
7 checks passed
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.

2 participants