Skip to content

feat(shell): connect the shell to tool grammars - #327

Merged
ferdingler merged 19 commits into
mainfrom
feature/tool-grammars-enforce
Nov 6, 2026
Merged

ferdingler merged 19 commits into
mainfrom
feature/tool-grammars-enforce

Conversation

@ferdingler

@ferdingler ferdingler commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This connects the shell to tool grammars, so a grammar rule actually fires. Until now a rule like "forbid git push --force" loaded but did nothing, because the shell still saw every command as a plain spawn.

Now when the agent runs a program that has a grammar, Box decides the grammar action, like Tool::git::Action::"push", instead of a plain spawn. That covers sh -c 'git push' and MCP servers started through that program too. Telemetry records the action, and the startup warning is gone. It also includes a few small leftovers from the loading PR, like Tool not being allowed as an MCP server name.

Approvals

New public names in the policy crate (behind the tool-grammars flag) and the [mcp.Tool] refusal are approved by me. The denial message the agent sees stays the same; the grammar action shows up only in telemetry.

Related Issues

Follows #281.

Type of Change

New feature

Testing

The policy, telemetry, and box tests that don't need a real box pass locally, and I broke each new check on purpose to make sure a test caught it. The end-to-end tests (push denied, status allowed, unmodeled denied, flag off unchanged) need a real box, so CI covers those and macOS.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

The policy crate has a tool grammar model, a schema generator, and a
binding table, but `box.toml` cannot carry a grammar and no non-test
engine opener installs one. So an operator cannot write a rule on a
`Tool::<name>` action, and the Box CLI cannot hand Box Core one
finished `box.toml` that holds its grammars. The test-only opener also
let a caller pair a `GrammarBindings` with an engine that did not know
the schemas of those grammars. A spawn bound to such a grammar is
denied with no message.

The staged opener also held a rule that names an undeclared
`Tool::git` action as if an MCP server named `git` could declare it
later. The box then started and the rule did not enforce.

## Solution

- Add the switch `[experimental-features] tool-grammars` (boolean,
  default `false`).
- Add a sixth field `grammar` to `[tool.<name>]`. It holds the grammar
  inline, with the same keys as a grammar file. `[agent]` refuses it,
  and `[mcp.<name>]` refuses it as an unknown key. A grammar is refused
  while the switch is off. The maintainer approved this frozen-surface
  addition.
- A record that selects `tool-grammars` is record version 25, so an
  older build refuses the box and does not misread it. `RECORD_VERSION`
  stays 21, because a record with the switch off has the same shape.
- Load each table through the existing grammar model. Each refusal now
  names a key path in `box.toml`, for example
  `tool.git.grammar.shell.push.usage`. Box no longer reads a grammar
  from a file. The test corpus loads its files inside the tests.
- Startup refuses a grammar over 64 KiB, measured as the table written
  out as TOML. It refuses a `program` that is not the name that its own
  `[tool]` command runs. It refuses two grammars with one `program` or
  one `name`.
- The engine owns the grammar set. The new opener
  `PolicyEngine::open_staged_file_with_grammars` installs the grammar
  schemas below every MCP schema that stages later, and through a
  reload. `PolicyEngine::grammar_bindings` gives out bindings for
  exactly those grammars, and `GrammarBindings` has no other public
  constructor. `GrammarBindings::declare_tool` declares a tool's program
  file and called name, and binds the grammar whose `program` is that
  name. So a grammar binds every `[tool]` that runs its program.
- `PolicyEngine::validate_with_grammars` and
  `PolicyEngine::check_with_grammars` validate against the same
  schemas, so the config-time check and `check_policy` agree with the
  run.
- The staged opener no longer holds a rule on a qualified namespace,
  such as `Tool::git`, for an MCP schema. No MCP schema can declare it,
  so the load refuses the rule.
- At startup, `run` prints one warning for each grammar: the Shell
  still decides a spawn as `shell:spawn`, so a rule on a grammar
  action does not fire yet.
- New public names in `strands-box-policy`: `ToolGrammar`,
  `ToolGrammars`, `ToolGrammarError`, `GrammarBindings`,
  `BindingRefusal`, and the methods above. The facade is 57 names with
  all features and 51 by default.

## Tests

- `tool_grammars.rs`: a box whose policy forbids
  `Tool::git::Action::"push"` starts with the grammar and the switch,
  writes record version 25, and prints the warning
  (`a_policy_naming_a_grammar_action_starts_with_its_grammar_and_the_switch`).
  The same policy with no grammar is refused at startup
  (`the_same_policy_without_the_grammar_is_refused_at_startup`). A
  grammar with the switch off is refused
  (`a_grammar_with_the_switch_off_is_refused_at_startup`). A box with
  the switch off and no grammar keeps record version 21
  (`a_box_with_the_switch_off_and_no_grammar_is_unchanged`).
- `tool_grammar_engine.rs` goes through the non-test opener: open and
  reload (`a_policy_that_names_a_grammar_action_opens_with_its_grammar`),
  the refusal with no grammar, the refusal of a rule held for an MCP
  schema (`a_grammar_action_rule_is_refused_rather_than_held_for_an_mcp_schema`),
  an MCP schema that stages over the grammar schema, validation, and
  the example on the configuration page
  (`the_grammar_and_the_rule_the_configuration_page_shows_load`).
- Refusals: `a_tool_grammar_needs_the_tool_grammars_switch`,
  `a_grammar_is_refused_on_the_agent`,
  `a_grammar_whose_program_is_not_its_tools_called_name_is_refused`,
  `two_grammars_for_one_program_are_refused`,
  `two_grammars_with_one_name_are_refused`,
  `a_grammar_over_the_size_limit_is_refused_at_its_table`,
  `a_refusal_names_the_key_path_under_the_tool`, and
  `a_record_that_selects_tool_grammars_carries_its_own_version`.
- Binding: `a_grammar_binds_every_declared_tool_that_runs_its_program`
  and `an_unreadable_tool_program_is_refused_when_declared`.
- `check_policy`: `a_check_reads_the_actions_of_each_tool_grammar`.
- The grammar corpus test keeps every file and expects the new key
  paths in each refusal.
- I removed each new guard, saw its test fail, and restored it.
- Gates on Linux aarch64: fmt, clippy with 0 owned warnings, the policy
  suite with and without features, `cargo doc` with `-D warnings`, and
  the box suite with all features.
  `box_shell::a_lua_busy_loop_does_not_starve_the_control_socket`
  failed under full-suite load and passed alone.
- Not run: macOS. No test pins the box-level call to `declare_tool`,
  because nothing reads the bindings until the Shell consumes them.
Resolve each crates/policy file to the main version. Port two box
tests to the merged API: a test that called the removed
ToolGrammars::is_empty now validates a policy against the grammar, and
a new ProcessSpec literal in run/commands.rs gets the grammar field.
…e-program refusal

The merged policy crate has no 64 KiB grammar limit, so the user guide
no longer states one. The guide now shows the exact text of the
refusal of two grammars for one program, and of two grammars with one
name. The unit tests compare the full text, and a run test checks that
startup refuses two grammars for one program and stores no record.
crates/box/AGENTS.md said that [agent] holds grammar. It does not, so
the field list keeps five fields and names grammar as a [tool] field
behind the switch. The README and the architecture page now state the
startup warning for each grammar.
A record with native-filesystem-policy on and tool-grammars off wrote a
tool-grammars key at version 22, 23, or 24. An older build refuses that
key, so the documented downgrade broke. The key is now written only
when the switch is on. A test pins that a version 22 record holds no
such key, and a test pins that [mcp.<name>] refuses a grammar table.
The policy pages now say that a tool grammar adds Tool:: actions.
…efuses a grammar record

A record version stops an older build from misreading a newer box. An
older build already refuses a record that holds a grammar table or the
tool-grammars key, because ProcessSpec and ExperimentalFeatures deny
unknown fields. So a box with tool-grammars on now writes the version
it would write without the switch. The test
a_grammar_record_is_refused_where_its_keys_are_unknown pins the
refusal. The docs no longer name version 25.
… action

## Problem

A box with `tool-grammars` on loads a rule on a `Tool::` action, but the
rule does not fire. The broker does not give the grammar bindings to the
Shell, so the Shell decides every spawn as `shell:spawn`. A `forbid` on
`Tool::git::Action::"push"` protects nothing, and `run` prints a warning
that says so. The stdio MCP start also uses `shell:spawn` only.

The bindings have more defects. They resolve each tool program a second
time, after the run already opened and checked it. They accept bindings
from any engine. And when a bound file goes away, a bare name falls
through `PATH` to another file, and that spawn goes back to
`shell:spawn`.

Three more gaps stay from loading tool grammars. An `[mcp.Tool]` server can
use the `Tool` namespace that every grammar action uses. `policy
generate-schema` writes no grammar action, so an operator cannot see the
names to write. And a rule that waits for an MCP schema and has a temporal
predicate on a grammar action group is held, then silently drops when that
schema stages, although no schema can make it fire.

## Solution

- `run` binds the grammars to the program file that `ConfiguredCommands`
  opened for each `[tool]`, and installs the bindings on the engine before
  the engine is shared. `PolicyEngine::bound_by` installs them, and it
  refuses bindings that another engine issued
  (`BindingRefusal::AnotherEngine`). `GrammarBindings::declare_tool` now
  takes the opened file, its canonical path, and the spelling it is called
  through.
- The Shell adapter reads the bindings from its engine. A bound spawn is
  decided only as its grammar action. The denial names that action, and
  the Shell telemetry records it. The telemetry category of a grammar
  action is `Tool::<name>`.
- A spawn that the bindings refuse enters history as a `shell:spawn`
  request, with no verdict to the observer, and its telemetry is an
  enforcement denial.
- A bare-name spawn of a bound name is refused when the file bound under
  that name is gone or replaced.
- The stdio MCP start goes through the Shell adapter, so a bound program
  is decided as its grammar action there too. The start records no
  `::response`, as before.
- The startup warning and its assertion are removed. ApprovedReach takes
  the commands that the run loaded.

- While `tool-grammars` is on, the loader refuses `[mcp.Tool]`.
- `policy generate-schema` composes the grammar actions of the config into
  `actions.cedarschema`, through the new `ToolGrammars::compose_action_schema`.
  `compose_action_schema` now calls it with no grammar.
- MCP staging treats `PolicyError::UnsupportedClause` as final, as the
  other inert-rule refusals are.
- New tests cover the validate paths that carry grammar schemas.
- `docs/design/policy.md` lists the group-predicate refusal with the load
  refusals.

## Tests

- `adapters::shell::tests::a_denied_grammar_action_names_the_action`,
  `a_refused_spawn_enters_history_as_a_shell_spawn_request`, and
  `bindings_from_another_engine_are_refused` pin the denial text, the
  history entry, and the engine check.
- `grammar::bindings::tests::a_bare_name_whose_bound_file_is_gone_is_refused_and_does_not_fall_through_the_search_path`
  and `a_tool_is_bound_to_the_file_it_was_opened_as_and_not_to_what_its_path_holds_now`
  pin the `PATH` fix and the identity reuse.
- `run::hosted::tests::binding_decides_a_declared_tool_as_its_grammar_action`
  and `binding_uses_the_file_the_run_opened_and_not_what_its_path_holds_later`
  pin the box binding step.
- `run::broker::host::tests::an_mcp_start_of_a_bound_program_is_decided_as_its_grammar_action`
  pins the MCP start.
- `tool_grammars.rs` adds end-to-end tests: a forbid denies `git push`, a
  permit runs `git status`, `unmodeled` is denied without a permit,
  `sh -c 'git push'` meets the same forbid, and with the switch off a
  spawn is `shell:spawn`.
- I removed the history call and the `PATH` check one at a time, and the
  tests for each failed. I restored them.
- I ran the policy tests with and without features, the telemetry tests,
  the box unit tests, and `mcp_schema_generation`, `policy_check`,
  `four_inputs`, `documented_inputs`, and `documented_commands`. Clippy
  shows no owned warning, and fmt is clean.
- Not run here: the end-to-end tests in `tool_grammars.rs`, and the box
  unit tests that start a real box. This host refuses them at the mount
  table check, and the same 67 box unit tests fail on the base commit.
  CI runs them on Linux and macOS.

- `record::config::tests::an_mcp_server_named_tool_is_refused_while_tool_grammars_is_on`
  pins the refusal and that the name is free with the switch off.
- `record::config::tests::a_grammar_given_as_a_path_is_refused` pins that
  a grammar is a table inside `box.toml` and never a file it names.
- `mcp_schema_generation.rs::generate_schema_writes_the_actions_of_each_tool_grammar`
  and `tool_grammar_engine.rs::the_composed_schema_holds_the_actions_of_each_grammar`
  pin the schema.
- `tool_grammar_engine.rs::a_temporal_predicate_on_a_grammar_group_is_refused_when_its_mcp_schema_stages`
  pins the staging refusal. Without the fix it stages as `Accepted`.
- I dropped the grammar schemas at each validate site, one at a time. Six
  sites had no test that failed. `each_mcp_schema_stages_over_the_grammar_schema_while_another_server_is_pending`,
  `a_rule_that_also_names_an_mcp_action_waits_for_its_schema_when_a_grammar_declares_its_tool_action`,
  and `a_staged_check_reads_the_grammar_schema_while_an_mcp_rule_waits`
  now fail at four of them. The other two are the complete checks at open
  and in the staged check. When either drops the schemas, its fallback
  path validates again with them and gets the same result, so no test can
  see the change.
…-enforce

# Conflicts:
#	crates/box/README.md
#	crates/box/src/command/run.rs
#	crates/box/src/record/config/grammar.rs
#	crates/box/src/record/config/mod.rs
#	crates/box/src/run/hosted.rs
#	crates/box/tests/tool_grammars.rs
#	docs/design/architecture.md
#	docs/user/config.md
@ferdingler ferdingler changed the title feat(shell): decide a spawn of a grammar-bound program as its grammar action feat(shell): connect the shell to tool grammars so grammar rules fire Nov 5, 2026
@ferdingler ferdingler changed the title feat(shell): connect the shell to tool grammars so grammar rules fire feat(shell): connect the shell to tool grammars Nov 5, 2026
@ferdingler
ferdingler marked this pull request as ready for review November 5, 2026 17:03
Comment thread crates/box/src/command/run.rs Resolved
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Comment

I reviewed head 7ee72a3; there were no earlier review threads. The binding and enforcement logic held up for every case I traced, and the policy lib suite passes locally (266). My two comments are both non-blocking: an approval record that doesn't match the new denial text, and a missing startup notice now that shell:spawn rules can quietly stop applying to a bound program.

Assumptions and rules checked that held
  • gone_under / coverage: a bare name with an intact bound file is parsed before the gone check; a replaced Homebrew link target is refused, as ConfiguredCommand::verify already does; a Debian /bin/sh → dash link is not counted as replaced.
  • [mcp.Tool] refusal: it covers stdio and remote entries, since both come from file.mcp. cedar_identifier maps no other name onto Tool, and with the flag off the name is unaffected.
  • A refused spawn still gets a decision record: ReachFloor records it as enforcement_deny on shell:spawn, matching the shell:spawn request that observe_refused puts in history.
  • MCP start through the interceptor: an unbound program is still decided as shell:spawn on the same reported path and credential reads. Dropping the permit records no ::response, the same as before this PR.
  • bound_by refuses bindings from another engine; every [tool] label has a ConfiguredCommand, and the file opened once is shared by binding and reach judging.
  • The policy crate's pub use set is unchanged at 57 names; the new methods and variant fall under the author's approval.

Wiring one opened file through both reach judging and grammar binding is a solid way to keep the two from disagreeing.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes

I reviewed head ee6c9e4. The denial text now stays policy denied this operation on '<program>', so it matches the description again. The one blocking issue is a new interaction from sending MCP starts through grammar coverage: an [mcp] server that shares a multi-call file with a grammar-bound [tool] gets a refusal that no policy can override.

Review Categories
  • Correctness: Operator-declared [mcp] programs aren't declared in the bindings, so the undeclared-name refusal, meant for names the agent calls, also fires on an operator's own server start (inline).
  • Premises/docs: The root and crates/box AGENTS.md still say shell:spawn alone permits an MCP start (inline).
  • Scope: About 1,300 changed lines. The binding, MCP-start, and telemetry pieces could be reviewed as separate PRs next time.
Assumptions and rules checked that held
  • Flag off: grammar_coverage returns None on empty bindings, so the shell and MCP starts still decide shell:spawn, with the same from_policy telemetry.
  • bound_by issuer check: an engine accepts bindings from itself and its observed_by wrapper, and refuses bindings from another engine.
  • Bindings use the file that ConfiguredCommands opened, the same identity the boundary verifies, so there is no race between resolving and binding.
  • gone_under: a replaced bound file is refused for a bare name, a matching pair is parsed first, and the rest-of-session refusal is documented.
  • [mcp.Tool] refusal: it covers stdio and http entries, since both come from file.mcp. tool and Tool. stay distinct Cedar namespaces, and the name is accepted again with the flag off.
  • Telemetry: action_category splits on ::Action:: and gives alpha and Tool::git, and the ReachFloor action override keeps the same string format for shell:spawn.
  • A refused spawn enters history as a shell:spawn ::request and reports no verdict, which matches docs/user/shell.md.
  • The policy crate's pub use set is unchanged at 57 names. policy generate-schema includes the grammar actions, and the flag gate holds at parse time.

Wiring the gate to the opened program file closes the TOCTOU window cleanly.

… disclose each program a grammar decides, per review
…-enforce

# Conflicts:
#	docs/user/mcp.md
#	docs/user/policy/actions.md
#	docs/user/shell.md
@ferdingler

Copy link
Copy Markdown
Collaborator Author

Replies to the two reviews:

  • An [mcp] server that shares a file with a grammar-bound [tool] (blocking). Fixed in 2bc94bf. Box now declares the program of each stdio [mcp.<name>] in the grammar bindings, the same way as each [tool]. So the operator's own server start is not refused as an undeclared name. an_mcp_server_that_shares_a_bound_file_is_declared_under_its_own_name fails without the fix. When the server program has the same name as the program of a grammar, that grammar decides the start, and the startup disclosure names the server.
  • AGENTS.md (root and crates/box) says that shell:spawn alone permits an MCP start. I did not change these files. Only the maintainer can ask for a change to them, so I left this for Fernando.
  • The approval record does not match the new denial text (review on 7ee72a3). ee6c9e4 removed that change. The denial text of a grammar action is the same as on main again, so the record and the text agree.
  • Scope. Noted. I will split the next PR in this area into smaller parts.

Comment thread crates/box/src/run/hosted.rs Resolved
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes

I reviewed head 2bc94bf against ee6c9e4. The startup disclosure is done. The fix for MCP starts does let operator-declared servers start, but it also turns off the undeclared-name refusal for the agent's own spawns of those names (inline on hosted.rs).

Checked at this head that held
  • The MCP declare loop resolves on spec.search_path(), the same search path the boundary uses (boundary.rs:322,374), and the spelling called_name(spec) matches what coverage derives from server.program().
  • declare_tool fails only on metadata(), so declaring an MCP program adds no new startup refusal, for example for hard links.
  • The disclosure is correct for each case I traced: a grammar tool, a same-name tool at another path, a same-name [mcp], a shared mise file under another name (not listed), and the flag off (no lines).
  • The relevant unit tests pass locally, 19 of them, including the two new ones and an_mcp_start_of_a_bound_program_is_decided_as_its_grammar_action.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes

I reviewed head 0739101. It is a merge of main into 2bc94bf, and the PR's own changes are the same as at 2bc94bf. The only conflict was docs/user/mcp.md, and it was resolved correctly. The one blocking issue is inline: an [mcp] program's name is now declared for the agent's Shell spawns as well, so a spawn of a bound file under that name falls back to shell:spawn.

Checked at this head that held
  • Merge with feat: add opt-in whole-argument wildcards for stdio MCP commands #317 (argument wildcards): authorize_mcp_start passes the effective launch arguments to grammar coverage, and builds the reported command from the runtime wildcard values. So a grammar decides on what actually runs.
  • main added no path that decides Request::ShellSpawn directly and so skips grammar coverage.
  • The MCP declare loop resolves on spec.search_path(), the same search path as the boundary. declare_tool fails only on metadata(), so declaring a server adds no new startup refusal.
  • Startup disclosure: correct for a grammar tool, a same-name tool or [mcp], a shared file under another name (not listed), and the flag off (nothing printed).
  • 20 relevant strands-box lib tests pass locally on the merged head, including the two new ones and argument_wildcards_are_only_a_stdio_mcp_setting.
  • I left the root and crates/box AGENTS.md wording to the maintainer, as you asked.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Approve

At 3d1fedc, 0e80d7c fixes the blocking issue: an [mcp] program name now counts as declared only for that server's own start. The new merge of main (#306, runtime option variables) doesn't touch grammar or MCP-start code.

Checked and held
  • An agent spawn under an MCP-only name on a bound file is still refused. Only Starter::Server reads servers, and every agent handle builds with Starter::Agent.
  • An MCP start under its own name is decided by shell:spawn. A start whose name matches a grammar's program is decided by that grammar. A start on a replaced file is refused, so it fails closed.
  • into_server_start_handle has one production caller, authorize_mcp_start. The uncontained start still passes the bare program, so it stays out of grammar coverage, as before.
  • Tests: the three new tests, the 63 matching strands-box-policy grammar and shell-adapter tests, and the startup disclosure test all pass locally.
  • Non-blocking: docs/design/decisions.md:1117 still says "a name that no [tool] declares" and doesn't mention the server-start exemption. You left this for the maintainer, and docs/user/shell.md covers it.

The fix is scoped well, and it tests both the agent side and the server side.

kevin-orellana
kevin-orellana previously approved these changes Nov 6, 2026
…-enforce

# Conflicts:
#	crates/box/src/run/broker/host.rs
Comment thread crates/box/src/run/hosted.rs Resolved
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Assessment: Comment

048c321 is a merge of main (10 commits). Its one conflict, authorize_mcp_start, was resolved by keeping the PR's interceptor path. That path still enforces #297's committed request token, so the merge is correct. One interaction with #332 (hard-linked commands) needs a decision. See the inline comment.

Checked and held
  • Conflict resolution: ShellPolicyInterceptor sends the MCP start through PolicyEngine::admit, which turns an Allow with no request id into internal_fault. A grammar action with no id gets no PendingGrammarResponse and is denied. Both paths fail closed, as main's "permitted MCP start has no committed request token" check did.
  • Apart from that file, the merged tree matches an automatic merge of 3d1fedc and e39544d.
  • From the last round: agent spawns of a name that only an [mcp] declares are still refused, and only authorize_mcp_start builds a Starter::Server handle.
  • Tests: strands-box-policy grammar and shell-adapter tests and the MCP-start tests passed locally at 3d1fedc. The merge leaves PR code unchanged apart from the conflict.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Assessment: Comment

dcc8c9d fixes the [tool] case from the last round: a grammar on a command whose file has several names is now refused at startup, and the refusal is documented in config.md. The same file can still be bound through a stdio [mcp] program. See the inline comment, which includes a reproduction.

Checked and held
  • programs holds the called name of each tool that has a grammar. A [tool] without a grammar whose command has the same called name, for example a second git table, is also checked. That is correct, because declare_tool binds it to the grammar too.
  • A tool whose called name no grammar uses keeps its several-name command (make, perl), so nothing that loaded before this change is refused.
  • A link count that changes after load is still caught by ConfiguredCommand::verify, which requires the startup link count.
  • a_grammar_is_refused_on_a_command_with_several_names passes locally. The /usr/bin/git test is macOS-only.

Comment thread crates/box/src/run/hosted.rs Resolved
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

Assessment: Approve

dc5f8ad adds the same several-names refusal to the stdio [mcp] loop, so it now covers every way a grammar binds a file. The [mcp.repo] test reproduces the case from the last round and passes locally. I found no new defects.

Checked and held
  • An [mcp] program that resolves to a file with several names, under a called name a grammar uses, is refused at startup and the error names [mcp.<label>]. This is the case I reproduced earlier (git hard-linked as make).
  • An [mcp] program with one name, or one whose called name no grammar uses (npx, uvx), binds as before. Configs that loaded before this change are unaffected.
  • The link count comes from fstat on the opened file (opened.metadata()), so the path cannot be swapped between the check and the binding.
  • The grammar tests in strands-box pass (20/20). The clippy failures in strands-shell were already there and are not in this diff.

Comment thread docs/user/config.md Resolved
@ferdingler
ferdingler merged commit cd61396 into main Nov 6, 2026
34 of 37 checks passed
@ferdingler
ferdingler deleted the feature/tool-grammars-enforce branch November 6, 2026 15:19
@github-actions github-actions Bot mentioned this pull request Nov 6, 2026
7 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants