Skip to content

[codex] Fix slide deck MCP export provenance#19

Merged
mikeylong merged 2 commits into
mainfrom
codex/slide-deck-mcp-provenance
Jul 6, 2026
Merged

[codex] Fix slide deck MCP export provenance#19
mikeylong merged 2 commits into
mainfrom
codex/slide-deck-mcp-provenance

Conversation

@mikeylong

Copy link
Copy Markdown
Owner

Summary

Fixes the agent-facing create_slide_deck path so exported PPTX artifacts are tied to an explicit workspace root and a verifiable JudgmentKit provenance receipt.

What changed

  • Added runtime.workspace_root to the MCP schema and resolves repo-relative output.path against explicit/configured workspace roots instead of blindly using process.cwd().
  • Refuses unsafe implicit export roots such as /var/task, .codex, and Codex runtime cache paths.
  • Adds explicit deck export states: planned, export_attempted, export_failed, and exported.
  • Writes and returns a sidecar provenance receipt for successful exports, including tool name, output path, absolute path, templates, adapter manifest, registry version, runtime package, and warnings.
  • Adds content-shape default template selection and layout/layout-family repetition warnings.
  • Documents the Codex Desktop deck export workflow and tightens JudgmentKit skill guidance so folder names are not treated as provenance.

Root cause

create_slide_deck required repo-relative output paths but resolved them against the MCP process cwd. In hosted/runtime contexts that could become /var/task, so a valid relative path could still target the wrong filesystem root. The tool also lacked a receipt strong enough for agents to distinguish MCP-generated decks from manually generated files saved under the same output folder.

Validation

  • node tests/mcp.test.mjs
  • node tests/mcp-stdio.test.mjs
  • node tests/mcp-http.test.mjs
  • node tests/codex-plugin.test.mjs
  • npm run mcp:smoke
  • npm test

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
judgmentkit-ai Ready Ready Preview, Comment Jul 6, 2026 6:41am

@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: c9f1f3674a

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

Comment thread src/mcp.mjs Outdated
const absoluteReceiptPath = `${outputTarget.absolutePath}.receipt.json`;
const receiptPath = `${outputTarget.relativePath}.receipt.json`;

await fsp.writeFile(absoluteReceiptPath, `${JSON.stringify(receipt, null, 2)}\n`, "utf8");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refuse symlinked receipt paths

When a workspace already contains outputs/judgmentkit-slide-decks/<deck>.pptx.receipt.json as a symlink, this unguarded writeFile follows the symlink. prepareSlideDeckOutputTarget() only rejects symlinks at the PPTX path, so a successful export can overwrite a writable file outside the allowed output directory while still reporting a valid receipt. Apply the same lstat/no-symlink protection to the sidecar receipt path before writing it.

Useful? React with 👍 / 👎.

Comment thread src/mcp.mjs Outdated
Comment on lines +1455 to +1456
root.includes(`${path.sep}.codex${path.sep}`) ||
root.includes(`${path.sep}.cache${path.sep}codex-runtimes${path.sep}`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat the .codex root itself as unsafe

If the MCP process is launched with process.cwd() set exactly to a .codex directory, this predicate returns false because it only matches paths containing /.codex/ with a trailing separator. In that context resolveSlideDeckWorkspaceRoot() accepts .codex as the implicit workspace and writes outputs/... under it instead of failing with workspace_root_missing, which contradicts the new path contract for unsafe implicit roots. Add exact directory-name checks for .codex and the runtime-cache root before accepting the cwd.

Useful? React with 👍 / 👎.

@mikeylong
mikeylong merged commit 501991d into main Jul 6, 2026
5 checks passed
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