Skip to content

fix(AC-331): print errors to console in non-JSON CLI mode#445

Merged
jayscambler merged 3 commits intomainfrom
fix/ac-331-silent-exit
Mar 17, 2026
Merged

fix(AC-331): print errors to console in non-JSON CLI mode#445
jayscambler merged 3 commits intomainfrom
fix/ac-331-silent-exit

Conversation

@jayscambler
Copy link
Contributor

Summary

autoctx run silently exited code 1 when exceptions occurred without --json, producing no stdout or stderr. This made L11/L12 escalation scripts impossible to debug.

Root Cause

Exception handlers only wrote errors in JSON mode:

except Exception as exc:
    if json_output:
        _write_json_stderr(str(exc))
    raise typer.Exit(code=1) from exc  # non-JSON: nothing printed!

Fix

Added else branches to all three run command exception handlers (agent-task, generation runner, resume):

else:
    console.print(f"[red]Error: {exc}[/red]")

Test plan

  • 3 tests: error visible in non-JSON, interrupt visible in non-JSON, JSON mode unchanged
  • ruff clean, full suite 4389 passed

autoctx run silently exited with code 1 when exceptions occurred and
--json was not passed. Error handlers only wrote to stderr in JSON
mode; in default (Rich console) mode, no output was produced.

Fixed all three run paths (agent-task, generation runner, resume):
- Exception: console.print(f"[red]Error: {exc}[/red]")
- KeyboardInterrupt: console.print("[yellow]Run interrupted.[/yellow]")

JSON mode continues writing to stderr as before.

3 tests: non-JSON error printed, non-JSON interrupt printed, JSON mode
still works.
@linear
Copy link

linear bot commented Mar 17, 2026

@jayscambler jayscambler merged commit 5704231 into main Mar 17, 2026
4 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.

1 participant