Skip to content

perf: cache pre-tool metadata resolution#25

Merged
lan17 merged 4 commits intomainfrom
codex/cache-tool-resolution
May 6, 2026
Merged

perf: cache pre-tool metadata resolution#25
lan17 merged 4 commits intomainfrom
codex/cache-tool-resolution

Conversation

@lan17
Copy link
Copy Markdown
Contributor

@lan17 lan17 commented May 6, 2026

Summary

  • Cache resolved Agent Control step catalogs briefly per agent/session/config so repeated before_tool_call hooks avoid recreating the OpenClaw tool list.
  • Use OpenClaw's injected runtime session-store helpers when available, warm the default session store during gateway startup, and extend successful session metadata caching.
  • Add behavioral coverage for catalog caching, session resolver warmup, runtime-backed lookup, and concurrent lookup dedupe.

Root Cause

The slow resolve_steps phase was dominated by createOpenClawCodingTools(...), which rebuilds the full OpenClaw tool surface on each tool call. The slow build_context phase was likely repeated session-store resolution/loading from the pre-tool hook path.

Validation

  • npm run lint
  • npm run typecheck
  • npm test
  • npm run coverage

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

❌ Patch coverage is 80.67227% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tool-catalog.ts 67.50% 10 Missing and 3 partials ⚠️
src/session-store.ts 84.84% 5 Missing and 5 partials ⚠️

📢 Thoughts on this report? Let us know!

@lan17 lan17 changed the title [codex] Cache pre-tool metadata resolution perf: cache pre-tool metadata resolution May 6, 2026
@lan17 lan17 marked this pull request as ready for review May 6, 2026 06:09
@lan17 lan17 changed the title perf: cache pre-tool metadata resolution fix: cache pre-tool metadata resolution May 6, 2026
@lan17 lan17 changed the title fix: cache pre-tool metadata resolution fix:(perf) cache pre-tool metadata resolution May 6, 2026
@lan17 lan17 changed the title fix:(perf) cache pre-tool metadata resolution fix(perf):cache pre-tool metadata resolution May 6, 2026
@lan17 lan17 changed the title fix(perf):cache pre-tool metadata resolution perf: cache pre-tool metadata resolution May 6, 2026
@lan17 lan17 merged commit 6818d1e into main May 6, 2026
3 checks passed
@lan17 lan17 deleted the codex/cache-tool-resolution branch May 6, 2026 08:44
galileo-automation pushed a commit that referenced this pull request May 6, 2026
## [1.8.2](v1.8.1...v1.8.2) (2026-05-06)

### Performance Improvements

* cache pre-tool metadata resolution ([#25](#25)) ([6818d1e](6818d1e))
@galileo-automation
Copy link
Copy Markdown

🎉 This PR is included in version 1.8.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants