pr-af icon indicating copy to clipboard operation
pr-af copied to clipboard

pr-af --help starts the node and registers it instead of printing usage

Open AbirAbbas opened this issue 3 weeks ago • 0 comments

What happened

pr-af --help (and -h) does not print help: the Go node has no flag parsing, so it starts serving. With the defaults it binds port 8007 and registers with AGENTFIELD_SERVER, which defaults to http://localhost:8080, i.e. it joins whatever local control plane is running. Someone checking the binary's usage can accidentally register a node.

Replication

Without a control plane: AGENTFIELD_SERVER=http://127.0.0.1:9 PORT=18907 ./pr-af --help; echo $? prints pr-af: serve: initialize node …: register node: … connection refused and exits 1.

Where

go/cmd/pr-af/main.go never reads os.Args.

The fix

Parse arguments: -h / --help / --version print and exit 0 without starting; an unknown argument is an error that also does not start the node. Running with no arguments keeps today's behaviour.

Acceptance

pr-af --help exits 0, prints usage, binds no port and makes no request; pr-af with no arguments starts exactly as today.

AbirAbbas avatar Nov 13 '26 00:11 AbirAbbas