Skip to content

feat(routing): narrow the menu on every host, and gate every host in CI - #78

Merged
tanglearncode merged 2 commits into
mainfrom
routing-port-hosts
Aug 8, 2026
Merged

tanglearncode merged 2 commits into
mainfrom
routing-port-hosts

Conversation

@tanglearncode

@tanglearncode tanglearncode commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Claude Code has been narrowing its routing menu since #75. The other four hosts still sent every context on the machine, alphabetically, on every call. This brings them level — and widens the coverage gate so CI actually checks them.

The shared core already had everything; only each host's own bridge was missing the wiring.

Narrowing, on every host

Copilot, Kimi Code and Codex take the same change as Claude: get_context accepts an optional query, and a request that matches something replaces the full menu with the contexts that matched it — carrying the near-tie rule from #76 with it.

pi differs in one way worth knowing. Its notes go into the system prompt before every turn as well as into get_context, and the system prompt has no request to match against. That path keeps listing everything, which is the correct answer there rather than an oversight.

The conservative fallbacks from #75 apply everywhere: no query, too few contexts, or nothing matched all produce the full menu exactly as before.

The coverage gate now watches every host

It watched only plugins/claude-code/neatcontext/src/. That was fine while the other hosts were forks that rarely moved, and stopped being fine the moment a change had to be applied to five bridges at once — the first draft of this PR sailed through a green coverage job that had not looked at a single line of it.

Now gated: src/claude, src/copilot, src/kimi, src/codex, and pi's src/pi and extensions/.

One deliberate exclusion: the Context core copied into each plugin's src/core/. Those copies are generated and proven byte-identical twice over — the sync check fails when one drifts, and the host tests assert equality against Claude's. Claude's copy is gated and is what the unit tests import. Gating the other four would demand the same line run five times to prove what equality already proves, and would fail honest changes.

What the widened gate caught immediately

Three real gaps in this PR, which is the whole argument for it:

  • Copilot, Kimi and Codex had no test for the "nothing matched" fallback. The branch that stops an unmatched question from hiding the entire store was shipping untested on three hosts.
  • pi's extension entry point was untested — the schema and the hand-off of the query to the runtime.
  • The Codex test harness killed its bridge instead of closing it, so the child never flushed its V8 coverage profile and everything it ran read as untested. A latent harness bug, invisible while Codex was ungated. It now uses the repository's closeSession, whose comment has said all along that it exists for exactly this reason.

CONTRIBUTING.md documents the gate's new scope, the exclusion and why, and the rule about letting spawned hosts exit.

Result

289 changed lines across all five hosts, 0 uncovered. Full suite 380 passing.

Claude Code has been narrowing its routing menu since #75 while the
other four hosts still sent every context on the machine, alphabetically,
on every call. The shared core already had everything needed; only each
host's own bridge was missing the wiring.

Copilot, Kimi Code and Codex take the same change as Claude: get_context
accepts an optional query, and a request that matches something replaces
the full menu with the contexts that matched it and the near-tie rule
that comes with it.

pi differs in one way worth noting. Its notes go into the system prompt
before every turn as well as into get_context, and the system prompt has
no request to match against — so that path keeps listing everything,
which is the correct answer there.

Each host gets a test that drives its own bridge end to end: a request
that matches shows only what matched, and a call with no query still
shows the whole store. The repository's coverage gate only watches the
Claude plugin, so these tests are what holds the port honest.
The diff-coverage gate watched one plugin. That was fine while the other
hosts were forks that rarely moved, and stopped being fine the moment a
change had to be applied to five bridges at once: the four ports in this
branch passed a green coverage job that had not read a line of them.

Every host adapter is gated now. The generated Context core copied into
each plugin is not: those copies are proven byte-identical by the sync
check and by the host tests, and Claude's copy is gated, so requiring
the same line to run five times would prove nothing further.

Widening it found three real gaps in this branch. Copilot, Kimi and
Codex had no test for the fallback that stops an unmatched question from
hiding the whole store. pi's extension entry point was untested. And the
Codex harness killed its bridge instead of closing it, so the child never
flushed its coverage profile and everything it ran read as untested —
a latent bug that only an ungated host could hide.
@tanglearncode tanglearncode changed the title feat(routing): narrow the menu on Copilot, Kimi, Codex and pi too feat(routing): narrow the menu on every host, and gate every host in CI Aug 8, 2026
@tanglearncode
tanglearncode merged commit 2a41a56 into main Aug 8, 2026
11 checks passed
@tanglearncode tanglearncode mentioned this pull request Aug 9, 2026
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