Skip to content

opencode-config-normalize: an inline // or /* */ comment anywhere in opencode.jsonc silently disables every repair — the probe stripper only removes full-line comments, the parse fails, and the script exits 0 #3179

Closed

Description

@dezren39

Problem

pkgs/opencode-config-normalize/normalize.sh silently performs no repair at all on an opencode.jsonc that contains an inline // comment or a /* */ block comment — the two comment forms JSONC allows anywhere, and the forms a hand-edited user config most often contains. The config keeps its v2 plugins/agents keys, which opencode 1.x ignores (the script's own header documents this), so the user's plugins/agents stay broken while the path-unit trigger reports nothing.

Evidence (verified this run, main fc88d0a9, script sha256 c59dd79b…)

  • normalize.sh:36-41: the membership probe strips only full-line comments — re.sub(r'^\s*//.*$', '', raw, flags=re.M) — then json.loads(probe); on any exception it does sys.exit(0) ("unparseable: leave it alone"). An inline comment after a value, or a /* */ block, is not stripped, so the parse fails and the script exits 0 having changed nothing. The same weak probe is reused for the pre-write verification at lines 108-109.
  • Laptop probe (~/git/fleet/probe-2026-10-31-laneA-normalize/, verbatim copy of the script, sha-matched to main):
    • Case A: config with "plugins": ["opencode-plugin-x"] // migrated by OpenChamber → exit 0, file byte-identical, plugins still present.
    • Case A2: config with a /* user config */ header comment and "plugins": [...] → exit 0, file byte-identical, plugins still present.
    • Control case B (no comments) repairs correctly, proving the fixtures are otherwise in the script's recognised shape.

Why it matters

The script exists because OpenChamber rewrites the config to v2 spellings and v1 opencode silently ignores them. A user who annotates their config — the normal thing to do in a JSONC file — falls entirely outside the repair, with no log line, no non-zero exit, and no way to tell the normalizer gave up versus found nothing to do. The failure is silent in exactly the population (hand-editors) most likely to also hand-merge OpenChamber's rewrites.

Acceptance criteria

  • A config whose only JSONC features are inline // comments is repaired the same as the comment-free equivalent (full parsed-document equality, as in normalize_test.sh).
  • A config with a /* */ block comment is repaired likewise, or — if block comments are deliberately out of scope — the script says so in its header and the limitation is covered by an explicit test fixture asserting the untouched-exit-0 behaviour.
  • Comment stripping is string-aware: a // or /* sequence inside a string value (e.g. a URL or prompt) is never treated as a comment, and a ,} / ,] sequence inside a string is never treated as a trailing comma (the current regex probe at line 37 has the same string-blindness — cf. closed sync-models: naive parseJsonc line-stripper breaks on block comments and string contents — multi-line /* */ or a ' // ' string fails the sync, a ', ]' string is silently corrupted #704 for the same failure in the sync-models stripper).
  • New fixtures in normalize_test.sh cover inline-comment, block-comment, and comment-like-text-inside-a-string configs, asserting full parsed documents and idempotence.
  • All existing normalize_test.sh cases still pass, including the byte-identical-on-failure contract.

Dedup

Searched open + closed for opencode-config-normalize / normalize.sh: #2364 (closed) is the agents-drop data-loss bug, fixed with the verification block this issue builds on; #704 (closed) is the same string-blind stripper class in a different tool (sync-models). No existing issue covers this script's comment handling.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    app/opencode-config-normalizePackage/app: opencode-config-normalize (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 31, 2026
  2. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-10-31 13:05 CDT
    • Found via: filed this run
    • Task: Triage the JSONC comment gap in pkgs/opencode-config-normalize/normalize.sh (inline // and /* */ comments silently disable all repairs)
    • Expectation: effort/s — string-aware comment handling (or an explicit documented limitation) plus normalize_test.sh fixtures; done when a commented config repairs to the same parsed document as its comment-free twin
    • Links: probe ~/git/fleet/probe-2026-10-31-laneA-normalize/ (laptop); queue packet enqueued this run
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  4. 15 remaining items

  5. added
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  6. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  8. removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    status/readyTriaged and ready for queued implementation work
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/opencode-config-normalizePackage/app: opencode-config-normalize (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions