perf(hooks): resolve tool-hook agents from session metadata by rubimpassos · Pull Request #3 · rubimpassos/oh-my-openagent · GitHub
Skip to content

perf(hooks): resolve tool-hook agents from session metadata - #3

Merged
rubimpassos merged 1 commit into
mainfrom
fix/tool-hook-agent-metadata
Oct 14, 2026
Merged

rubimpassos merged 1 commit into
mainfrom
fix/tool-hook-agent-metadata

Conversation

@rubimpassos

Copy link
Copy Markdown
Owner

Problem

After #2 the sidebar no longer hydrates session history, but bursts of Prompt.Base64 validation remained at every tool step of a session with image attachments (CPU up to ~220%, API stalls up to 8 s on the VPS). A JSC ScriptProfiler capture of a turn start (5,160 regex samples) attributed:

Change

readCurrentSessionAgent asks the V2 facade's session.currentAgent (from #2). Both lookups use it first and keep the existing history path when the capability is absent or the metadata is missing. A compaction agent from metadata resolves to no agent, as in the history lookup.

Verification

  • New regression tests red before (3 failing), green after; history reads throw in the tests.
  • Hooks/shared/sidebar/V2 suites: no new failures against origin/main (the same 38 pre-existing failures in this combined run on both).
  • Typecheck and build green.

Atlas (tool.execute.before and .after) and prometheus-md-only read the
whole session history on every tool call just to learn the agent's name.
On OpenCode 2 each read decodes every stored attachment and validates it
against Prompt.Base64; a JS profile of a turn in a session with four
1.3 MB images put two thirds of the regex time in these lookups.

They now ask for the session's current agent first and fall back to the
history lookup only when the client lacks the capability or the metadata
is missing.

Fork-Patch: v2-support
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

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