Skip to content

fix: count MCP limits as advertised and keep setup recoverable - #109

Merged
youdie006 merged 8 commits into
mainfrom
fix/mcp-setup-config-messages
Nov 17, 2026
Merged

youdie006 merged 8 commits into
mainfrom
fix/mcp-setup-config-messages

Conversation

@youdie006

Copy link
Copy Markdown
Owner

What changed

MCP and setup defects from the 2026-11-09 bug hunt (against 0.40.50), each reproduced again on main 3b0bd6b. Own commit: 0f1889b. This branch is chained on #108 (which is chained on #107 and #105) so the shared CHANGELOG section merges without conflicts; until those merge, the PR diff also shows their changes.

  1. maxLength counted in characters, handlers counted UTF-8 bytes. A title of 4000 x "가" was refused "(12000 bytes > 10000 bytes)", a prompt of 40000 x "가" "(120000 bytes > 100000 bytes)": Korean text hit about a third of the advertised limit. assertMcpTextField now counts characters (constants renamed MAX_MCP_{BRIDGE,SHORT}_TEXT_CHARS). Bytes stay bounded by the 128 MiB stdio frame limit, whose test already budgets six bytes a character. repo_write_file_dry_run.content keeps its 1,000,000-byte limit, because that is the file size read and apply use; its description and refusal now say the limit is in UTF-8 bytes.
  2. bridge_create_task with repo_id: "" returned a raw zod dump. The schema now advertises minLength: 1 and the SDK refuses it as invalid input (-32602), like title: "".
  3. setup's follow-up hint: an expired token now gets prodex setup --token-ttl-hours <hours> instead of "it never expires"; every command setup prints carries --cwd when setup was given it; a TTL that would expire on creation (1e-9) is refused before anything is written.
  4. One invalid field made setup discard the whole config (token rotated, valid defaults, expiry and created_at dropped, silently). readExistingConfig keeps each valid field and drops only invalid ones (each browser_defaults field separately); setup prints which fields it dropped (names only, never values), "The saved token was kept.", or, when it could not keep it, that the token changed and clients need the new URL. A token is kept only together with its saved expiry, so a token meant to lapse cannot become non-expiring.
  5. Non-loopback host in the config was a dead end. The refusal now names the host, .bridge/config.local.json and prodex setup --host 127.0.0.1 (plain prodex setup when only server_url carries it), with --cwd when needed; sourceAwareSetupMessage now rewrites any quoted prodex setup ... command. Non-loopback hosts are still refused.
  6. setup help listed --allow-model-fallback, which setup rejects; it was added as a per-send option in 0.39.5 (26b925d), so the setup help line is removed.

Verification

  • Test-first: every new test failed on its assertion first (new tests/mcp-field-limits.test.ts, tests/setup-config-recovery.test.ts; tests/setup-url-hint.test.ts rewritten to run the printed command as-is from another directory); each fix reverted one at a time turned its tests red again.
  • npx tsc --noEmit clean; full suite 1950 passed, 3 skipped (subagent run, own branch); after merging the fix: fit the picker to the terminal and long names to the name limit #108 chain, the main thread ran tsc and the full suite: 2005 passed, 3 skipped. The merge kept both new helpers in src/repo-write.ts (assertWritableContentSize from this PR, refuseOverlongName from fix: fit the picker to the terminal and long names to the name limit #108).
  • npm run release:verify in an isolated environment passed npm test, typecheck and build; the package smoke failed only because PRODEX_CDP_PORT=1 made the login guide print --port 1 where the smoke pins the default port, and passed with that text normalized. The unmodified smoke runs in this PR's release verification CI jobs.

Four ledger listing defects found by the 2026-11-09 bug hunt:

- One untrusted older result failed `results show latest`, `results
  artifact latest` and MCP `bridge_list_results` for every trusted
  result beside it. The store now splits results into trusted and
  untrusted; `latest` resolves to the newest trusted one (as `pro
  latest` does) and `bridge_list_results` lists the trusted ones with
  `untrusted_skipped` and each untrusted record's reason. Fetching an
  untrusted result by id still refuses.
- `pro blockers --cwd` turned one corrupt result record into "No
  consults recorded in this repo." with rc=0. With --cwd the record's
  error now fails the command; across all roots the bad root is named
  on stderr and the others are still reported.
- `sessions cancel <id>` stamped last_used_at, so the cancelled session
  became "latest" and `sessions cancel latest` refused while a newer
  session was still running. Cancelling now keeps last_used_at.
- `--since 2026-02-30` was read as 2026-03-02; impossible dates are
  refused.

Verified: each new test failed on its assertion before its fix; tsc
clean; full suite 1944 passed, 3 skipped (subagent run), and the five
changed test files re-run here (397 passed).

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
CLI parsing and help defects found by the 2026-11-09 bug hunt:

- A single-value flag given twice silently kept the first value
  (`--title First --title Second` saved "First"; `--timeout-ms` given
  twice sent with the first). The shared parsers now refuse it with
  "--title was given twice; give it once, with the value you mean.";
  --file, --attach, --tool, --command and --artifact still repeat.
- A value starting with "--" was reported as missing, and
  `--prompt=x` got "Did you mean `--prompt`?". Both now say what is
  wrong and how to pass the value.
- `ui --help`, `ui help`, `version --help` and help requests that
  carry a command's own flags (`tasks list --json --help`) now print
  help; `version --bogus` is refused instead of ignored.
- The "put -- before it: prodex ask" hint now appears only for the ask
  commands and names the one that was run.
- Help, README and docs said the model rows cannot be clicked; they
  are walked by keyboard since 0.40.34. `pro help` said creating a
  project from the CLI was planned; `--project-new` works.
- The effort alias lists now say that `max` (any case but `Max`) means
  매우 높음 while `Max` is the Work rung.

Verified: 17 new tests (14 failed first, 3 are guards); two mutations
caught; tsc clean; full suite 1951 passed, 3 skipped and
`npm run release:verify` ok (subagent run); CLI test files re-run here
(257 passed). The MCP consult and picker argument builders pass each
single-value flag at most once.

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
Picker and repo-write defects found by the 2026-11-09 bug hunt:

- The picker's progress bar always filled against 20 minutes, so a
  5-minute send read "0s / 20m ... (budget 5m)". The send now reports
  the answer budget it settled on (CliIO.onSendBudget) and the bar uses
  it, falling back to 20 minutes when none is reported.
- A list taller than the terminal pushed the title, the settings panel
  and the cursor off screen (25 projects at 80x24). The list is now a
  window around the cursor with "more above/below" lines, row numbers
  are right-aligned, and the banner and then the panel give way on a
  short terminal.
- The attach line split `'/home/u/Bob'\''s notes.pdf'` into three paths
  and `"My File".pdf` into two, and dropped a separator from
  `C:\repo\#1\a.pdf`. It now reads words as a shell does and keeps every
  backslash of a Windows path.
- U+2705, U+2B50 and U+2764 U+FE0F counted one column, and rows were cut
  at 40 columns even on narrower terminals. Wide symbols and the emoji
  selector now count two, and every line is cut to the real width.
- Repo writes to a name over about 192 bytes passed the dry run and
  failed the apply with ENAMETOOLONG on a /proc/self/fd path. The temp
  name now cuts its copy of the target name to stay within 255 bytes,
  and a name the file system cannot hold gets a clean error naming the
  repo path in both the dry run and the apply.

Verified: every new test failed first; reversing the src patch turned
them red; two mutations caught; tsc clean; full suite 1953 passed, 3
skipped (subagent run); the changed test files re-run here (226
passed). Not run: a real `prodex ui` send (it would drive a browser);
the onBudget hand-off in runInteractiveUi has no test of its own.

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
…trusted

# Conflicts:
#	CHANGELOG.md
#	src/store.ts
…to fix/cli-flag-parsing

# Conflicts:
#	CHANGELOG.md
…icker-and-long-names

# Conflicts:
#	CHANGELOG.md
MCP and setup defects found by the 2026-11-09 bug hunt:

- MCP bridge text fields advertised maxLength in characters but the
  handlers counted UTF-8 bytes, so Korean text was refused at about a
  third of the limit (4000 x "가" as a title: "12000 bytes > 10000
  bytes"). They now count characters; repo_write_file_dry_run content
  keeps its 1,000,000-byte file limit and says it is in UTF-8 bytes.
- `bridge_create_task` with `repo_id: ""` returned a raw zod dump; the
  schema now advertises minLength 1 and refuses it as invalid input.
- `setup` on an expired token said "it never expires" and pointed at a
  command that then failed; a TTL of 1e-9 hours saved an expired token
  and exited 0; hints omitted the --cwd setup was given. Each case now
  gets a hint that works from where it was run, and a TTL that expires
  on creation is refused.
- One invalid optional field made setup discard the whole config:
  token rotated, valid defaults, expiry and created_at dropped, with no
  word. Setup now keeps every valid field, names each one it dropped
  (never values), and says plainly when the token changed.
- A hand-edited non-loopback host was refused by status, start and
  setup without naming the file or the fix; the message now names both
  (`prodex setup --host 127.0.0.1`, with --cwd when needed).
- setup help listed --allow-model-fallback, which setup rejects; it is
  a per-send option (0.39.5), so the line is removed.

Verified: every new test failed on its assertion first; revert proofs
per fix; tsc clean; full suite 1950 passed, 3 skipped (subagent run);
changed test files re-run here (181 passed). release:verify passed npm
test, typecheck and build; its package smoke failed only on the
isolated PRODEX_CDP_PORT=1 environment's "--port 1" text, and passed
with that text normalized; CI's release verification runs it unmodified.

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
…fix/mcp-setup-config-messages

# Conflicts:
#	CHANGELOG.md
#	src/repo-write.ts
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T00:29:40.358392Z dd28b97 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

What this touches

  • browser adapter
  • bridge store
  • CLI
  • MCP
  • tests

34 file(s), 2246 line(s) changed. Tests changed.

Worth a look

  • Careful read: touches the receipt/integrity path.
  • Careful read: touches what gets written to a repo.

This is an automated first pass, not a review. CI is the gate; a person decides.

@youdie006
youdie006 merged commit 36bda26 into main Nov 17, 2026
12 of 13 checks passed
youdie006 added a commit that referenced this pull request Nov 17, 2026
fix: port main PRs #100 and #105-#109 to the container image
youdie006 added a commit that referenced this pull request Nov 17, 2026
0.40.52 (51da80d, PRs #100 and #105-#109) published on its first publish
run and is installed on WSL, M3 and the Mac mini; the MacBook M4 did not
answer ssh and still runs 0.40.51. The browser containers on WSL and M3
were rebuilt twice: from 58650ce (container PR #110), which fixes the
request_mismatch every container consult hit once ChatGPT keyed
transcript units by turn id, and then from 9969a64 (container PR #111),
which ports this release's fixes. Each swap was gated on the send lock,
and a smoke consult answered with its request verified on both hosts
after each.

Claude-Session: https://claude.ai/code/session_01EMqNwnnhHXznd2P2PDsaDV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant