Repository navigation
Offer MCP as four tool families within 4 KB - #6706
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
Sinity
left a comment
There was a problem hiding this comment.
ready-for-train: 2b3e2fc fixes the two web::tests::cancellation failures (ready_call refused operations without an MCP tool, so typed_url("sql") panicked); such ready calls now have a null MCP form. Focused job 608 queued behind the build pause.
Every agent session pays for tools/list and the server instructions before
it asks anything. The integration build sent 401.6 KB (333 KB of per-tool
outputSchema) plus 8.2 KB of instructions that repeated every description.
MCP now offers four tools, generated from the command table in the shape of
command-surface's tool families: polylogue_read, polylogue_context,
polylogue_note and polylogue_chat. A call is {operation, arguments,
request_id, deadline}; arguments are the rows' listed arguments merged by
name with bare types. Rarely needed options are marked unlisted: accepted,
checked by their row, and published by `explain capabilities`, which also
carries each row's answer schema and the answer envelope's schema. Tools
carry no outputSchema. The instructions are a hand-written card of at most
800 bytes; `polylogue manual` appends the generated operation reference.
list is a query form and complete is the protocol's completion method, so
neither is an operation. timeline and cost stay operations, since their
logical-day and per-model pages are not query results.
Deleted: one tool per command, McpArguments, Command::typed_mcp_schema,
Command::mcp_name and the generated reference in the instructions.
Tests that compared each tool's inputSchema with the row's typed schema now
check the family schema, as docs/agents.md "MCP server" states: "The input
schema lists, under `arguments`, the arguments of the tool's rows merged by
name, each with its bare type".
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
The full agent guidance moves to docs/agent-guide.md, which `polylogue manual` prints between the card and the operation reference, instead of being dropped. MCP tool schemas and `explain` share one kind-to-schema mapping. polylogue_chat is not marked idempotent, since a chat or backfill request starts a new browser action. A test ties each typed operation's argument fields to its declared arguments, and the kept-result test passes its retry identity beside the arguments. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
command-surface lists an array argument as {"type": "array"}; the item
type is in the row's schema that explain publishes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
ready_call refused any operation without an MCP tool, so the HTTP and CLI forms of a `sql`, `list`, `live` or `notices` call could not be built (the web cancellation tests build their URLs this way). Such a call now has a null MCP form and its other forms as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
2b3e2fc to
297b385
Compare
The slot check took any free reader, and with the second slot idle it returned before the server saw the disconnect, so the cancellation was not yet observed. Holding the other slot, as the HTTP disconnect test does, makes the check wait for the SQL read's slot, which is released only after its cancellation. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em
Sinity
left a comment
There was a problem hiding this comment.
ready-for-train: c626ea4 makes no_header_null_sql_has_no_implicit_read_cap_and_disconnect_still_cleans_up deterministic (holds the other reader slot so the slot check waits for the SQL read's own slot, released only after its cancellation); focused job 765: all 10 web::tests::cancellation tests and the ready-call test pass.
Sinity
left a comment
There was a problem hiding this comment.
ready-for-train (coordinator: lane's focused job 765 passed all 10 cancellation tests at this head)
Every agent session pays for MCP
tools/listand the server instructions before it asks anything. The integration build sent a 401.6 KBtools/list(333 KB of it per-tooloutputSchema) and 8.2 KB of instructions that repeated every tool description. This PR brings the two together under 4,096 bytes of compact JSON and keeps every MCP capability reachable.What changed
polylogue_read,polylogue_context,polylogue_noteandpolylogue_chatare generated from the command table (Command::tool,commands::Tool). The shape is commoncommand-surface's tool family (feat: add async pipeline, schema registry, and synthetic corpus #78): a call is{operation, arguments, request_id, deadline}, andoperationis required when a tool has several rows.argumentsis the listed arguments of the tool's rows merged by name, with bare types. An argument that two rows type differently becomes ananyOfnaming the rows. Each row checks its own arguments at dispatch. A comment marks the generator to be replaced byOperationTable::mcp_toolswhen Polylogue adopts feat: add async pipeline, schema registry, and synthetic corpus #78.unlistedon theirArg. Examples: read's expansions, format and delivery; cost's month and model; attachment ranges; watch timing. They stay out of the schema but are accepted and checked.explain capabilitieslists each row's tool, its complete argument schema, its unlisted arguments and its answer schema, plus the answer envelope's schema once.polylogue manualnames every argument.outputSchemaon any tool. Results keepstructuredContent.docs/agent-manual.md, 555 B as a JSON string). The full guidance moves todocs/agent-guide.md.polylogue manualprints the card, then the guide, then the generated operation reference.nexton read and attachment pages) now come in the tool's call form:{name: polylogue_read, arguments: {operation, arguments, request_id, deadline}}.readOnlyHintcomes from the tool's access, and every row of a tool shares that access.destructiveHintis never set.idempotentHintis set except onpolylogue_chat, because chat send and backfill start begin a new browser action on every call.openWorldHintis set onpolylogue_chat.Deviations from the brief, agreed with the coordinator
timelineandcoststaypolylogue_readoperations. Their logical-day, calendar and per-model response pages have no query-language equivalent.listis not an operation, since it issessions where …throughquery.completeis not an operation either; the protocol'scompletion/completecovers it.chat listandbackfill listare inpolylogue_read, notpolylogue_chat, because a family's rows share one access.request_idanddeadline. feat: add async pipeline, schema registry, and synthetic corpus #78 will emit only the envelope options a table declares. Rows built from flat arguments take a millisecond deadline only, anddeadline: nullis refused for them with a typed error.Deleted
Command::mcp,Command::mcp_nameandCommand::typed_mcp_schema.protocol::operations::McpArguments, replaced byToolCall.outputSchemaand the generated command reference in the instructions.commands::kind_schemais now shared withexplain.Laws and tests
All in
crates/polylogue/src/mcp/tests.rsunless noted. The laws are written indocs/agents.md.mcp-surface-size:tools_and_instructions_fit_four_kilobytes.mcp-covers-command-table:every_tool_operation_is_reachable_from_exactly_one_tool.mcp-tool-access-is-uniform:tool_annotations_follow_the_command_table.mcp-instructions-are-the-card:server_instructions_are_the_card_naming_every_tool.mcp-arguments-are-listed-or-explained:every_argument_is_in_its_tool_schema_or_unlistedandtyped_operations_declare_every_field_of_their_arguments.mcp-operation-dispatch:a_tool_call_names_one_of_its_operations.mcp-detail-on-demand:capabilities_publish_each_operation_with_its_tool_unlisted_arguments_and_answer, inexplain/tests.rs.mcp::tests::callandcall_asturn a command name into its family call.every_client_answers_the_same_request_identicallyrunslistas aquerycall andcompletethroughcompletion/complete, and compares both with the CLI and HTTP.Changed expectations:
mcp_schemas_follow_the_argumentscompared each tool'sinputSchemawith the row's typed schema. It now checks the family schema, asdocs/agents.md"MCP server" states: "The input schema lists, underarguments, the arguments of the tool's rows merged by name, each with its bare type".Verification
compilejob 474 (-p polylogue --tests): clean, no warnings.focusedjob 482: 87 of 88 tests passed, including the size gate and reachability. The run hit the 30-minute job timeout after a 29-minute cold build, whileread_pages::budgeted_mcp_output_contains_one_bounded_layout_and_no_duplicate_source_records, a long whole-byte read, was still running.focusedjob 573 on the final head: see the follow-up comment.tools/listis about 3.4 KB and the instructions 555 B, which is under the 4,096 B limit.polylogue mcpmeasurement after deploy.🤖 Generated with Claude Code
https://claude.ai/code/session_01AcQETkbTfFMr1hgNJ8A3em