Repository navigation
feat!: replace tool visibility flags with a single exposure option - #347
Merged
Merged
Conversation
Fold `agent_use`, `preserve` and the new code-only behavior into
`Tool.exposure` ("auto" | "direct" | "code" | "command"). `deferred`
stays separate since it controls loading, not where a tool is callable.
`exposure="code"` tools are callable only from `run_code` in code mode:
they are never offered to the model directly, are dropped outside code
mode, and are not described by `tool_describe`.
BREAKING CHANGE: `agent_use=` and `preserve=` are removed from `Tool`,
`Tool.from_callable` and `@tool`; use `exposure="command"` and
`exposure="direct"` instead. `Tool.code_use` is removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bub | aac27d6 | Commit Preview URL Branch Preview URL |
Oct 09 2026, 08:57 AM |
frostming
added a commit
to bubbuild/bub-contrib
that referenced
this pull request
Oct 9, 2026
bub replaced `preserve=` and `agent_use=` with a single `exposure` option (bubbuild/bub#347). Switch bub-acp-server client tools to `exposure="direct"` and bub-qq ops commands to `exposure="command"`, and bump the locked bub revision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Tools had three overlapping boolean flags controlling where they can be called from (
agent_use,preserve, and a newly needed "code mode only" behavior). Their combinations were partly invalid and hard to reason about, so they are folded into one option:exposure"auto"(default)run_code"direct"tools.*"code"tool_describedoes not describe itrun_code"command"deferredstays a separate flag: it controls when a definition is loaded, not where the tool is callable.exposure="code"tools are never offered to the model directly: they are dropped outside code mode (including whenrun_codeis not allowed), excluded from<deferred_tools>andtool_describe, and treated as unknown by thebefore_tool_callrecovery fallback. User comma commands can still invoke them. An unknownexposurevalue raisesValueError.agent_use=andpreserve=are removed fromTool,Tool.from_callableand@tool, andTool.code_useis removed. Plugins must switch toexposure="command"/exposure="direct". bub-contrib (bub-acp-server,bub-qq) is updated in a follow-up PR once this merges, since it tracks bubmain.Impacted modules
src/bub/tools.py:ToolExposure,Tool.exposuresrc/bub/builtin/agent.py,builtin/tools.py,builtin/hook_impl.py,builtin/spill.py,builtin/codemode/__init__.pybuild/tools.mdx,concepts/tape-and-context.mdx(en + zh-cn)Verification
uv run ruff check .uv run mypy srcuv run pytest -q— 604 passed, 1 skippedtests/test_tool_loading.pycovercodetools being hidden outside code mode, exposed to code in code mode, and not described bytool_describe.bub-acp-serverandbub-qqtests pass against this branch with the follow-up edits (343 passed).🤖 Generated with Claude Code