Skip to content

fix(gateway): stabilize webchat prompt cache affinity - #89740

Merged
vincentkoc merged 1 commit into
mainfrom
fix-webchat-prompt-cache-key
Jun 3, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix-webchat-prompt-cache-key

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • add stable, hashed WebChat prompt-cache affinity for session-bound chat.send turns
  • keep per-message run/idempotency ids unchanged so UI lifecycle and duplicate-send handling stay intact
  • thread promptCacheKey through reply options into embedded run params

Fixes #89139

Verification

  • node scripts/run-vitest.mjs run src/auto-reply/reply/agent-runner-utils.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json
  • ./node_modules/.bin/oxlint src/auto-reply/get-reply-options.types.ts src/auto-reply/reply/agent-runner-run-params.ts src/auto-reply/reply/agent-runner-utils.ts src/auto-reply/reply/agent-runner-execution.ts src/gateway/server-methods/chat.ts src/auto-reply/reply/agent-runner-utils.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> clean
  • Testbox check:changed: tbx_01kt65qsshgv996fk1xp3w11w5, Actions run 26869912406, exit 0

@vincentkoc vincentkoc self-assigned this Jun 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Jun 3, 2026
@clawsweeper

clawsweeper Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(gateway): stabilize webchat prompt cache affinity This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof for head 78c277d922b006d3f775aabce9786eb376992923.

What changed:

  • WebChat chat.send keeps unique per-message run/idempotency ids.
  • WebChat now supplies a stable hashed promptCacheKey per provider/model/agent/session scope, so provider prompt-cache affinity survives sequential messages in the same Control UI session.
  • promptCacheKey is threaded through reply options into embedded run params; the provider-visible key is opaque and does not include raw session ids or session keys.

Proof run:

  • node scripts/run-vitest.mjs run src/auto-reply/reply/agent-runner-utils.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts -> passed, 2 shards / 44 tests
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json -> passed
  • ./node_modules/.bin/oxlint src/auto-reply/get-reply-options.types.ts src/auto-reply/reply/agent-runner-run-params.ts src/auto-reply/reply/agent-runner-utils.ts src/auto-reply/reply/agent-runner-execution.ts src/gateway/server-methods/chat.ts src/auto-reply/reply/agent-runner-utils.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts -> passed
  • git diff --check -> passed
  • Testbox check:changed: tbx_01kt65qsshgv996fk1xp3w11w5, Actions run 26869912406, exit 0
  • final autoreview: .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main -> autoreview clean: no accepted/actionable findings reported
  • PR CI is green: 132 success, 30 skipped, 1 neutral

@vincentkoc
vincentkoc merged commit 175cfe4 into main Jun 3, 2026
188 of 192 checks passed
@vincentkoc
vincentkoc deleted the fix-webchat-prompt-cache-key branch June 3, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webchat creates new agent run per message, destroying prompt cache (93% → 29% hit rate)

1 participant