Skip to content

Fix validation/tool-result UI to reflect real execution outcome - #253

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/validation-outcome-status
Aug 5, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/validation-outcome-status

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

Summary

  • classify_tool_content() decided pass/fail by substring-matching rendered tool output, and ToolOutput's exit_code/is_error were dropped before reaching Message/the TUI — so a failed, denied, cancelled, or unstartable validation command could render with a green checkmark or the literal text "Validation completed" regardless of what actually happened.
  • Introduces a single ExecutionOutcome enum (Success | Failed | SpawnFailed | Denied | Cancelled | TimedOut) in forge-types, threaded end-to-end from ToolOutput → Message → the TUI, replacing substring detection with the real result. Denied is modeled as terminal/negative, distinct from the pre-existing Blocked (pending/HITL-awaiting) state.
  • Adds a completion gate in AgentSession::apply_model_response that fails a turn if any evidence entry errored, independent of which TaskExpectation category classify_turn matched — closing the gap where a successful write_file plus a failing validation bash call in the same turn could still read Completed, since classify_turn only consults one category's evidence by precedence.
  • forge-tui: failed validation commands still group under "Validating" (consistent UX with the passing case) but the group turns Failure-colored with real copy — Tests passed / Tests failed · exit code N / Tests failed · command not found / Validation skipped · denied / Validation cancelled / Validation timed out. New amber icons for Denied/TimedOut, distinct from red for actual failures.
  • TimedOut is a stub only (type, icon, copy, tests) — no real deadline/timeout enforcement exists yet; that's a separate follow-up.

Test plan

  • cargo test --workspace — all green except two pre-existing, unrelated failures on this machine: forge-config permissions tests (read real repo permission files, documented pre-existing issue) and one order-dependent forge-connect OAuth fixture test (passes on rerun in isolation)
  • cargo clippy --workspace --all-targets clean
  • cargo fmt --all -- --check clean
  • New regression tests cover exit code 0, non-zero exit, exit 127 (command not found), ACL denial, HITL denial, and the cross-category same-turn gate, verifying transcript/tool-block/task-status/icon/final-response all agree

classify_tool_content() decided pass/fail by substring-matching rendered
text, and ToolOutput's exit_code/is_error were dropped before reaching
the TUI, so a failed, denied, cancelled, or unstartable command could
render with a green checkmark or "Validation completed" regardless of
what actually happened.

Introduce a single ExecutionOutcome enum (Success/Failed/SpawnFailed/
Denied/Cancelled/TimedOut) threaded end-to-end from ToolOutput through
Message into the TUI, replacing substring detection with the real
result. Add a completion gate in apply_model_response that fails a turn
if any evidence entry errored, regardless of which TaskExpectation
category classify_turn matched — closing the gap where a successful
file edit plus a failing validation command in the same turn could
read Completed.
@github-actions
github-actions Bot enabled auto-merge (squash) August 5, 2026 06:14
@github-actions
github-actions Bot merged commit 6b3b61d into main Aug 5, 2026
7 checks passed
mohitranka added a commit that referenced this pull request Aug 21, 2026
classify_tool_content() decided pass/fail by substring-matching rendered
text, and ToolOutput's exit_code/is_error were dropped before reaching
the TUI, so a failed, denied, cancelled, or unstartable command could
render with a green checkmark or "Validation completed" regardless of
what actually happened.

Introduce a single ExecutionOutcome enum (Success/Failed/SpawnFailed/
Denied/Cancelled/TimedOut) threaded end-to-end from ToolOutput through
Message into the TUI, replacing substring detection with the real
result. Add a completion gate in apply_model_response that fails a turn
if any evidence entry errored, regardless of which TaskExpectation
category classify_turn matched — closing the gap where a successful
file edit plus a failing validation command in the same turn could
read Completed.
mohitranka added a commit that referenced this pull request Sep 11, 2026
classify_tool_content() decided pass/fail by substring-matching rendered
text, and ToolOutput's exit_code/is_error were dropped before reaching
the TUI, so a failed, denied, cancelled, or unstartable command could
render with a green checkmark or "Validation completed" regardless of
what actually happened.

Introduce a single ExecutionOutcome enum (Success/Failed/SpawnFailed/
Denied/Cancelled/TimedOut) threaded end-to-end from ToolOutput through
Message into the TUI, replacing substring detection with the real
result. Add a completion gate in apply_model_response that fails a turn
if any evidence entry errored, regardless of which TaskExpectation
category classify_turn matched — closing the gap where a successful
file edit plus a failing validation command in the same turn could
read Completed.
mohitranka added a commit that referenced this pull request Sep 11, 2026
classify_tool_content() decided pass/fail by substring-matching rendered
text, and ToolOutput's exit_code/is_error were dropped before reaching
the TUI, so a failed, denied, cancelled, or unstartable command could
render with a green checkmark or "Validation completed" regardless of
what actually happened.

Introduce a single ExecutionOutcome enum (Success/Failed/SpawnFailed/
Denied/Cancelled/TimedOut) threaded end-to-end from ToolOutput through
Message into the TUI, replacing substring detection with the real
result. Add a completion gate in apply_model_response that fails a turn
if any evidence entry errored, regardless of which TaskExpectation
category classify_turn matched — closing the gap where a successful
file edit plus a failing validation command in the same turn could
read Completed.
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.

1 participant