Skip to content

Avoid grep -q behind a pipe under pipefail in tests - #128

Merged
moodmosaic merged 1 commit into
protocol-security:masterfrom
orsissimo:fix/test-grep-pipefail
Nov 3, 2026
Merged

moodmosaic merged 1 commit into
protocol-security:masterfrom
orsissimo:fix/test-grep-pipefail

Conversation

@orsissimo

@orsissimo orsissimo commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

  • Replace pipes into grep -q with here-strings in test helpers and individual checks, including the runtime, launch and harvest checks added by Isolate runtime state and serialize engagement operations #125. Preserve command failures when capturing output before checking it.
  • In tests/runtime_signal_trap.sh, capture docker logs before checking for session start, preserving failure handling if the command fails.
  • Document the test failure and fix under Unreleased in CHANGELOG.md.

Self-review checklist

  • This PR addresses a single concern (why?). If it covers multiple independent changes, I've split them into separate PRs.

Test plan

Validation after rebase onto 608c5c5 (2026-11-03):

  • Unit suite on macOS: 14 files, 1699 tests, 0 failures.
  • Docker runtime signal tests: 16 passed, 0 failed.
  • ShellCheck with the CI flags and git diff --check pass.
  • API and OAuth integration phases skipped: ANTHROPIC_API_KEY and CLAUDE_CODE_OAUTH_TOKEN are not set in this session.

Earlier validation, before this rebase:

  • Stress loop with a 200-line $h under pipefail: on Ubuntu 24.04 under CPU load, echo "$h" | grep -q gave 22 false negatives in 20,000 runs; grep -q ... <<< "$h" gave 0. On macOS, both gave 0 in 5,000 runs.
  • ./tests/test.sh --unit: macOS Bash 3.2.57, 1388 tests; Ubuntu 24.04, 1400 tests as UID 501 and UID 1000. Each run covered 13 files with 0 failures in three full rounds.
  • ./tests/test.sh --runtime: 16 passed on macOS and Ubuntu as UID 501 and UID 1000, in three rounds.
  • ShellCheck: CI command passes, with the same notices as master.
  • ./tests/test.sh --oauth: passed with a real agent on macOS and Ubuntu as UID 501 and UID 1000.
  • Live run with two real agents on macOS and Ubuntu as UID 501, alongside the same run on master: start, mid-run harvest, stop, interactive session, post-process, harvest, costs.sh, progress.sh, Cleanup and git fsck. Results matched master at every step, including the object mode and Cleanup checks that fail on master and that Clone the bare repo and mirrors without hardlinks #127 fixes.
  • ./tests/test.sh --all: not run; requires an API key.

@moodmosaic

Copy link
Copy Markdown
Member

Thank you, @orsissimo! Can you rebase this?

@orsissimo
orsissimo force-pushed the fix/test-grep-pipefail branch from 403fbb8 to a011dc4 Compare November 3, 2026 16:13
@moodmosaic
moodmosaic merged commit cd7d006 into protocol-security:master Nov 3, 2026
5 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