Skip to content

feat: exit statuses and error messages an agent can act on - #15

Merged
AustinMusiku merged 10 commits into
masterfrom
exit-status
Nov 6, 2026
Merged

AustinMusiku merged 10 commits into
masterfrom
exit-status

Conversation

@AustinMusiku

Copy link
Copy Markdown
Owner

The exit status now tells a script, or an agent, whether it called timeline wrong or whether the server failed, without having to parse stderr. Error messages say what went wrong in words a caller can act on, and curl flags that timeline lacks say what to use instead.

Status Meaning
0 Every request got a response, 4xx and 5xx included
1 At least one request failed
2 A flag, argument or file was wrong, and nothing was sent
130, 143 Ctrl-C or SIGTERM stopped the run

Breaking: a bad flag, argument or config file used to exit 1 and now exits 2. Scripts that check for exactly 1 need updating.

Exit status

  • Nothing sent on 2: any error that isn't wrapped as a post-send error exits 2, so new error paths default to "nothing was sent". A test counts hits on the server to check that.
  • Config file: a broken config file no longer calls os.Exit from initConfig. It's returned from PersistentPreRunE, so it exits 2 like other errors and is prefixed --config: when that flag named it.
  • Interrupts: the run uses context.WithCancelCause in place of signal.NotifyContext, so the signal is known and the status is 128 plus its number. An interrupted run still draws what it collected, and with --json those lines are already written. The password prompt exits the same way.

Wording

  • Request failures: timed out after 1s instead of context deadline exceeded, and interrupted for requests that Ctrl-C stopped.
  • Flag values: --repeat wants a whole number, not "abc" and --timeout wants a duration such as 5s or 500ms, not "5", built from pflag's typed errors in cmd/flagerror.go.
  • Files: read errors name the flag, as in --data: open body.json: no such file or directory, and likewise for --file.
  • Missing values in .http files: when the earlier request got an error status, the message says so: login got 401 and the body has no access_token.
  • URLs: "example.com" needs http:// or https:// in front, "http:/example.com" has no host, and "ftp://example.com" is not an http or https URL.

curl flags

  • -L, -s, -S, -o, -w, -v, -i, -I, -m, -b and -A are errors that say what timeline does instead, for example that redirects are followed already, or to use --timeout instead of -m.
  • --compressed is a hidden flag that does nothing, since timeline asks for gzip already. "Copy as cURL" adds it, so pasted commands now work.

The README and --help describe the exit status, --compressed and the curl flags.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 11:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@AustinMusiku
AustinMusiku merged commit 06ef0c1 into master Nov 6, 2026
1 check 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.

2 participants