Repository navigation
fix(cmd_connect): reject unknown flags instead of treating as positional name - #534
Merged
Merged
Conversation
Pre-fix `cmd_connect`'s arg loop had a single `*) positional+=("$1")` arm
that silently accepted any unrecognized `--<flag>` as a positional. That
positional then became `target` in the parser tail, which became host-mode
`name` (line 1733: `local name="${target:-}"`), which got persisted to
config.json `name` field (line 1740: `set_config_val name "$name"`).
Observed in the wild: continuum-8e97 on Windows ran `airc join --background`
and got "Hosting as '--background'", with config.json `name` field
persisted as `"--background"`. Identity stayed corrupted across `airc
teardown` + `airc join` cycles; only manual JSON edit recovered it.
Same shape as the original `--attach` leak (#511/#521). The PR #521 belt
at lines 584-594 strips `--attach` specifically from positional[]. This
generalizes the defense to ALL unrecognized flags.
Inline invites, gist ids, and humanhash mnemonics never start with `-`,
so the rejector cannot eat a legitimate positional. The known `--attach`
recovery belt is preserved (encoding-corrupted variants still recover).
Adds scenario_join_rejects_unknown_flag to test/integration.sh covering
exit code, stderr message, host-setup-not-started, and config-not-written
assertions. Test runs on the same path as #533's HUP regression test.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
Author
|
Codex review found and fixed one first-run/Codex-specific masking bug before merge. Initial #534 behavior was correct in plain shell, but in Codex the join dispatch routed through I pushed
Local validation after the amendment:
This is now mergeable once CI reruns green. |
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
cmd_connect's arg loop had a single*) positional+=("$1")arm that silently accepted any unrecognized--<flag>as a positional. The accepted positional becametarget(line 1733:local name="${target:-}"), then host-modename, which got persisted toconfig.jsonnamefield.Observed in the wild today (2026-05-06): continuum-8e97 on Windows ran
airc join --background(a documented-as-not-a-flag arg) afterairc teardownand got:config.jsonthen had"name": "--background", and identity stayed corrupted acrossairc teardown+airc joincycles. Manual JSON edit was the only recovery — exactly the failure mode #511/#521 fixed for--attachspecifically.Fix
Add an explicit
-*)arm incmd_connect's flag loop (lib/airc_bash/cmd_connect.sh:574) that rejects unknown flags loudly withreturn 2and a stderr message. Inline invites, gist ids, and humanhash mnemonics never start with-, so the rejector cannot eat a legitimate positional. The existing PR #521 belt for encoding-corrupted--attachis preserved.Tests
Adds
scenario_join_rejects_unknown_flagtotest/integration.shcovering:airc join --background --no-room --no-gistconfig.jsonis not poisonedLocal run on Windows WSL2 (Ubuntu, canary 2357f7b base):
Adjacent regressions also re-checked clean:
Related
--attachidentity-leak issue--attachfrom positional[])🤖 Generated with Claude Code