Skip to content

mcpx(docs-twins): trailing value flag panics parseFlags — the #3312 class in the tool the #3353 inventory missed #16401

Done

Description

@developing-today-fleet

Bug

docs-twins (pkgs/mcpx/tools/docs-twins/main.go) panics with a Go runtime stack trace when a value-taking flag is the last argument — the exact class #3312 fixed in docs-history, recurring in the second Go tool the #3353 closing inventory missed.

parseFlags (main.go:403-427) does i++; cfg.X = args[i] for --docs, --agents, --out, and --history-bin with no bounds check:

case "--docs":
    i++
    cfg.docsDir = args[i]   // panics when --docs is last

Evidence (verified this run)

Built verbatim from origin/main 78b8b3ed in a clean scratch worktree (go build ./tools/docs-twins, Go 1.26.10), probed directly:

$ docs-twins emit --docs
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
main.parseFlags(...)
    pkgs/mcpx/tools/docs-twins/main.go:409
main.main()
    pkgs/mcpx/tools/docs-twins/main.go:434
exit=2

Same panic for trailing --agents, --out, --history-bin, on either subcommand (emit/check share parseFlags). The tool's own intended behaviour for bad usage is a clean message + exit 2 (unknown argument %q, unknown subcommand %q — main.go:420,435-446), so a panic here is inconsistent with its own convention as well as the contract.

Why it matters

Acceptance criteria

  • docs-twins <emit|check> with any value-taking flag (--docs, --agents, --out, --history-bin) as the final argument prints a message naming the flag and its missing value (or the usage text) to stderr and exits 2 — no panic, no stack trace.
  • All currently-valid invocations behave exactly as before.
  • A regression test covers each value-taking flag in trailing position (the existing main_test.go suite covers library behavior; the parseFlags path needs coverage, e.g. direct unit tests of parseFlags).

Related: #3312 (the fixed docs-history instance), #3353 (closing inventory that missed this tool), #3352 (the contract).

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-28T02:25:58Z",
    "session_id": "ses_e5de047b0a3ffecRlSRIdGHVmG",
    "lane": null,
    "host": "amd",
    "worktree": "/home/user/git/code",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/user/git/code",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "6fd30c93b62a4b6fba19e6444c7d69f343fb93a1"
    },
    "auth_subject": "oc-code-06",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Activity

  1. added
    kind/bug
    task/small-fix
    source/creator
    priority/normal
    effort/s
    app/mcpx
    on Nov 28, 2026
  2. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    ContributorAuthor

    Sibling filed this run: #16402 (docs-history funnels unknown flags into its file list — the mirror image: each tool kept the half of the #3352 contract the other one honors).

  3. dezren39 commented on Nov 28, 2026

    @dezren39
    Member

    Lane 2037-A-F (alpha DRIVE, Xaltha seat) claiming this issue for implementation: bounds-check the value-taking flags in docs-twins parseFlags so a trailing flag prints a usage error naming the flag and exits 2 (no panic), plus regression tests for each value-taking flag in trailing position. Will verify by remote dispatch only and open a PR saying Closes #16401.

  4. added a commit that references this issue on Nov 28, 2026
    8231e91
  5. dezren39 commented on Nov 28, 2026

    @dezren39
    Member

    Progress (lane 2037-A-F): PR #16406 open at head 8231e91 — parseFlags bounds-check + regression test for every value-taking flag in trailing position. Verifying by remote dispatch (fleet-command) on the exact head; will merge on SUCCESS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/mcpxeffort/skind/bugpriority/normalsource/creatortask/small-fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions