Found in review of #1: the fork needs its own tag for go install; smaller findings #7

Merged
city-root merged 1 commit from worker/claudeacp-hlp into main 2026-11-12 13:08:09 +00:00
Contributor

Fixes item 3 of claudeacp-hlp (items 1 and 2 were settled by the v0.4.0 release and the cancelled CI run).

What changed

  • claudeagent.CheckArgs refuses --sdk-url, --teleport and --worktree/-w. I checked them against claude 2.1.322, which names all three: --sdk-url takes the stream-JSON I/O to a WebSocket, --teleport resumes a session, and --worktree runs claude outside the session's folder.
  • It refuses a subcommand or prompt after any option, not only as the first argument: claudeacp --verbose mcp and claudeacp --model opus agents used to pass as "a flag's value" and then fail every session. It knows claude's options that take no value, or one value, from --help. A list or optional-value option, or one it doesn't know, takes the arguments after it for its values, so a new claude flag is never refused for its value. A subcommand after an unknown option still slips by, as before.
  • README's list of refused options and the changelog's Unreleased section say so. The changelog line is in the same section as the other open changes: rebase if the other pull request merges first.

Verified

  • go vet ./... and go test ./... pass. TestCheckArgs and TestCheckClaudeArgs cover the new refusals and the values that stay accepted.

Bead: claudeacp-hlp

Fixes item 3 of claudeacp-hlp (items 1 and 2 were settled by the v0.4.0 release and the cancelled CI run). **What changed** - `claudeagent.CheckArgs` refuses `--sdk-url`, `--teleport` and `--worktree`/`-w`. I checked them against claude 2.1.322, which names all three: `--sdk-url` takes the stream-JSON I/O to a WebSocket, `--teleport` resumes a session, and `--worktree` runs claude outside the session's folder. - It refuses a subcommand or prompt after any option, not only as the first argument: `claudeacp --verbose mcp` and `claudeacp --model opus agents` used to pass as "a flag's value" and then fail every session. It knows claude's options that take no value, or one value, from `--help`. A list or optional-value option, or one it doesn't know, takes the arguments after it for its values, so a new claude flag is never refused for its value. A subcommand after an unknown option still slips by, as before. - README's list of refused options and the changelog's Unreleased section say so. The changelog line is in the same section as the other open changes: rebase if the other pull request merges first. **Verified** - `go vet ./...` and `go test ./...` pass. `TestCheckArgs` and `TestCheckClaudeArgs` cover the new refusals and the values that stay accepted. Bead: claudeacp-hlp
fix: refuse --sdk-url, --teleport, --worktree and a subcommand after any option (claudeacp-hlp)
All checks were successful
CI / Changelog (pull_request) Successful in 5s
CI / Lint (pull_request) Successful in 31s
CI / Test (pull_request) Successful in 35s
618a67a709
The reviewing agent of #1 found that claudeacp let through three claude options that change where claude runs or speaks, and a subcommand or prompt that follows an option. Item 3 of claudeacp-hlp stood after the fork's tag (item 1) and the cancelled CI run (item 2) were settled elsewhere.

I checked the options against claude 2.1.322, whose binary names all three: --sdk-url (a WebSocket endpoint for stream-JSON I/O, in place of stdio), --teleport (resumes a teleport session) and --worktree/-w (runs claude in a worktree of its own, not the session's folder). CheckArgs refuses them, in the spellings claude takes (--flag=value, -w).

A subcommand after an option, such as `--verbose mcp`, passed as "a flag's value", since CheckArgs could not tell a value from a subcommand. It now knows claude's options that take no value (from --help) and the ones that take one, and refuses an argument that follows one that takes no more. An option it does not know, or one that takes a list or an optional value, takes the arguments after it for its values, so a flag claude adds later is never refused for its value. The cost is that a subcommand after an unknown option still slips by, as before.

Validation: go vet and go test ./... pass; TestCheckArgs and TestCheckClaudeArgs cover the new cases, including values of unknown, list and optional-value options that stay accepted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review left a comment

Review of 618a67a709 for claudeacp-hlp (item 3). Checks of the head: success.

Verdict

pass

Findings

  • [minor] claudeagent/options.go:320: a short option with its value attached, such as -nfoo, is cut to -n and then taken to still need one value, so -nfoo mcp passes CheckArgs. Claude's parser takes foo as -n's value and mcp as a subcommand. This only lets something through, it never refuses a good command line, and it is the same kind of gap the description admits for unknown options. A fix: for a known one-value short option with characters after it, set values = 0.
  • [minor] claudeagent/options.go:266: claude 2.1.322 has more options that move the session away from the agent's stdio: --bg/--background (returns at once), --cloud, --environment, --desktop and --remote-control. The bead names only three flags and the change refuses those, so these belong in a follow-up, not in this pull request.

Verified

  • Read work bead claudeacp-hlp (item 3 and the Operator's notes), the PR description, and the whole diff: 5 files, +71/−8. main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read the README from main.
  • Compared refusedFlags, booleanFlags and oneValueFlags with claude --help of the installed claude 2.1.322. Every flag in booleanFlags takes no value there. Every flag in oneValueFlags takes exactly one required <value>. The list and optional-value options (--add-dir, --allowedTools, --betas, --disallowedTools, --file, --mcp-config, --tools, --debug, --cloud, --prompt-suggestions, --remote-control) are in neither map, so they keep the permissive -1. No boolean option of claude's is missing (the ones that are absent are already refused). --sdk-url, --teleport [session] and -w, --worktree [name] exist as described.
  • Traced the two CheckArgs calls in claudeacp/cliargs.go:45,74 (the full arguments, then what remains after the named options come out). Taking out --model/--effort/--permission-mode/--settings and their values, or --dangerously-skip-permissions, can only make the second call more permissive than the first. It never refuses what the first accepted.
  • Ran CheckArgs on edge cases in a throwaway test, since removed. --tmux classic and --add-dir=/a /b are refused, which matches commander: --tmux is boolean, and a = value ends a variadic option. --debug api mcp, --model -x mcp, repeated --plugin-dir, and a variadic followed by values all pass. -nfoo mcp passes (finding 1).
  • The merge into origin/main (0b021a3) is a fast-forward with no conflict. mergeable: mergeable.
  • In the merged tree, with the city's variables removed: go build ./..., go vet ./... and go test -race -shuffle=on ./... all OK; golangci-lint v2.15.0 reported 0 issues; govulncheck v1.9.0 found no vulnerabilities. I built the changelog checker from mikluko/changelog at 7ec45bb (v1.6.0), the action CI pins, and ran it: valid=true. The new line is under [Unreleased] › Changed.
  • README's list of refused options and the changelog describe the change accurately.
Review of 618a67a70961f625652f8296d9fb918c0033b12c for claudeacp-hlp (item 3). Checks of the head: success. ### Verdict pass ### Findings - [minor] claudeagent/options.go:320: a short option with its value attached, such as `-nfoo`, is cut to `-n` and then taken to still need one value, so `-nfoo mcp` passes CheckArgs. Claude's parser takes `foo` as `-n`'s value and `mcp` as a subcommand. This only lets something through, it never refuses a good command line, and it is the same kind of gap the description admits for unknown options. A fix: for a known one-value short option with characters after it, set `values = 0`. - [minor] claudeagent/options.go:266: claude 2.1.322 has more options that move the session away from the agent's stdio: `--bg`/`--background` (returns at once), `--cloud`, `--environment`, `--desktop` and `--remote-control`. The bead names only three flags and the change refuses those, so these belong in a follow-up, not in this pull request. ### Verified - Read work bead claudeacp-hlp (item 3 and the Operator's notes), the PR description, and the whole diff: 5 files, +71/−8. main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read the README from main. - Compared `refusedFlags`, `booleanFlags` and `oneValueFlags` with `claude --help` of the installed claude 2.1.322. Every flag in `booleanFlags` takes no value there. Every flag in `oneValueFlags` takes exactly one required `<value>`. The list and optional-value options (`--add-dir`, `--allowedTools`, `--betas`, `--disallowedTools`, `--file`, `--mcp-config`, `--tools`, `--debug`, `--cloud`, `--prompt-suggestions`, `--remote-control`) are in neither map, so they keep the permissive `-1`. No boolean option of claude's is missing (the ones that are absent are already refused). `--sdk-url`, `--teleport [session]` and `-w, --worktree [name]` exist as described. - Traced the two CheckArgs calls in `claudeacp/cliargs.go:45,74` (the full arguments, then what remains after the named options come out). Taking out `--model`/`--effort`/`--permission-mode`/`--settings` and their values, or `--dangerously-skip-permissions`, can only make the second call more permissive than the first. It never refuses what the first accepted. - Ran CheckArgs on edge cases in a throwaway test, since removed. `--tmux classic` and `--add-dir=/a /b` are refused, which matches commander: `--tmux` is boolean, and a `=` value ends a variadic option. `--debug api mcp`, `--model -x mcp`, repeated `--plugin-dir`, and a variadic followed by values all pass. `-nfoo mcp` passes (finding 1). - The merge into origin/main (0b021a3) is a fast-forward with no conflict. mergeable: mergeable. - In the merged tree, with the city's variables removed: `go build ./...`, `go vet ./...` and `go test -race -shuffle=on ./...` all OK; golangci-lint v2.15.0 reported 0 issues; govulncheck v1.9.0 found no vulnerabilities. I built the changelog checker from mikluko/changelog at 7ec45bb (v1.6.0), the action CI pins, and ran it: valid=true. The new line is under [Unreleased] › Changed. - README's list of refused options and the changelog describe the change accurately.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/claudeacp!7
No description provided.