fix: refresh /tools availability when the session model changes#54184
Conversation
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
Vulnerabilities1. 🔵 Client-triggerable request amplification: tools.effective fetch not debounced/cancelled across changing request keys
DescriptionThe UI can repeatedly trigger Key points:
Vulnerable logic: if (state.toolsEffectiveLoading && state.toolsEffectiveLoadingKey === requestKey) {
return;
}
state.toolsEffectiveLoading = true;
state.toolsEffectiveLoadingKey = requestKey;
...
await state.client.request("tools.effective", { agentId, sessionKey });RecommendationAdd client-side request coalescing and/or debouncing for Example approach (debounce + abort): let toolsEffectiveAbort: AbortController | null = null;
let toolsEffectiveTimer: number | null = null;
export function scheduleToolsEffectiveRefresh(state: AgentsState, params: {agentId: string; sessionKey: string}) {
if (toolsEffectiveTimer) window.clearTimeout(toolsEffectiveTimer);
toolsEffectiveTimer = window.setTimeout(() => {
toolsEffectiveAbort?.abort();
toolsEffectiveAbort = new AbortController();
void loadToolsEffective(state, params, { signal: toolsEffectiveAbort.signal });
}, 250);
}Additionally:
Analyzed PR: #54184 at commit Last updated on: 2026-03-25T02:57:08Z |
Greptile SummaryThis PR fixes a UI-side cache invalidation bug where the Tools panel's "Available Right Now" inventory could go stale after switching the session model, because the effective-tools request key only incorporated Key changes:
Confidence Score: 5/5
Reviews (1): Last reviewed commit: "fix: refresh available tools when the se..." | Re-trigger Greptile |
…nto add-json-schema-to-cli * 'add-json-schema-to-cli' of github.com:kvokka/openclaw: (58 commits) test: make vitest config tests platform-aware fix: refresh available tools when the session model changes (openclaw#54184) fix: prefer freshest transcript session owners test: disable Vitest fs cache on Windows fix: prefer deterministic transcript session keys fix: prefer deterministic session usage targets fix: prefer deterministic session id resume targets feat: add /tools runtime availability view (openclaw#54088) fix: enforce sandbox visibility for session_status ids fix: drop spawned visibility list caps fix: verify exact spawned session visibility fix: enforce spawned session visibility in key resolve fix: resolve exact session ids without fuzzy limits Discord: resolve /think autocomplete from session model (openclaw#49176) chore(agents): normalize pi embedded runner imports feat(gateway): make openai compatibility agent-first test(parallel): force unit-fast batch planning test(browser): stabilize default browser detection mocks fix: prefer current parents in session rows fix: prefer current subagent owners in session rows ...
Summary
Describe the problem and fix in 2–5 bullets:
tools.effectiveresults byagentId + sessionKey, so a model change in the same session could reuse stale runtime tool availability./toolsand the "Available Right Now" panel could show the wrong inventory after switching models.agentId + sessionKey + effective model, and the runtime model-switch paths reuse a shared refresh helper for the visible Tools panel.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause / Regression History (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.agentId + sessionKey, buttools.effectiveis also a function of the session's effective model.git blame, prior PR, issue, or refactor if known): this follows the runtime-effective/toolswork that moved the UI off catalog guesses and ontotools.effective.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should have caught this. Otherwise write
N/A.ui/src/ui/views/chat.test.ts,ui/src/ui/app-chat.test.ts,ui/src/ui/controllers/agents.test.tstools.effectiverequest and produce a model-aware cache key for the sameagentId + sessionKey.User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
openai/gpt-5toopenai/gpt-5-mini/modelSteps
/model.tools.effectiveresult or reloads.Expected
Actual
agentId + sessionKeyresult and could skip reloading after a model switch.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
/model, and effective-tools request-key behavior.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
ui/src/ui/controllers/agents.ts,ui/src/ui/app-render.ts,ui/src/ui/app-render.helpers.ts,ui/src/ui/app-chat.ts,ui/src/ui/app.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.