Repository navigation
feat: background runs, stop, and JSON errors for agent use - #17
Merged
Merged
Conversation
- `harness2 run --detach` starts the same run as a background process,
logging to <run>/run.log, and returns its name, pid and log path at
once (an immediate failure is reported with the log's tail).
- A running run records itself in <run>/run.pid; a second start of the
same run is refused, and `harness2 stop [NAME]` asks it to stop: the
calls in flight finish, the run exits, and rerunning resumes it. Only
a detached run's own process group is signalled, never the shell or
agent that launched a foreground run.
- With --json, a failing command prints {"error", "exit_code"} on
stdout instead of an error line; `diff --json` returns the changes
and per-file diffs.
- `apply -i` and `chat` refuse to start without a terminal instead of
waiting for input, and the agent guide says how to change init's
choices with `config set`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The run-control half of the agent-friendliness work. #16 was the guide half.
run --detach: re-launches the same run as a background session leader that logs to<run>/run.log, and returns name, pid and log at once. A child that fails immediately is reported with the log's tail.<run>/run.pid: written while a run is going. A second start of the same run is refused, and stale pid files are cleaned up.harness2 stop [NAME]: sends SIGINT, so the calls in flight finish and a rerun resumes. A detached run's whole process group is signalled. A foreground run gets the signal only for its own process, because its group may contain the shell or the agent that launched it.--jsonerrors: printed as{"error", "exit_code"}on stdout.diff --json: returns{label, changes, diffs}.apply -iandchatrefuse to start without a terminal instead of hanging.init's non-TTY defaults are documented in the guide, together withconfig setfor changing them.Test plan
diff --json)ruff🤖 Generated with Claude Code