Skip to content

feat(codex): Group A — project-route-context, empty-board masquerade closed (dogfood-remediation) - #2629

Merged
namastex888 merged 3 commits into
devfrom
wish/dogfood-A
Jul 22, 2026
Merged

namastex888 merged 3 commits into
devfrom
wish/dogfood-A

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

Wave 2 of codex-plugin-dogfood-remediation. Group A (gated on Group B's SHIP, now merged).

What

  • Closes the empty-board masquerade: the read-only MCP server no longer serves a healthy empty board from a plugin-cache CWD. resolveProjectContext returns typed project-context-unavailable / project-database-unavailable / unsupported-project-layout before any MCP tool can serialize empty success; bare/submodule/external-git-dir layouts are rejected, never falling outward or to cache.
  • Four-value path model: effectiveLaunchCwd, separate worktreeConfigRoot, absolute gitCommonDir (git rev-parse --path-format=absolute --git-common-dir), genieStorageRoot = dirname(gitCommonDir); the only DB candidate is <genieStorageRoot>/.genie/genie.db. Never chdir, never considers the plugin cache. Stops at the nearest nested repo; linked worktrees keep config at the linked root while the DB follows gitCommonDir.
  • Marker-owned project route: genie init always reconciles one marker-owned .codex/config.toml route (facade GENIE_HOME/bin/genie, args=['mcp'], no cwd override), independent of plugin/delivery state, atomic writes, unrelated TOML preserved byte-for-byte. Unowned/damaged/malformed routes are classified and never rewritten.
  • Plugin MCP route removed: dropped the Codex manifest mcpServers + .mcp.json; Claude's separate inline launcher retained and still covered.

Validation (reproduced by orchestrator)

bun test over the 5 Group-A files → 94 pass / 0 fail, codex-present AND codex-stripped-from-PATH. typecheck clean; the suite makes zero live codex calls (CI-portable).

Review + fix

Adversarial review caught a HIGH: openReadonlyDb bypassed sqlite-open.ts's busy_timeout, flaking "database is locked" 4/5 runs under the codex-stripped (CI) condition. Fixed — the readonly open now applies the shared BUSY_TIMEOUT_MS, and the new tests checkpoint (wal_checkpoint(TRUNCATE)) before closing writers. Re-verified 33 consecutive clean runs codex-stripped (fixer 19 + orchestrator 14).

Deferred to Group E (config-layer diagnostics, per Decision 15)

Distinct typed states for untrusted-config, global same-key route, effective-layer shadowing, route-collision, route-shadowed, project-trust-required — these are doctor/init diagnostics, not read-only-MCP-server states. AC3's live codex mcp get check is for post-merge live QA (kept out of CI per the portability rule).

…y context

Group A (project-route-context) of codex-plugin-dogfood-remediation.

- Add resolveProjectContext in v5/genie-db: four-value model (effectiveLaunchCwd,
  worktreeConfigRoot, absolute gitCommonDir, genieStorageRoot=dirname(gitCommonDir))
  with typed states project-context-unavailable / project-database-unavailable /
  unsupported-project-layout. Bare/submodule/external-git-dir are rejected before
  any DB lookup; nested repos stop at their own boundary; linked worktrees keep
  config under the linked root but read the DB under the common root's parent.
- Wire the resolver into the shared MCP server loop (opt-in) so genie mcp fails
  closed with a structured error instead of masquerading as a healthy empty board;
  ui-bridge is unaffected. Re-resolve only until the context settles ok.
- Add genieFacadeMcpEntry (<GENIE_HOME>/bin/genie, args [mcp], no cwd) and make
  genie init always reconcile one marker-owned Codex route independent of plugin
  and delivery state; remove the verified-current gate.
- Remove the Codex plugin MCP route: drop mcpServers + MCP capability from the
  Codex manifest and delete plugins/genie/.mcp.json; retain Claude's inline
  launcher and its regression coverage. Reconcile build + smoke gates.
- Tests: resolver fixtures for every layout, fail-closed absent-db, facade marker,
  plugin-route removal, and a two-repo migration integration test.
…flake

openReadonlyDb opened the read-only handle with a raw bun:sqlite call,
bypassing the shared sqlite-open primitive that sets busy_timeout first.
Under concurrent access a straggling WAL writer surfaced as an instant
-32603 "database is locked". Apply BUSY_TIMEOUT_MS to the readonly
connection (valid on readonly, no file mutation; absent-db still throws
before the pragma so the degrade-to-null contract holds). Quiesce the
Group-A test writers with wal_checkpoint(TRUNCATE) before readers open.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7b07976a-0716-4997-8cc2-2749df8d33d7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wish/dogfood-A

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 13e9fcc5d4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"developerName": "Namastex Labs",
"category": "Developer Tools",
"capabilities": ["Skills", "Hooks", "MCP"],
"capabilities": ["Skills", "Hooks"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore Codex health checks after removing plugin MCP

Removing the Codex plugin MCP declaration makes the newly shipped plugin fail Genie's existing activation health path: probeCodexGeniePlugin() still delegates to inspectCodexPluginMcpUsability(), which requires manifest.mcpServers === './.mcp.json', and proveCodexPluginHealth() rejects any snapshot with usable !== true. In an install/update/doctor run against this manifest, the active plugin is therefore reported as unusable (or the setup/update proof aborts) even though the project fallback is now the intended route; update those probes/checks to validate the new project-route contract instead of the removed plugin route.

Useful? React with 👍 / 👎.

Comment thread src/term-commands/mcp.ts
Comment on lines +40 to +47
const { MCP_TOOLS, openReadonlyDb, resolveProjectContext } = await import('../lib/v5/mcp-tools.js');
const { runMcpServerLoop } = await import('../lib/v5/mcp-server.js');
await runMcpServerLoop({
tools: MCP_TOOLS,
openReadonlyDb,
// Fail-closed: missing repository context / genie.db / unsupported layouts
// surface as a typed MCP error instead of a healthy-looking empty board.
resolveContext: resolveProjectContext,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep health-session MCP probes out of fail-closed CWDs

Injecting resolveProjectContext into every genie mcp session means a tools/call from a non-Git or no-DB cwd now returns isError: true; however the activation proof still launches runBoundedCodexMcpSession() from a fresh mkdtemp directory and requires genie_wish_status to return a non-error result. Once setup/update reaches that proof, the bounded session will fail on project-context-unavailable instead of proving the plugin launcher, so seed a real initialized project for the health probe or relax the probe to accept the new fail-closed result.

Useful? React with 👍 / 👎.

Group A removed the Codex plugin MCP route (no manifest mcpServers, no MCP
capability, no plugin .mcp.json); the marker-owned project .codex/config.toml
is now the Codex MCP path and Claude keeps its inline launcher. proveCodexPluginHealth
still required snapshot.usable (Codex-MCP-route usability) and a read-only
wish_status that returned isError:false, so a fresh install --integrations codex
rejected the post-A plugin as unhealthy and smoke:codex failed.

Redefine plugin health: a healthy plugin provides skills + hooks + the retained
Claude mcp-launcher.cjs and does NOT register a Codex MCP route. Drop the
snapshot.usable gate (usable stays the project-route signal for isUsableCodexPlugin).
The bounded health session now accepts a fail-closed typed no-project-context
wish_status (project-context-unavailable / project-database-unavailable /
unsupported-project-layout) as read-only-healthy, since the throwaway probe cwd
is not a project — the launcher spawning and speaking MCP is the signal, an
absent board there is expected. Any other tool error is still rejected.

Update reject-matrix + health-session tests to the new contract; manifest/.mcp.json
absence assertions unchanged.
@namastex888
namastex888 merged commit 8a92fbd into dev Jul 22, 2026
16 checks passed
lirazsiri pushed a commit to lirazsiri/genie that referenced this pull request Jul 28, 2026
…s, IN_PROGRESS

The H3 SessionStart line surfaced ledger drift: waves 1+2 shipped 2026-07-22
(PRs automagik-si#2625/automagik-si#2626/automagik-si#2628/automagik-si#2629, per-group SHIP reviews, validations reproduced)
but their evidence and criteria were never recorded; status still read
APPROVED with execution long underway.

- status APPROVED -> IN_PROGRESS
- 41 evidence-backed criteria ticked (5 -> 46/67): Groups A-D ACs + global
  criteria owned by merged groups; deliberately NOT ticked: the two live
  'codex mcp get genie --json' operator proofs, Group F/G criteria, and all
  post-merge QA rows
- appended the waves-1+2 evidence block, the seven live-QA fixes
  (automagik-si#2631-automagik-si#2634, automagik-si#2636), Group E's actual merge commit (4be6917), and the
  open automagik-si#2633-deferred follow-up (pre-A route-arm retirement)

Adversarially verified pre-commit by the pm-ledger-verify workflow: 0
must-fix; its 4 advisory findings (defect count, untracked follow-up,
unrecorded E merge) are incorporated above.
@automagik-genie
automagik-genie deleted the wish/dogfood-A branch September 25, 2026 04:51
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