Title: mcpx: faster CLI and exec -- no self-socket, lazy schemas, a typecheck default · Issue #1868 · developing-today/code · GitHub
Open Graph Title: mcpx: faster CLI and exec -- no self-socket, lazy schemas, a typecheck default · Issue #1868 · developing-today/code
X Title: mcpx: faster CLI and exec -- no self-socket, lazy schemas, a typecheck default · Issue #1868 · developing-today/code
Description: Relocated from dezren39/darwin-nix#79 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix...
Open Graph Description: Relocated from dezren39/darwin-nix#79 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference...
X Description: Relocated from dezren39/darwin-nix#79 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refer...
Opengraph URL: https://github.com/developing-today/code/issues/1868
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: faster CLI and exec -- no self-socket, lazy schemas, a typecheck default","articleBody":"Relocated from dezren39/nix#79 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #181\n\nMeasured findings from the `exec`/`run` performance work (#62, #69, #70, #73). Nothing here is a bug; each is a place to be faster or a default to decide.\n\n**Point 4 defers to #100 (#181 collision 1).** #100 decides whether `script.typecheck` is replaced by or aliased to `script.check`; the default change proposed here lands on top of that decision, as a change to `script.check`'s default, in the same release -- not beside it.\n\n**1. The CLI talks to itself over a socket.** Inline mode hosts the daemon's handler in-process on a private socket, so `mcpx ls` serialises a request, writes it to a socket, reads it back in the same process and deserialises it. The socket is only needed for scripts (a separate runtime process). CLI commands could call the handler directly and open a socket only when a script runs.\n\n> At 05c78b2: still true. `inlineDaemon` makes a temp dir, starts `srv.ServeInline` on `d.sock`, then polls it with `Ping` (`internal/cli/connect.go:211-259`). It only matters when inline is chosen, which today is the last rung of the ladder (`connect.go:141-149`).\n>\n> No real choice: give the CLI an in-process `http.RoundTripper` that calls the daemon's handler directly (one API hosted twice is already the rule, `internal/daemon/server.go:256`), and open the socket lazily when a script runs. Low value until point 2 makes inline something a user picks.\n\n**2. `daemon.mode = auto | daemon | inline`.** Inline is only a fallback rung today; there is no way to *choose* single-process mode when a daemon is running.\n\n> At 05c78b2: still true, but there are already two knobs: `daemon.inline` (bool, default false, \"as a last resort, run servers inside this process\", `internal/settings/registry.go:377`) and `daemon.autostart` (bool, default true, `registry.go:391`). Together they express four ladders (socket; socket→spawn; socket→inline; socket→spawn→inline), none of which skips the socket.\n>\n> - **A -- add `daemon.mode` beside them.** Three knobs for one ladder, contradictory combinations (`mode: inline`, `inline: false`), and a three-value enum cannot express the four ladders the two booleans already do.\n> - **B -- replace both with `daemon.mode`.** One knob, but it renames two shipped settings (collision 1's problem twice), and it needs at least five values to lose nothing.\n> - **C -- recommended: widen `daemon.inline` to `off | fallback | always`**, accepting `false`/`true` as `off`/`fallback`. `always` skips the socket and spawn rungs. `daemon.autostart` is untouched. This is one shipped setting gaining a value, and it uses the same value-alias mechanism #100 needs for `script.typecheck`, so decide that mechanism once, in #100.\n\n**3. Cold-cache `exec` waits for every server.** Codegen types every namespace, so a cold cache starts all servers (7.5 s with seven configured). Reads are parallel, so the cost is the *slowest* server -- here one server is 4.1 s of it. Proposed: generate from what is cached, read uncached schemas in the background, block only if the script touches one that has not landed. No semantic change and no reliance on static analysis. (The preflight scanner can also identify referenced namespaces for the common case, but `tools[ns][name]` and dispatch on `search()` results make that undecidable in general.)\n\n> At 05c78b2, by reading (not re-measured): half of this is already how it works. Codegen uses only cached schemas (`p.CachedSchemas()`, `internal/daemon/registry.go:536`). `ensureAnySchemas` refreshes every server only when *no* namespace is cached, and returns immediately if any one is (`internal/cli/commands.go:1023-1039`). `--ns` fetches just the named namespaces (`commands.go:510-517`). So the 7.5 s is the fully cold first run. On a partly warm cache, an uncached namespace is emitted with no tools and nothing waits for it. What is missing is the background read and the block-on-first-touch.\n>\n> - **A -- choose the namespaces by static analysis.** The preflight scanner (or #104's graph) decides what to fetch. It is wrong exactly in the undecidable cases above, and in those cases the run fails instead of waiting. Namespaces bound as bare identifiers by the prelude (`buildPrelude`, `commands.go:1041`) are not imports, so #104's import graph does not see them.\n> - **B -- refresh in the background and emit on a deadline.** Start the refresh, emit whatever has landed by a short deadline, and let late namespaces fail. This is fast, but the result depends on timing, which is the class of bug `runScript`'s own comment about cold-cache output warns against (`commands.go:494-499`).\n> - **C -- recommended: the proposal as written, with typed stubs.** Emit every configured namespace. Uncached ones become a stub whose first call awaits the daemon's schema read, and the stub is typed `any` so that `deno check` (point 4) passes on it instead of failing on a missing name. Lazy schemas and a type-check default otherwise work against each other.\n\n**4. `script.typecheck` default.** It works now (#66) and is cheap for anything re-run (#70, #73):\n\n| `--typecheck=on` | |\n| --- | --- |\n| `run \u003cfile>`, repeated | ~80 ms (baseline ~70) |\n| `exec`, same snippet again | 75–85 ms (baseline 68) |\n| any genuinely new program | ~400 ms (Deno's own floor: `deno check` of a new file is 391 ms) |\n\nIt prevents a typo'd namespace from half-running a script (#66). Proposal: default `on` for `run`, and decide for `exec` whether ~330 ms on each new snippet is worth catching the typo before side effects. Deno only; Bun and Node skip it.\n\n> At 05c78b2: still `Default: \"off\"` (`internal/settings/registry.go:244`), and its help text gives \"a second or two on a cold module cache\" as the reason (`registry.go:249-251`). That text would change with the default. Two corrections:\n>\n> - Bun and node do not skip it silently. With the check on, every bun or node run prints \"type checking is only available under Deno\" to stderr (`internal/preflight/preflight.go:209`, `internal/runner/runner.go:337-339`). A default-on check turns that into noise on every non-deno run unless it is demoted.\n> - A typo'd *tool* is already caught before side effects on every runtime: `diagnose.preflight` is on by default (`internal/defaults/defaults.json:84`, `internal/cli/consumer.go:517-535`). Only a typo'd *namespace* gets past it, because the scanner is deliberately silent about unconfigured names (`internal/diagnose/diagnose.go:278-282`). The type check is what closes that gap.\n>\n> The registry has one `Default` per setting (`internal/settings/schema.go:133-137`), so \"on for `run`, off for `exec`\" needs a per-command default that does not exist yet.\n>\n> - **A -- default on for `run` and `exec`.** Catches the typo everywhere deno runs, at ~330 ms per new snippet, and prints the deno-only warning on every bun and node run.\n> - **B -- default on for `run` only, as proposed.** Needs the per-command default. Repeated `run`s pay ~10 ms. `exec` stays unguarded.\n> - **C -- recommended: B, expressed on `script.check` after #100's alias lands, plus a near-miss namespace warning in `diagnose.preflight`.** When a called identifier is a near miss of a configured namespace (#186's matcher), warn. It costs nothing, works on bun and node where no type check exists, and covers `exec` without the ~330 ms. It stays a warning, not fatal: `fs` versus a namespace called `fff` is one edit apart.\n\nNot measured here: `repo`- and `worktree`-scoped servers fork `git rev-parse` to key their instances (`internal/config/scope.go:152,159`, cached per directory in-process). The GIT architect is replacing that fork with native resolution now, so re-measure any per-call cost that includes it after that PR lands.\n\n## Ease · Impact · Related\n\n**Ease** M (point 1 S, point 2 S once #100's alias mechanism exists, point 3 M, point 4 S after #100) · **Impact** med -- the fully cold first `exec` and the typo'd namespace are the two costs a new user meets first.\n\nRelated: #100 (owns collision 1: the alias decision this issue's point 4 lands on), #186 (near-miss matcher), #104 (import graph; see point 3 A), #62 #66 #69 #70 #73 (merged, the measurements above), #78 (daemon state and caches).\n\nSecurity/auth deferred; see tracker.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:09:21Z","url":"https://github.com/developing-today/code/issues/1868"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f7647256-fe08-5659-9aa1-2ee1c59c6240 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A600:2E0249:357292:46061F:6B0617F4 |
| html-safe-nonce | 2e715213e06c3589467cb80391b7c99b2cd064bdcad4414106efcf72044ce8e7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjAwOjJFMDI0OTozNTcyOTI6NDYwNjFGOjZCMDYxN0Y0IiwidmlzaXRvcl9pZCI6Ijc4MTU2NTY0MTgxNjE1OTY0MDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 73c4bd23f37bbff68e72b003cc4d444c9caaa303b06ead7d7eeaa9a16daf0663 |
| hovercard-subject-tag | issue:6088402313 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1868/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4856bafe3ff09a862fac75da5d8dfb167586228b3b5e065f3427aabfb2a46eeb/developing-today/code/issues/1868 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4856bafe3ff09a862fac75da5d8dfb167586228b3b5e065f3427aabfb2a46eeb/developing-today/code/issues/1868 |
| og:image:alt | Relocated from dezren39/darwin-nix#79 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue reference... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width