fix(tools): skip denied optional media factories#76773
fix(tools): skip denied optional media factories#76773steipete merged 2 commits intoopenclaw:mainfrom
Conversation
|
@codex review |
|
Codex review: needs maintainer review before merge. Summary Reproducibility: yes. Current main passes allowlists into optional factory planning but leaves denylists to the later policy pipeline, so a denied optional media/PDF tool can still be constructed before filtering. Next step before merge Security Review detailsBest possible solution: Land the narrow denylist-aware planning change after CI, while keeping broader factory memoization and no-tools semantics in the existing related work. Do we have a high-confidence way to reproduce the issue? Yes. Current main passes allowlists into optional factory planning but leaves denylists to the later policy pipeline, so a denied optional media/PDF tool can still be constructed before filtering. Is this the best way to solve the issue? Yes. The PR reuses the existing policy matcher semantics, forwards the same explicit policy inputs earlier, and avoids taking on the broader memoization design. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 7f6798094ce9. |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
a7a9b4f to
0e43d97
Compare
|
Landed via rebase onto
Thanks @dorukardahan! |
|
Thanks for landing it and for the clean rebase. i checked the landed commits. The main behavior i wanted is still there: optional media and pdf factories stay skipped when not allowed, but explicit allowed tools still work. The extra gate looks good to me. |
Summary
Why
I hit this on my VPS while investigating gateway latency. A cron and agent turn spent about 5.1 s in
openclaw-tools:pdf-toolduringcore-plugin-toolsprep, even though the tool was not needed for that run.Current
mainalready avoids optional media and PDF factories when an explicit allowlist cannot expose them. This PR adds the matching denylist side, so tools that will be filtered out later are not built on the hot path.This is intentionally narrower than #73039 and complementary to #76728. It does not memoize factory output.
Helps #76606 and #76500.
Tests
pnpm test src/agents/openclaw-tools.media-factory-plan.test.ts src/agents/pi-tools.create-openclaw-coding-tools.test.tspnpm exec oxfmt --check --threads=1 CHANGELOG.md src/agents/openclaw-tools.ts src/agents/pi-tools.ts src/agents/tool-policy.ts src/agents/openclaw-tools.media-factory-plan.test.ts src/agents/pi-tools.create-openclaw-coding-tools.test.tsgit diff --checkpnpm tsgo:core:testpnpm check:changedReal-world validation
On my OpenClaw VPS, adding an explicit tools allowlist for the cron-heavy agent removed the unwanted
pdf-toolprep path. After hot reload, an 8 minute observation window had no new prep stages, nopdf-toolprep logs, and no Slack disconnect or DNS error logs.AI-assisted
Yes. I used Codex, reviewed the diff, and ran the tests above.