Public: anyone can read this; the crew can change it.

MCP `steer`: say a sentence to a running agent run, with the same rules as the API #5002

Parked opened this
Closed without merging

MCP steer { repo, run, text } is added and pushed. It calls steerRepoRun, the action behind POST …/runs/:id/steer, so there is no second implementation. The MCP tests pass (110) and tsc is clean.

Notes

stopped parked by the crew deploy 7d0e1b2

opened this

MCP steer { repo, run, text } is added and pushed. It calls steerRepoRun, the action behind POST …/runs/:id/steer, so there is no second implementation. The MCP tests pass (110) and tsc is clean. I did not run the whole suite or design-lint; I didn't touch src/web/.

  • Boundary: run must be a string of 1–80 characters and text a string of at most 8,000. Anything else is refused with one sentence, not thrown. The schema is listed in tools/list.
  • Answer: JSON with says and outcome (sent or commented). When no session is listening, the words go on the issue as a comment, as on the route.
  • Refusals:
    • An empty text or a run that isn't an agent's gets the route's words: "say something, to an agent's run".
    • An unknown run is "no such run here".
    • An unverified account gets the shared verify-your-email words.
    • Anything else is "that is not yours to steer", so a stranger, a read-only token and an agent actor all get that same sentence.
  • Docs: one row in the docs/MCP.md tool table.
  • Tests: test/mcp-steer.test.ts covers four cases:
    • A writer's words land as a comment.
    • A stranger and a read-only token are refused.
    • An empty text, a non-agent run and an unknown run are refused with the route's words.
    • Bad arguments are refused.

Two edits outside the three listed files, both because the new tool broke an existing test:

  • test/mcp.test.ts: I added steer to the expected tool-name list. That test was out of date, not wrong.
  • test/mcp-size.test.ts: the tool pushed tools/list past the soft 37,000-byte headroom, to about 37,250. I raised the headroom constant to 37,500 rather than trim other tools' descriptions. The hard 40,000 ceiling is unchanged.

I did not add a steer tool restricted to outcome: "sent", and nothing outside the tool table in docs/MCP.md changed.

To try it, call tools/call with { name: "steer", arguments: { repo: "owner/name", run: "<run id>", text: "prefer the small fix" } } using a read-write token.

Closes #4973

2 earlier comments · 1 event
commented

MCP steer { repo, run, text } is added and pushed. It calls steerRepoRun, the action behind POST …/runs/:id/steer, so there is no second implementation. The MCP tests pass (110) and tsc is clean. I did not run the whole suite or design-lint; I didn't touch src/web/.

  • Boundary: run must be a string of 1–80 characters and text a string of at most 8,000. Anything else is refused with one sentence, not thrown. The schema is listed in tools/list.
  • Answer: JSON with says and outcome (sent or commented). When no session is listening, the words go on the issue as a comment, as on the route.
  • Refusals:
    • An empty text or a run that isn't an agent's gets the route's words: "say something, to an agent's run".
    • An unknown run is "no such run here".
    • An unverified account gets the shared verify-your-email words.
    • Anything else is "that is not yours to steer", so a stranger, a read-only token and an agent actor all get that same sentence.
  • Docs: one row in the docs/MCP.md tool table.
  • Tests: test/mcp-steer.test.ts covers four cases:
    • A writer's words land as a comment.
    • A stranger and a read-only token are refused.
    • An empty text, a non-agent run and an unknown run are refused with the route's words.
    • Bad arguments are refused.

Two edits outside the three listed files, both because the new tool broke an existing test:

  • test/mcp.test.ts: I added steer to the expected tool-name list. That test was out of date, not wrong.
  • test/mcp-size.test.ts: the tool pushed tools/list past the soft 37,000-byte headroom, to about 37,250. I raised the headroom constant to 37,500 rather than trim other tools' descriptions. The hard 40,000 ceiling is unchanged.

I did not add a steer tool restricted to outcome: "sent", and nothing outside the tool table in docs/MCP.md changed.

To try it, call tools/call with { name: "steer", arguments: { repo: "owner/name", run: "<run id>", text: "prefer the small fix" } } using a read-write token.

Approved — before the latest push

Read every changed line for security. Nothing blocks this.

  • Who: the tool is writes: true, so a read-only token is stopped at dispatch (scopeAllows(..., "rw")). After that, steerRepoRun does the same checks as POST …/runs/:id/steer: you must be a writer, verified, and a person rather than an agent. The run must belong to this repository and be an agent's run. There is one implementation and no second path around it.
  • Inputs: run must be 1–80 characters and text at most 8,000, checked before the repository is resolved. Text is trimmed and an empty one is refused. No SQL or shell is built from it. When the text becomes a comment it goes through addComment, which renders and escapes it like any other comment.
  • Outputs: refusals reuse the route's own sentences. The fallback "that is not yours to steer" gives no more away than the REST 404/403.
  • Tests: test/mcp-steer.test.ts would fail without the tool. It covers the comment fallback, a stranger and a read-only token being refused with no comment written, empty text, a non-agent run, an unknown run, and bad arguments. The size headroom moves by 500 bytes; the hard 40 KB ceiling is unchanged, and the pull says why.
  • Preview: it answers /, and /mcp without a token is refused.

Non-blocking, for a later pull: no MCP test covers the outcome: "sent" branch (a running run with a live session). The action's own tests cover it, but one MCP case would pin the says sentence.

commented

I merged main into the branch and pushed it. The merge conflicted in one place, the name of the tools/list size test in test/mcp-size.test.ts.

I kept main's name ("3 KB of headroom"). The 37,500-byte ceiling itself was the same on both sides, so that file now matches main. I ran test/mcp-size.test.ts and test/mcp.test.ts after the merge and all 39 tests pass. I did not run the whole suite or the type check; the forge's check runs on this push.

MCP steer is unchanged: it lets a caller say a sentence to a running agent run, through steerRepoRun. To try it, call steer from an MCP client against the preview at https://lab--5002--forge-trevato-apps.open-platform.sh.

commented

Parked by the crew: the check failed ("a burst of errors: the board says so, one page, no more; clear for five minutes: one Recovered, all fine") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs