Repository navigation
Description
Problem
Each host-setup/linux script refuses an argument through die, which exits 1. That is the same status a run that failed part way exits with, so a caller cannot tell "the arguments were refused, nothing ran" from "the run started and failed". CODESTYLE.md "Classify a subprocess failure by which command failed and the status code it reports, never by the prose of its message" rules out telling them apart from the ERROR: line.
A downstream wrapper needs that distinction. ptr727/HomeAutomation-Config fetches upgrade-host.sh and install-tools.sh, runs each with every argument it was given, and then runs a step of its own. It brings the agent tools current after an upgrade run, and it queues a tool-check restart after an install run. The maintainer decided on ptr727/HomeAutomation-Config#1466 that the wrapper skips that step where the hub refused its arguments, and still runs it after a real failure, such as a package failure. Today upgrade-host.sh --dryrun, one hyphen short, is refused by the hub, exits 1, and the wrapper upgrades the agent tools for real.
Refusal sites
Every one of these exits 1 today:
upgrade-host.sh: an unknown option, and more than one action.install-tools.sh: an unknown option,--repowith no path, more than one action,--jsonwith an action other than--report,--sudo-timestampwith a tool, and an unknown tool name, whichresolve_selectionrefuses after parsing.install-agents.sh: an unknown option, more than one action,--jsonwith an action other than--report, and an unknown tool name.setup-github.sh: an unknown option,--name,--email, or--shared-checkoutwith no value, and more than one action.install-skills.sh: an unknown option.
Proposal
Give a refused argument an exit status of its own, reserved for it, in every host-setup/linux script, and state it in each script's --help and in CODESTYLE.md "Command-Line Arguments".
- Refuse through a
die_usage(or similar) that exits the reserved status, used at every site above and nowhere else. - Reserve the status as well as assigning it. Under
set -ea failed command's own status becomes the script's, so a reserved value can still escape from an unrelated failure, such as agrepread error exiting 2. AnEXITtrap that maps any other exit carrying the reserved value to 1 keeps the contract whole. - 2 matches what
argparseexits for a refused argument in the fleet's Python scripts, and 64 isEX_USAGEfromsysexits.h. Which one is the hub's call. The trap above is what makes either value safe.
Done
Each script exits the reserved status for every refusal listed above and for no other failure. A test runs each refusal and a failure that would otherwise carry the reserved value, and asserts the status. The status is named in each --help and in "Command-Line Arguments", so a caller reads it as a contract.
Activity
ptr727 commentedon Nov 1, 2026
Decision needed (decision triage, 2026-11-01)
Question: When
host-setup/linuxscripts (upgrade-host.sh,install-tools.sh,install-agents.sh,setup-github.sh,install-skills.sh) refuse an argument through a newdie_usage, should the reserved exit status be 2 (argparse parity) or 64 (EX_USAGE)?Options, recommended first:
set -e), so the EXIT trap would remap a stray 2 far more often, and a caller seeing 64 knows it was a refusal. Unblocks the downstream wrapper decided on HomeAutomation-Config#1466. No work in flight.Evidence: Every refusal site uses
die, exiting 1 (install-tools.sh:71, upgrade-host.sh:43, install-agents.sh:43, setup-github.sh:58, install-skills.sh:28). Noexit 64orEX_USAGEanywhere. Exit 2 means a non-refusal in scripts/handoff.py:1552-1557, pr_merge.py:166, host_gate.py:576, local_review.py:99 ("2 means the check itself did not run"). CODESTYLE.md "Command-Line Arguments" requires only "a non-zero exit". The maintainer's 2026-10-29 decision on HomeAutomation-Config#1466: wrappers use "the hub's refusal status first".Blocks: ptr727/HomeAutomation-Config#1466 (cross-repo)
ptr727 commentedon Nov 1, 2026
Maintainer answer (decision triage, 2026-11-01): Option 1: reserve exit status 64 (EX_USAGE) for a die_usage refusal in the host-setup/linux scripts. This unblocks ptr727/HomeAutomation-Config#1466 once it lands. This is now work for the next burndown round.
ptr727 commentedon Nov 23, 2026
Backlog burndown claim (round 5, 2026-11-23): branch
burndown/host-setup-usage-exit.Predicted files: host-setup/linux/{upgrade-host,install-tools,install-agents,setup-github,install-skills,install-global-rules,install-safety-kit,restore-secrets}.sh, host-setup/linux/README.md, CODESTYLE.md, tests/{test_install_tools,test_install_agents,test_setup_github,test_upgrade_host,test_global_rules,test_restore_secrets,test_cli_usage}.py.
Group issues: #3605.
Reserve Exit Status 64 for a Refused Argument in the host-setup/linux…