Repository navigation
Conversation
…eration The session-memory hook accepts a per-hook `model` config field (used to route the small slug-generation call to a cheaper model than the agent's primary). The handler resolved `hookConfig` via `resolveHookConfig()` but never forwarded `hookConfig.model` to `generateSlugViaLLM`, which unconditionally called `resolveDefaultModelForAgent()`. Result: the override was silently ignored and the agent's default model was always used. Add a small pure helper `resolveSlugGeneratorModelRef` that prefers the hook-level override when present and parseable (full `provider/model` or bare model with the agent's default provider), and falls back to the agent default for undefined, empty, whitespace, or unparseable inputs. Wire it through `generateSlugViaLLM` via a new optional `modelOverride` parameter, and have the session-memory handler pass `hookConfig.model` through. Closes openclaw#89551 [AI-assisted]
|
Codex review: needs real behavior proof before merge. Reviewed June 2, 2026, 1:55 PM ET / 17:55 UTC. Summary PR surface: Source +44, Tests +80. Total +124 across 3 files. Reproducibility: yes. from source: current main reads the session-memory hook config but never forwards Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Resolve the session-memory override through the canonical alias-aware model-selection API, add handler-level forwarding coverage, document and validate the new hook model contract, then require redacted terminal or live output proving the actual hook path. Do we have a high-confidence way to reproduce the issue? Yes from source: current main reads the session-memory hook config but never forwards Is this the best way to solve the issue? No: the proposed fix is plausible for literal provider/model strings, but it is not the best OpenClaw-shaped fix because it bypasses the existing alias-aware model-selection contract and leaves the new config surface undocumented and unchecked. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 1d3cfc4b0168. Label changesLabel justifications:
Evidence reviewedPR surface: Source +44, Tests +80. Total +124 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing this — ClawSweeper flagged real correctness/compat risks I don't want to ship: the new |
Summary
hooks.internal.entries["session-memory"].modelwas silently ignored; slug generation always used the agent's default model.generateSlugViaLLM.src/hooks/llm-slug-generator.ts(+ helper + new optionalmodelOverrideparam),src/hooks/bundled/session-memory/handler.ts(forwardshookConfig.model),src/hooks/llm-slug-generator.test.ts(regression tests).HookConfigSchemaalready.passthrough()), no other hooks touched, no behavior change when the override is absent or unparseable, no agent-level model resolution paths modified.Motivation
Users who set a cheaper / faster model on the session-memory hook (e.g. to keep
/resetslug generation off their primary coding model) expect that override to be used. Today the hook config is read but themodelfield is silently dropped, so the slug call still spends primary-model tokens. This is a behavior bug filed in #89551 and is trivially reproducible with a hook config.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
hooks.internal.entries["session-memory"].model.upstream/mainf789081bae123099e5a057ca43d8be35e35c6c48, macOS, Nodev22.15.0. Repro drives the realresolveDefaultModelForAgentandresolveSlugGeneratorModelRefsource modules viatsx— no mocks, no stubbed providers.agents.defaults.model.primary = "openai/gpt-5.5"andhooks.internal.entries["session-memory"].model = "anthropic/claude-3-5-haiku".node_modules/.bin/tsx repro-89551.mjs(driver imports source.tsby absolute path)./resetend-to-end against a real model provider; mocked plugin load warnings (pi-ai/oauth) in the repro environment are unrelated to the change.Root Cause (if applicable)
generateSlugViaLLMinsrc/hooks/llm-slug-generator.tsunconditionally calledresolveDefaultModelForAgent({ cfg, agentId }), and the session-memory handler readresolveHookConfig(cfg, "session-memory")but never extracted or forwardedhookConfig.modelto the slug generator.provider/modelis sent torunEmbeddedAgentwhen a hook-level model override is present.HookConfigSchemais.passthrough(), so the override silently parsed and survived asunknownwithout ever being consumed.Regression Test Plan (if applicable)
src/hooks/llm-slug-generator.test.ts.modeloverride is honored end-to-end intorunEmbeddedAgent'sprovider/model; absent / empty / whitespace / unparseable overrides fall back to the agent default.it.eachover the override values exhaustively pins behavior without needing a real provider.User-visible / Behavior Changes
hooks.internal.entries["session-memory"].modelis set (and parseable), session-memory slug generation now uses that model. When unset, empty, or unparseable, behavior is unchanged (agent default).Diagram (if applicable)
Security Impact (required)
Repro + Verification
Environment
v22.15.0, pnpm (repo-pinned)agents.defaults.model.primary,hooks.internal.entries["session-memory"].{enabled,llmSlug,model}Steps
git fetch upstream && git checkout fix/session-memory-hook-model-overridenode_modules/.bin/vitest run src/hooks/llm-slug-generator.test.ts src/hooks/bundled/session-memory/handler.test.ts→ 35 passedpnpm exec oxfmt --check src/hooks/llm-slug-generator.ts src/hooks/llm-slug-generator.test.ts src/hooks/bundled/session-memory/handler.ts→ cleannode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --pretty false --incremental→ 0 errorsopenai/gpt-5.5), AFTER → ✅ (slug-gen picksanthropic/claude-3-5-haiku).