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

Game door: choose whether a game-door crew turn gets a restricted tool set #18220

opened this in answer to

Merged 4h 59m ago, live in production

This implements option (a) from the issue: a crew turn that starts in game can read, and nothing more. The issue says the owner still has to choose, and no owner comment is on it. If they pick differently, revert this pull.

Notes

opened this

This implements option (a) from the issue: a crew turn that starts in game can read, and nothing more. The issue says the owner still has to choose, and no owner comment is on it. If they pick differently, revert this pull. Tests, tsc and the gate pass.

What changed

  • A conversation the game door opens is marked limited in a new table, conversation_door. It is set in src/games/chat.ts, with the logic in src/core/conversation_door.ts, and the migration has its pin.
  • The limit is enforced in /mcp (limitedOut in src/http/mcp/shared.ts), before anything is held or done. A limited conversation's agent token may call reads, plan-only calls and games; any other write is refused with DOOR_LIMITED.
  • games is still held for the player's confirmation for anything but list, as before.
  • The same gate covers the token-free shortcuts (report, start, offer), so those are blocked too.
  • Enforcing at the MCP door means the agent cannot get round it by choosing a different tool.
  • The behaviour is described in docs/features/games.md.
  • test/conversation-door.test.ts shows tell refused in a game conversation, allowed in a web one, and reads still working. The games case there is weak: it only checks that games is not refused with the door-limited message, and the call itself is refused for another reason.

What I left out

  • Clickable [Yes] and [No] in game (a Confirmed action calling sayYes/sayNo, plus the proxy plugin and an audit entry). The issue calls it a larger piece, so it needs its own issue.
  • Lifting the limit. A game conversation stays limited if the person later writes in it on the web; they start a fresh Talk conversation for writes. The docs say so.

Door rule: commit says No door:. This is enforcement behind the MCP, with no new page, action or tool, so no TUI side was added.

Try: in game, /forge close issue 1 on <repo>. The crew should say it can't, and the issue stays open.

Closes #18218

5 earlier comments
commented

This implements option (a) from the issue: a crew turn that starts in game can read, and nothing more. The issue says the owner still has to choose, and no owner comment is on it. If they pick differently, revert this pull. Tests, tsc and the gate pass.

What changed

  • A conversation the game door opens is marked limited in a new table, conversation_door. It is set in src/games/chat.ts, with the logic in src/core/conversation_door.ts, and the migration has its pin.
  • The limit is enforced in /mcp (limitedOut in src/http/mcp/shared.ts), before anything is held or done. A limited conversation's agent token may call reads, plan-only calls and games; any other write is refused with DOOR_LIMITED.
  • games is still held for the player's confirmation for anything but list, as before.
  • The same gate covers the token-free shortcuts (report, start, offer), so those are blocked too.
  • Enforcing at the MCP door means the agent cannot get round it by choosing a different tool.
  • The behaviour is described in docs/features/games.md.
  • test/conversation-door.test.ts shows tell refused in a game conversation, allowed in a web one, and reads still working. The games case there is weak: it only checks that games is not refused with the door-limited message, and the call itself is refused for another reason.

What I left out

  • Clickable [Yes] and [No] in game (a Confirmed action calling sayYes/sayNo, plus the proxy plugin and an audit entry). The issue calls it a larger piece, so it needs its own issue.
  • Lifting the limit. A game conversation stays limited if the person later writes in it on the web; they start a fresh Talk conversation for writes. The docs say so.

Door rule: commit says No door:. This is enforcement behind the MCP, with no new page, action or tool, so no TUI side was added.

Try: in game, /forge close issue 1 on <repo>. The crew should say it can't, and the issue stays open.

commented

I merged main into the branch, resolved the two conflicts, and pushed; the forge's check has yet to run on the new commits. Locally, bun x tsc --noEmit, the game-chat tests and test/conversation-door.test.ts pass. bun scripts/gate.ts --fix rewrapped one comment, which I committed and pushed.

  • src/games/chat.ts: I kept main's new behaviour, where a player's next words continue their conversation for that box and /forge clear ends it. A new conversation made at the door still gets limitToGame, so the crew's turn from game stays limited to reads and the held games tool (#18218). A kept conversation keeps the limit it was created with.
  • docs/features/games.md: I merged the two !forge <anything else> paragraphs into one. main's text said the door has exactly the authority Talk has on the web, which contradicts #18218. The merged paragraph keeps the continue-and-clear behaviour and drops the claim that the door runs close/assign/edit/merge at once with an Undo.

The gate still prints two similarity warnings (0.72 and 0.77) between test/conversation-door.test.ts and other tests. They are advisory and I left them.

commented

The failing test is fixed and pushed, along with a fresh merge of main. test/game-door.test.ts and test/conversation-door.test.ts pass locally, and bun x tsc --noEmit is clean. I haven't re-run the whole suite, so the forge's check on this push is the full test.

The test came from main and asserted the old policy, where a crew turn started from game gets an admin write like release_now held for a yes. This pull limits those turns to reads and the held games tool. So release_now is now refused with "forbidden", a plain-text reply, not held JSON. The test's JSON parse then threw.

The test was out of date, not the code, so I changed it:

  • Renamed: it now reads "the games tool is held and any other write is refused, never run".
  • games actions: it still checks that restart, start, env and console are each held and run nothing.
  • release_now: it now checks the call is refused, with nothing held and nothing run.
  • Reads: a games list is still not held.

The tool helper now returns the refusal text instead of throwing when the reply isn't JSON.

The gate still prints one advisory similarity warning between test/conversation-door.test.ts and test/mcp-shortcut-fence.test.ts, which I left.

commented

Parked, offered to the crew again: it sat 6 h with no push, so juniper has it now (to review it). No verdict yet. Still parked 6 h from now, it is closed; the branch stays and Reopen restores it. (The forge posts this; nobody wrote it by hand.)

commented

Game-door conversations are now limited to reads and the held games tool. Conversations the door opened before this change are limited too. This is option (a) from the issue, which removes reachable writes. I ran tsc, test/conversation-door.test.ts and test/game-door.test.ts (35 pass) and the gate's --fix; I did not run the full suite.

What changed

  • games test: it now calls games with action: "power", kind: "restart" on a real server box in a limited conversation. It asserts the reply carries a needs_confirm id and that the player's waiting confirms rise by one. A games action: "list" call returns without a hold and adds none. Removing GAME_DOOR_WRITES would now fail this test.
  • Backfill: the migration now inserts into conversation_door every conversation that still exists and is pointed at by game_talk (each player's kept conversation) or game_chat_job (each kept job).
  • Why not game_chat: that table has no conversation column, so game_talk and game_chat_job are the places that point at conversations.
  • Backfill test: the new test drops the table, inserts a game_talk row, re-runs the migration SQL, and checks the game conversation is limited and a web one is not.
  • Docs: docs/features/games.md now says older game conversations are covered.

What I left out

  • One-line notice: the web conversation does not yet say it is limited. That needs a web, terminal and how-to change together, so it should be its own issue. The owner still hasn't picked between the issue's options.
  • Gate notes: the gate flags call and tokenFor in test/conversation-door.test.ts as similar to helpers in other tests. I left them local and did not factor out a shared helper.
  • Door line: the commit keeps its No door: line, since nothing is added to a page, action, API route or tool.

To try it, run bun test test/conversation-door.test.ts.

commented

The check failed because my last push edited 20261204120000-conversation-door.ts after it was pinned. I've restored it to its pinned contents and moved the backfill into a new migration, 20261204130000-conversation-door-backfill.ts, with its pin. I pushed that.

The backfill is the same as before: it limits every existing conversation that game_talk or game_chat_job points at. The migration test now runs the new migration after clearing conversation_door, instead of dropping the table.

Locally test/schema-migrations.test.ts and test/conversation-door.test.ts pass (31 tests), and so does test/boot-production.test.ts (8). tsc is clean. I did not reproduce the two boot-production failures (the FORGE_ENGINE worker tests) from the check log. The log says they fail only beside schema-migrations, and main was green on them, so I took them as fallout from the pin failure.

Nothing else changed in this pull. The web conversation still shows no line saying it is limited.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs