Skip to content

fix(ce-doc-review): tell the peer the document is embedded so it never reads from disk - #1857

Merged
tmchow merged 1 commit into
EveryInc:mainfrom
Nishfleet:fix/opencode-prompt-in-run-dir
Oct 14, 2026
Merged

tmchow merged 1 commit into
EveryInc:mainfrom
Nishfleet:fix/opencode-prompt-in-run-dir

Conversation

@nish3451

Copy link
Copy Markdown
Contributor

Closes #1856

Summary

On the OpenCode route, the worker runs the peer in an empty temp workspace with acpx --deny-all, and OpenCode's external_directory permission defaults to ask. If the peer model goes looking for the prompt or the document on disk (an absolute path outside its workspace), OpenCode raises a permission request, acpx denies it, and the peer can end its turn with an explanation instead of the findings JSON, so the run publishes no artifact.

The document is already embedded in the prompt, so no read is ever needed. This adds one sentence to the peer prompt, ahead of the schema: the complete document is embedded below, do not call tools or read files, and ignore a denied read. No permission or isolation setting changes. The empty workspace stays empty, and no path is added to the OpenCode permission block. The code-review worker is untouched: it already allows external_directory because it stages large diffs outside the repo on purpose.

Validation

  • New route test: the prompt sent to the peer contains the instruction, before the document content, and names no scratch path. The two route test files pass (bun test tests/skills/ce-doc-review-cross-model-routes.test.ts tests/skills/ce-code-review-cross-model-routes.test.ts).
  • I could reproduce the permission request only by forcing a read of an absolute path (OpenCode sends session/request_permission for external_directory, acpx exits 5). Ordinary runs did not trigger it, so the failure is model-dependent and I could not show a before/after rate.

Security Disclosure

No security-relevant changes. Prompt text only; permissions, workspace isolation, and egress are unchanged.

Agent Disclosure

  • Model: Claude Code · claude-sonnet-5-5

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T07:22:13.105959Z 2b840ce Draft marked ready
ℹ️ 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.

@nish3451
nish3451 marked this pull request as draft October 14, 2026 05:36
@tmchow
tmchow marked this pull request as ready for review October 14, 2026 07:14
@tmchow
tmchow merged commit 7a68002 into EveryInc:main Oct 14, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026

@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: 2b840ceb4c

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

# The whole document is embedded below. Say so, so a peer never goes looking for the
# prompt or the document on disk: a read outside its workspace is a permission
# request that is denied, and a peer that stops to explain the denial returns no JSON.
printf 'The complete document is embedded below under "Document content". Do not call tools or read files; if any read is denied, ignore it and answer from the embedded text.\n'

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 Reconcile the peer prompt's conflicting file-read rules

When this route assembles the prompt, line 621 first injects the full <output-contract> from references/subagent-template.md, whose line 78 explicitly says the reviewer may use non-mutating tools including file reads. This new unconditional prohibition leaves both same-level instructions in every peer prompt, so a peer gathering feasibility context can still follow the read permission and reproduce the OpenCode external_directory denial/no-artifact outcome this change is intended to prevent. Reconcile the route-specific contract rather than appending a denied-read case so the assembled prompt contains one unambiguous tool-use rule.

AGENTS.md reference: AGENTS.md:L114-L114

Useful? React with 👍 / 👎.

expect(sent).toContain("Do not call tools or read files")
expect(sent.indexOf("Do not call tools or read files")).toBeLessThan(sent.indexOf("Document content:"))
expect(sent).toContain("# embedded body")
expect(sent).not.toContain(path.dirname(sb.logs.prompt))

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 Assert against the actual document and prompt paths

sb.logs.prompt is the stub's copy path under /tmp/xmodel-doc-route-*, while the document created by makeDoc and the real --file prompt live in different temp trees (xmodel-doc-* and xmodel-doc-scratch-*). Consequently, leaking either relevant absolute path into sent—the regression this assertion claims to prevent—still leaves this check green. Retain the document path or read the --file argument from argv(sb) and assert against that actual directory so the new guard is falsifiable.

AGENTS.md reference: AGENTS.md:L181-L181

Useful? React with 👍 / 👎.

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.

ce-doc-review OpenCode route can end with no artifact after an external_directory permission denial

2 participants