GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mcpx(scripting): Validate condemns valid scripts whose regex literals contain a quote, delimiter or comment-like sequence — the delimiter scanner has no regex state · Issue #1659 · developing-today/code

mcpx(scripting): Validate condemns valid scripts whose regex literals contain a quote, delimiter or comment-like sequence — the delimiter scanner has no regex state #1659

New issue
Copy link
New issue
Copy link
Closed
Closed
mcpx(scripting): Validate condemns valid scripts whose regex literals contain a quote, delimiter or comment-like sequence — the delimiter scanner has no regex state#1659
Copy link
Assignees
dezren39
Labels
app/mcpxPackage/app: mcpx (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

Description

@dezren39
dezren39
opened on Oct 28, 2026
Issue body actions

Summary

mcpx's script validator promises, in its own doc comment, that "it never marks a valid script as invalid" — but its delimiter/string scanner has no regex-literal state, so perfectly valid TypeScript whose regex literals contain a quote, a delimiter, or a comment-like sequence is reported fatally invalid:

  • const re = /"/; → the " inside the regex opens a string that runs to the newline: "unclosed string literal".
  • const re = /\(/; → the escaped ( is pushed as an opening delimiter: "unclosed delimiter '('".
  • const re = /}/; → the } is an "unmatched closing delimiter".
  • const re = /'/; → same false string opening as the double-quote case.
  • const re = /\/*/; → the escaped slash followed by a bare * reads as a /* comment opener: "unclosed multi-line comment", and the rest of the script is swallowed as comment.
  • const re = /[)]/; → the ) inside a character class "mismatches" the class's [.

Validate is not advisory: the daemon's diagnose route returns its verdict (and triggers repair on fatal), the intent route returns a generated script unrun when its diagnostics are fatal, and scripting.Repair/Synthesize reject any model-produced candidate that fails Validate. A user (or a model) who writes an ordinary regex — splitting on /\s*,\s*/ is fine, but matching a quote, a paren, or a comment marker is not — gets a valid script refused, repaired-against, or bounced, with an error that blames a string/delimiter the script does not contain.

Evidence (verified on main adb8ceaa, this run)

Two independent halves, both checked this run:

  1. Every snippet below is valid JavaScript: each was passed through node --check this run (all six BUG sources and the division control parse cleanly), and a regex literal after = is an expression position, so the regex reading is the only reading.
  2. The validator's verdict on each follows deterministically from checkSyntaxAndDelimiters (validator.go:103-242), traced character by character this run: the scanner's only states are line comment, block comment and the three string kinds; a / is examined solely as a comment opener, quotes open strings wherever they appear outside a string/comment, delimiters are pushed/popped wherever they appear outside a string/comment, and backslash escapes are honoured only inside strings. There is no path through the function that treats a regex literal as opaque. Results:
    • CTRL plain code, division (10 / 2 / 5), delimiters/quotes inside strings and inside a // comment → Valid=true (strings/comments are opaque, division slashes are inert).
    • BUG-A const re = /"/; → Valid=false, fatal "unclosed string literal" (the " inside the regex opens a string that runs to the newline).
    • BUG-B const re = /\(/; → Valid=false, fatal "unclosed delimiter '('" (the escaped paren is pushed; the only later parens are test('s own balanced pair).
    • BUG-C const re = /}/; → Valid=false, fatal "unmatched closing delimiter".
    • BUG-D const re = /\/*/ → Valid=false, fatal "unclosed multi-line comment" (the escaped slash + * quantifier reads as /*; no */ follows anywhere in the script, so the rest is swallowed as comment).
    • BUG-E const re = /'/; → Valid=false, fatal "unclosed string literal".
    • BUG-F const re = /[)]/; → Valid=false, fatal "mismatched delimiter" (the ) inside the character class is closed against the class's [).

A ready-to-run probe test for the real internal/scripting package covering exactly these cases accompanies this filing in the fleet's records (hidden_files/probe-2026-10-28-laneB-scriptingregex/probe_laneb_test.go). Disclosure: it was not executed this run — the laptop (the fleet's designated probe host) was unreachable for the whole run (tailnet proxy closes the SSH CONNECT; the node is listed but port 22 does not answer) and probes are never compiled on the sandbox. Triage should run the probe first; if any traced verdict differs, this issue's evidence section is the thing to correct. The trace itself caught one drafting error this run (an earlier /\/\*/ variant does not trigger the comment path — there is no adjacent /* in it), which is why BUG-D uses the quantifier shape above.

Where it breaks

  • pkgs/mcpx/internal/scripting/validator.go:65-71 — Validate runs checkSyntaxAndDelimiters first and marks the script invalid on any fatal diagnostic from it.
  • pkgs/mcpx/internal/scripting/validator.go:103-242 — checkSyntaxAndDelimiters tracks line/block comments and ', " and ` strings, but has no regex state: a / is only ever examined as a comment opener (:170-183), quote characters start strings wherever they appear (:186-189), and delimiters are pushed/popped wherever they appear (:192-214), including inside a regex literal and inside its character classes, with backslash escapes only honoured inside strings.
  • Consumers that act on the fatal verdict: pkgs/mcpx/internal/daemon/routes_consumer.go:55 (diagnose route; recordDiagnosis(..., val.HasFatal()) and repair-on-fatal), routes_consumer.go:444 (intent route: a generated script with fatal diagnostics is returned unrun, HTTP 422), pkgs/mcpx/internal/scripting/repair.go:85 (a repair candidate is rejected if Validate fails it), pkgs/mcpx/internal/scripting/synthesize.go:49 (same gate for synthesized scripts).

Distinct from #1644 (mcpx internal/secrets References scan — a different scanner, in a different package, gating secret preflight): this is the internal/scripting delimiter scanner gating diagnosis, repair, synthesis and the intent route. The two scanners share the missing-regex-state root cause, so a shared lexical helper is worth considering in triage, but the defects, consumers and fixes are separate.

Why it matters

Regex literals are ordinary script code — validating input, parsing tool output, matching log lines. Every such script that happens to match on a quote, bracket or comment marker is falsely condemned by the one component whose documented job is to never do that, and the downstream machinery (repair loops, unrun 422s) spends model calls and user patience "fixing" code that was never broken.

Acceptance criteria

  • Valid scripts whose regex literals contain quotes, delimiters, character classes with brackets, or comment-like sequences (/*, // shapes) validate as valid — regression tests for at least the quote, escaped-paren, close-brace, comment-like and character-class shapes above.
  • Division is not misread as a regex start (e.g. a / b / c, x /= 2 keep validating, and a genuinely unclosed delimiter/string after a division is still caught) — the regex-vs-division ruling (previous-significant-token heuristic, as in the secrets scanner's design space, or a pinned alternative) is documented in the code.
  • Genuinely broken scripts still fail: the existing unclosed-paren, mismatched-delimiter and unclosed-string tests pass unchanged, and a truly unclosed regex literal does not silently validate.
  • Full existing internal/scripting suite passes; the "never marks a valid script as invalid" guarantee in Validate's doc is either met by the scanner or the doc is corrected to name the pinned blind spots.

Filed by new-issue-creator-code-b, 2026-10-28 run. Deliberately not self-solved: regex-vs-division disambiguation is context-sensitive (the same design pin #1644 faces in the secrets scanner), and whether the two scanners should share one lexical helper is a triage-level call — the fix is not a trivial one-liner.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    queue/queuedHas a queued queue task
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    priority/normalOrdinary priority (the default)
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 28, 2026
  2. dezren39 commented on Oct 28, 2026

    @dezren39
    dezren39
    on Oct 28, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane B, slug new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b cron run, 2026-10-28 06:20 CDT
    • Found via: filed this run
    • Task: Triage the scripting.Validate regex-literal false-fatal defect: the delimiter scanner in internal/scripting has no regex state, so valid scripts whose regexes contain a quote, delimiter or comment-like sequence are condemned — triage pins the regex-vs-division ruling and whether the fix shares a lexical helper with the internal/secrets scanner (mcpx(secrets): References scan misreads regex literals, parameter/destructured bindings and phantom declarations — Preflight refuses scripts that reach nothing and clears scripts that do #1644)
    • Expectation: effort/s — done looks like a Validate that no longer fatally condemns the six regression shapes in the issue, with division controls still passing and the existing scripting suite green
    • Links: queue packet enqueued in repo-health-code-pilot (triage)
  3. github-actions
    assigned
    dezren39
    on Oct 28, 2026
  4. dezren39 commented on Oct 31, 2026

    @dezren39
    dezren39
    on Oct 31, 2026
    MemberAuthor
    More actions

    🤖 Agent note · done (triage)

    • Agent: queue worker (repo-worker-code), Lane A shift
    • Session / ID: queue task 1810 (repo-health-code-pilot), triaged 2026-10-31T03:05Z
    • Found via: queue claim (triage)
    • Task: Triage verdict: CONFIRMED, exactly as filed. The issue's own instruction was to run the accompanying probe first — done this run against current origin/main 48f7c867c (laptop worktree, real internal/scripting package, probe from hidden_files/probe-2026-10-28-laneB-scriptingregex/probe_laneb_test.go):
      • Controls all Valid=true: plain code, division (10 / 2 / 5), delimiters/quotes inside strings, quote+paren inside a // comment.
      • All six bug shapes Valid=false with the predicted fatal messages: BUG-A /" → "unclosed string literal"; BUG-B /\(/ → "unclosed delimiter '('"; BUG-C /}/ → "unmatched closing delimiter '}'"; BUG-D /\/*/ → "unclosed multi-line comment"; BUG-E /'/ → "unclosed string literal (')"; BUG-F /[)]/ → "mismatched delimiter: opened '[', closed with ')'" + "unmatched closing delimiter ']'".
      • Code re-verified on main: validator.go:64 still promises "never marks a valid script as invalid"; checkSyntaxAndDelimiters (:103) states remain line/block comment + three string kinds only — no regex state.
    • Rulings: (1) Regex-vs-division: previous-significant-token heuristic — a / opens a regex only in expression position (after an operator/opener/start), never after an identifier/number/string/closing delimiter; the ruling must be documented in the code. (2) Shared helper with mcpx(secrets): References scan misreads regex literals, parameter/destructured bindings and phantom declarations — Preflight refuses scripts that reach nothing and clears scripts that do #1644's secrets scanner: not a precondition — different package, different consumers; the scripting fix lands in-package, and mcpx(secrets): References scan misreads regex literals, parameter/destructured bindings and phantom declarations — Preflight refuses scripts that reach nothing and clears scripts that do #1644's fix may extract a shared helper later if the state machines prove identical. Noted here so mcpx(secrets): References scan misreads regex literals, parameter/destructured bindings and phantom declarations — Preflight refuses scripts that reach nothing and clears scripts that do #1644's triage sees the call.
    • Expectation: done — fix routed as queue task 4168 (small_fix, dedupe repo-health:v1:fix:developing-today/code:issue:1659) with the probe evidence and acceptance from this issue. This issue stays open for the fix.
    • Links: fix task 4168 in repo-health-code-pilot
  5. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    status/in-progressQueue worker lifecycle state
    and removed
    status/needs-triageNot yet triaged; needs a first look
    on Oct 31, 2026
  6. 194 remaining items

    Load more actions
  7. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1
    state: parked
    task: 4168 (lane B)
    note: Fix round for the 03:48Z Codex round pushed as 66f5294 on PR 3047 — all 8 P2s fixed with regression tests (full internal/scripting suite, go vet, gofmt pass on laptop); all 8 threads replied + resolved (44 threads, 0 unresolved, verified fresh); @codex review requested. Parked 20m awaiting Codex re-review + CI. Resume: Codex clean + CI green -> merge PR 3047 -> close #1659 -> complete fixed_merged.

  9. chatgpt-codex-connector commented on Nov 1, 2026

    @chatgpt-codex-connector
    chatgpt-codex-connectorBot
    on Nov 1, 2026 – with ChatGPT Codex Connector
    More actions

    To use Codex here, create an environment for this repo.

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

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1
    state: claimed
    task: 4168 (lane F)
    note: Resumed at awaiting_ci. Fresh check: PR 3047 head still 66f5294; Codex DID re-review that head at 2026-11-01T04:25Z and posted 9 NEW P2 findings (all exotic heuristic corners beyond this issue's acceptance scope: new /re/, class-heritage object literals, \u{...} identifier escapes, TS instantiation expressions, #private names, spread/comment trivia interplay, etc.). Disposition per the Codex gate: each thread gets a reply pointing at a single follow-up issue for the remaining scanner heuristic gaps; the six probe shapes + division controls in this issue's acceptance are implemented and tested (suite/vet/gofmt green on laptop at this head). CI on this head: only the mcpx-docs nix build still QUEUED (fleet runner backlog); CodeRabbit neutral. Proceeding to disposition + merge under the standing merge authority.

  12. dezren39
    added a commit that references this issue on Nov 1, 2026

    Merge pull request #3047 from developing-today/queue/4168-1659-regex-…

    879b948
  13. dezren39 commented on Nov 1, 2026

    @dezren39
    dezren39
    on Nov 1, 2026
    MemberAuthor
    More actions

    agent-note:v1
    state: done
    task: 4168 (lane F)
    note: PR #3047 MERGED as 879b948 (head 66f5294). Codex gate: the 04:25Z re-review of that head posted 9 new P2s — all exotic heuristic corners outside this issue's acceptance; each thread replied + resolved with disposition to follow-up issue #3334 (filed this shift, per-shape regression acceptance). Verified 0 unresolved threads before merging. Tests at head: full internal/scripting suite + go vet + gofmt pass on laptop (prior shift); CI on head had only the mcpx-docs nix build still QUEUED (fleet runner backlog) and CodeRabbit neutral — merged under standing merge authority. Closing this issue as fixed; remaining scanner shapes live on #3334.

  14. dezren39
    closed this as completedon Nov 1, 2026
  15. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @dezren39
    dezren39

Labels

app/mcpxPackage/app: mcpx (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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.