Skip to content

fix(gateway): include export name in hook transform cache key#13855

Merged
mbelinky merged 1 commit intoopenclaw:mainfrom
mcaxtr:fix/10152-hook-transform-cache-key
Feb 20, 2026
Merged

fix(gateway): include export name in hook transform cache key#13855
mbelinky merged 1 commit intoopenclaw:mainfrom
mcaxtr:fix/10152-hook-transform-cache-key

Conversation

@mcaxtr
Copy link
Contributor

@mcaxtr mcaxtr commented Feb 11, 2026

Summary

Fixes #10152

loadTransform() cached hook transform functions using only modulePath as the key. When two hook mappings referenced different named exports from the same module file, the first loaded export was silently reused for all subsequent lookups — the exportName was ignored during cache hits.

Fix: Use a composite cache key ${modulePath}::${exportName ?? "default"} so each distinct export is cached independently.

Test plan

  • Add test: two mappings reference same module with different named exports (transformA / transformB)
  • Before fix: test fails — both mappings return transformA's result ("from-A")
  • After fix: test passes — each mapping returns its own export's result
  • All 10 tests fail before, pass after
  • pnpm build && pnpm check passes

Greptile Overview

Greptile Summary

This PR fixes a correctness issue in the gateway hook transform loader cache: previously, loadTransform() cached by modulePath only, causing different named exports from the same module to incorrectly reuse the first-loaded transform function.

The change updates the cache key to include both modulePath and exportName (with a stable default sentinel), and adds a regression test that creates a module with multiple exports (transformA / transformB) and verifies each hook mapping resolves and executes the correct export.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Change is narrowly scoped to the transform cache key and is covered by a targeted regression test that reproduces the prior bug (two named exports from the same module). No behavior changes outside the intended caching semantics were observed in the reviewed code.
  • No files require special attention

@openclaw-barnacle openclaw-barnacle bot added the gateway Gateway runtime label Feb 11, 2026
@mcaxtr
Copy link
Contributor Author

mcaxtr commented Feb 11, 2026

@greptile please re-review this PR.

@mcaxtr mcaxtr force-pushed the fix/10152-hook-transform-cache-key branch from fa0dcff to 3977213 Compare February 12, 2026 04:12
@mcaxtr mcaxtr force-pushed the fix/10152-hook-transform-cache-key branch from 3977213 to 578fd67 Compare February 13, 2026 02:13
@mcaxtr mcaxtr force-pushed the fix/10152-hook-transform-cache-key branch from 578fd67 to 68c1121 Compare February 13, 2026 14:32
@mcaxtr mcaxtr force-pushed the fix/10152-hook-transform-cache-key branch 9 times, most recently from 9894b92 to 8397247 Compare February 15, 2026 14:21
@mcaxtr mcaxtr force-pushed the fix/10152-hook-transform-cache-key branch 3 times, most recently from daf6aef to 4a15fde Compare February 19, 2026 02:04
@mbelinky mbelinky force-pushed the fix/10152-hook-transform-cache-key branch from 4a15fde to a9eea91 Compare February 20, 2026 17:44
@mbelinky mbelinky merged commit c8ee33c into openclaw:main Feb 20, 2026
13 checks passed
@mbelinky
Copy link
Contributor

Merged via squash.

Thanks @mcaxtr!

rodrigogs pushed a commit to rodrigogs/openclaw that referenced this pull request Feb 20, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
Hansen1018 added a commit to Hansen1018/openclaw that referenced this pull request Feb 21, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
vincentkoc pushed a commit that referenced this pull request Feb 21, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
dgarson pushed a commit to dgarson/clawdbot that referenced this pull request Feb 21, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
mmyyfirstb pushed a commit to mmyyfirstb/openclaw that referenced this pull request Feb 21, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
obviyus pushed a commit to guirguispierre/openclaw that referenced this pull request Feb 22, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…aw#13855)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: a9eea91
Co-authored-by: mcaxtr <7562095+mcaxtr@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Hook transform cache key ignores export name, causing cross-mapping policy confusion

2 participants