Skip to content

W2-T08: lru_cache get_tool_output_limits to skip per-call config parse - #10

Merged
blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T08
May 14, 2026
Merged

blaketyndall-eng merged 1 commit into
pr-25159from
post-audit-sprint/W2-T08

Conversation

@blaketyndall-eng

Copy link
Copy Markdown
Owner

Audit W2-T08 (P2 #15). @functools.lru_cache(maxsize=1) on get_tool_output_limits so terminal-tool's hot output path doesn't re-parse ~/.hermes/config.yaml on every call. Adds _invalidate_tool_output_limits_cache() for tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@blaketyndall-eng
blaketyndall-eng merged commit 06a3c42 into pr-25159 May 14, 2026
3 checks passed
@blaketyndall-eng
blaketyndall-eng deleted the post-audit-sprint/W2-T08 branch May 14, 2026 16:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0242881b0b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

return iv


@functools.lru_cache(maxsize=1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Invalidate limits cache when config changes

With this zero-argument lru_cache, the first terminal/read_file call in a long-lived CLI, gateway, or dashboard-backed process freezes tool_output limits until process restart. hermes_cli.config.load_config() already caches by config-path mtime/size, so it would pick up edits or saves through /api/config/save_config; wrapping it here prevents that mtime check from running again, making documented config changes to tool_output.max_bytes/max_lines ineffective for the rest of the session.

Useful? React with 👍 / 👎.

@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant