Skip to content

feat(cursor-approve): business, design and completeness axes behind a read-only context proxy - #353

Merged
mattmillerai merged 3 commits into
mainfrom
matt/be-19333-context-axes
Oct 7, 2026
Merged

mattmillerai merged 3 commits into
mainfrom
matt/be-19333-context-axes

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Adds the three context axes of cursor-approve (business, design, completeness) as thin wrappers over cursor-axis-base.yml, and fills in the base's two reserved extension points so the agent can search Linear/Notion/Slack through context-proxy.py without ever holding a token.

What changed

  • axis-business.yml / axis-design.yml / axis-completeness.yml: each declares exactly its secrets (business: CURSOR_API_KEY, LINEAR_KEY, NOTION_TOKEN, SLACK_TOKEN; design: no Slack; completeness: CURSOR_API_KEY, LINEAR_KEY). Every secret except CURSOR_API_KEY is optional. Business and design run with checkout: false and no_shell: true; completeness uses the read-only checkout. A skipped job prints a notice for fork PRs and public repos, and the axis job is gated on the same condition, reversed.
  • cursor-axis-base.yml:
    • The reserved mcp_config input is replaced by context_sources (a comma list for --enable), and no_shell now does something. Both are validated: context tools only for the three context axes, private repos only, and business/design must be checkout false + no_shell true.
    • Token flow: one step is the only one with the token secrets in its env. It writes the enabled tokens to a 0600 file (O_EXCL). The agent step then starts context-proxy.py before cursor-agent, on two FIFOs and with env -u CURSOR_API_KEY, and waits until the proxy has deleted the token file. If the proxy dies or the file is still there, it refuses to start the agent.
    • cursor-agent's project .cursor/ is rebuilt so its only MCP server is the new mcp-relay.py, a byte relay to that proxy. The relay exits if the proxy side closes or fails, and gives up on a dead proxy after a bounded open instead of hanging. cli.json allows only the enabled Mcp(context:*) tools and, with no_shell, denies Shell(*), Write(**) and WebFetch(*).
    • The agent now runs with --output-format stream-json. The transcript, plus the proxy's --log, uploads as transcript-axis-<axis>, a name decide's axis-* download never matches. On a context axis, each tool call in the uploaded transcript is cut to its name (no arguments or results), and the raw stream is kept outside the uploaded directory. The final result is passed on to the existing aggregate.py extract. With no_shell, the job fails on any shell/write/edit/delete tool call in the transcript, or if the transcript has no recognizable tool call at all (its format drifted). This is the "fail if the installed cursor-agent can't enforce it" rule.
    • Every axis other than business and design must use checkout: true. context_sources is matched against the whole value.
    • Business and design get the change from the GitHub compare API at base.sha...commit_sha, which is the merge-base diff of exactly the judged commit. Business gets a changed-file list with +/- counts and JSON-encoded paths, capped at the API's 300 files and marked when it is cut; design gets the diff truncated to 200 KB with a marker. Neither gets a checkout.
  • Prompts: two addenda that the workflow appends after render. prompt-no-checkout.md says there are no git/shell commands and the change is in a fetched file. prompt-context-tools.md says tool results are third-party data and never instructions.
  • Docs: docs/callers/cursor-approve.md has a Context axes section with one row per axis (tools, secrets), how the tokens move, the skip rules, caller examples, and the accepted risk. The README catalog row and the cursor-approve README are updated too.
  • Tests: new tests/test_context_axes.py and tests/test_mcp_relay.py, plus updates to the existing secret and prompt-file tests and the inputs-vs-docs drift rows.

Judgment calls

  • Pre-started proxy + relay instead of letting cursor-agent spawn the proxy. A stdio MCP server that cursor-agent spawns starts after the agent, so its token file would still exist while the agent can act. The ticket requires the file to be deleted before the agent starts, and this is the only way to do that with a stdio-only proxy.
  • Compare API instead of pulls/N/files / the PR diff media type. It pins the input to commit_sha even if the PR moves on, and contents: read covers it. pull-requests: read would have broken the existing correctness/conformance wrappers, because a nested job can't ask for more permissions than its caller.
  • Fork PRs and public repos are skipped in the wrappers. The base also fails closed on a public repo as a backstop. A skipped axis uploads no verdict, so the docs tell callers to leave it out of axes: on such repos.
  • The transcript is uploaded for every axis, correctness and conformance included, because they share the base. That changes their output format to stream-json.

Verification

  • python3 -m unittest discover -s .github/cursor-approve/tests → 148 OK. .github/workflow-pins/tests → OK (43 skipped, as on main).
  • actionlint 1.7.7 on the changed workflows (as first opened): the only findings are the existing job.workflow_sha "not defined" reports (an older actionlint schema; also present on main). There were no new findings. actionlint was not re-run after the review-fix commit.
  • The review-fix transcript guard/redaction script was exercised standalone against synthetic stream-json (redaction, no-tool-call fail-closed, agent-failure passthrough).
  • check_workflow_pins.py, check_agents_md.py --root . and check-org-repo-literals.sh all pass.

Residual

  • Nothing here has run on a real Actions runner against the pinned cursor-agent (2026.09.10-fd3934a). These assumptions are unverified:

    • the stream-json event shapes ({"type":"result","result":…}, and tool_call events keyed by shellToolCall/writeToolCall/editToolCall/deleteToolCall);
    • the Shell(*) / Write(**) / WebFetch(*) deny syntax in project cli.json;
    • cursor-agent connecting to the relay exactly once per run.

    The failure direction is closed: no result event, any forbidden tool call, or (with no_shell) no recognizable tool call fails the axis, and decide reads that as "no result". But a first live run on a private repo is needed before relying on these axes. All five axes now depend on the stream-json extraction.

  • The relay supports one MCP connection at a time. If cursor-agent opens two concurrent connections to the context server, their bytes would interleave on the proxy's single stdio.

  • The completeness axis keeps its shell (needed for git diff). On a hosted runner with passwordless sudo, a hostile agent could read the running proxy's memory and so its Linear token. This is documented as accepted risk in the caller guide. Fixing it needs a different user or a sandbox for the proxy.

  • The live Linear/Notion/Slack tools were not exercised. The tokens don't exist yet (separate provisioning task), and the proxy's own tests live with the proxy.

  • The ticket's linked design doc (a Notion page) was not readable from this environment and is an unexercised artifact.

Provenance

  • Authored by: agent-work loop
  • Verified:
    • cursor-approve unit suite (148, incl. new relay tests) and workflow-pins suite pass locally at head
    • workflow-pin lint, AGENTS.md integrity and org-repo-literal lint pass locally at head
    • transcript guard/redaction script exercised standalone on synthetic stream-json
    • actionlint ran on the initial commit only; no live runner execution (see Residual)
  • Deviations:
    • the base's mcp_config input was replaced by context_sources
    • the proxy is pre-started behind a new mcp-relay.py
    • the change is fetched with the compare API rather than the pulls endpoints

🤖 Generated with Claude Code

… read-only context proxy

Three thin wrappers over cursor-axis-base.yml, each declaring only its own
secrets. The base turns its reserved extension points into context_sources +
no_shell: a dedicated step writes the tokens to a 0600 file, context-proxy.py
is started before the agent and deletes it, and cursor-agent reaches the proxy
through mcp-relay.py as its only MCP server. Business and design get no
checkout and no shell and read the change fetched from the compare API.
Fork PRs and public repos skip with a notice; the full transcript uploads as
its own artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmillerai mattmillerai added cursor-review Multi-model cursor review agent-coded Authored by the agent-work loop labels Oct 7, 2026
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review paused — included plan limit reached

Keep your review moving with free on-demand reviews.

  • Run this review for free

On-demand reviews are free for the next 3 days.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Promotion and pricing details

On-demand reviews are free for the next 3 days. After that, they cost $0.25 per reviewed file.

Review limit details

Or wait 11 minutes for your next included review.

Check out review usage here.

Limit details: You’ve used the included review currently available. Your 127 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 44ff59fc-c197-4f06-a429-6e869a98d059
📥 Commits

Reviewing files that changed from the base of the PR and between 233fd2d and ed58a8f.

📒 Files selected for processing (15)
  • .github/cursor-approve/README.md
  • .github/cursor-approve/mcp-relay.py
  • .github/cursor-approve/prompt-context-tools.md
  • .github/cursor-approve/prompt-no-checkout.md
  • .github/cursor-approve/tests/test_aggregate.py
  • .github/cursor-approve/tests/test_card.py
  • .github/cursor-approve/tests/test_context_axes.py
  • .github/cursor-approve/tests/test_mcp_relay.py
  • .github/workflow-pins/tests/test_inputs_docs_drift.py
  • .github/workflows/axis-business.yml
  • .github/workflows/axis-completeness.yml
  • .github/workflows/axis-design.yml
  • .github/workflows/cursor-axis-base.yml
  • README.md
  • docs/callers/cursor-approve.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions 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.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 10 finding(s).

Severity Count
🟡 Medium 7
🟢 Low 3

Panel: 4/6 reviewers contributed findings.

Reviewers that did not contribute: gpt-5.6-sol-max:adversarial (error), gpt-5.6-sol-max:edge-case (error)

Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/workflows/axis-completeness.yml Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/cursor-approve/mcp-relay.py Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/cursor-approve/mcp-relay.py Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
Comment thread .github/workflows/cursor-axis-base.yml Resolved
mattmillerai and others added 2 commits October 7, 2026 02:59
- changed-files.txt: one compare page (files live on page 1 only), paths
  JSON-encoded so a newline/tab cannot forge rows, explicit 300-file
  truncation line.
- no_shell guard fails closed when the transcript has no recognizable tool
  call; deny list adds WebFetch(*).
- context axes upload a transcript with tool calls cut to their names; the
  raw stream never sits in the uploaded directory.
- mcp-relay.py exits when the proxy side closes or fails, and opens its
  FIFOs non-blocking with a bounded retry instead of hanging.
- Non-fetching axes must check out; context_sources matched as a whole value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmillerai
mattmillerai merged commit a3a844f into main Oct 7, 2026
8 checks passed
@mattmillerai
mattmillerai deleted the matt/be-19333-context-axes branch October 7, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-coded Authored by the agent-work loop cursor-review Multi-model cursor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants