Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Add a boolean filter_exclude parameter to the bash_output tool that inverts the filter behavior:

  • When true, lines matching filter are excluded instead of kept
  • Key behavior: excluded lines do NOT cause early return from timeout
  • Waiting continues until non-excluded output arrives or process exits

Problem

When polling bash_output for long-running processes like wait_pr_checks.sh, agents generate excessive tool calls because:

  1. Scripts emit periodic progress output (e.g., ⏳ Checks in progress... every 5s)
  2. timeout_secs only sets upper bound - returns early when ANY output arrives
  3. Agent sees output, polls again, sees more progress, polls again...

Solution

With filter_exclude:

bash_output(process_id="...", filter="⏳", filter_exclude=true, timeout_secs=60)

The agent can set a long timeout and only wake when meaningful output (✅ or ❌) arrives.

Tests Added

  • Basic exclusion works
  • Error when filter_exclude without filter
  • Keeps waiting when only excluded lines arrive
  • Returns when process exits (even if only excluded output)
  • Timeout returns (doesn't hang) with only excluded output

Generated with mux

Add a boolean filter_exclude parameter that inverts the filter behavior:
- When true, lines matching filter are excluded instead of kept
- Key behavior: excluded lines do NOT cause early return from timeout
- Waiting continues until non-excluded output arrives or process exits

This helps avoid busy polling when monitoring long-running processes that
emit progress spam (e.g., wait_pr_checks.sh outputs '⏳ Checking...' every
5 seconds). With filter_exclude, agents can set a long timeout and only
wake when meaningful output arrives.

_Generated with mux_
- Add filter_exclude to BashOutputToolArgs type
- Update BashOutputToolCall to show 'exclude:' vs 'filter:' label
- Add createBashOutputTool filterExclude parameter
- Add FilterExclude story demonstrating the feature

The story shows:
- Using filter_exclude to skip progress spam (⏳ lines)
- Comparison with regular filter (include mode)
@ammario ammario merged commit e2170ba into main Dec 10, 2025
20 checks passed
@ammario ammario deleted the bash-filter-5j2x branch December 10, 2025 16:47
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