Skip to content

fix(session-memory): honor configured slug model - #97007

Merged
steipete merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/session-memory-slug-model-89551
Jul 11, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/session-memory-slug-model-89551

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #89551

What Problem This Solves

Fixes an issue where users enabling LLM-generated session-memory slugs could not select a dedicated slug model: hooks.internal.entries.session-memory.model was accepted but ignored, so /new and /reset always used the agent's primary model.

Why This Change Was Made

The session-memory hook now forwards its optional model override to the embedded runner. The runner remains the single owner of configured aliases, bare model IDs, provider-qualified refs, and agent-default fallback; no duplicate model-selection path is kept in the hook.

The bundled hook guide and public hooks documentation describe the supported model forms. No config migration, provider behavior, session format, or timestamp fallback changes.

User Impact

Users can set hooks.internal.entries.session-memory.model to a configured alias such as sonnet, a bare model ID on the agent's default provider, or a provider/model ref. When omitted, slug generation still uses the agent's default model; failures still fall back to timestamp filenames.

Evidence

  • Sanitized AWS Crabbox on original contributor head 9967f3e7603084782a47d28023912e51ce4a1991: focused hook tests, 46/46 passed (run_536260e8afbc).
  • Blacksmith Testbox on patch-identical pre-rebase head 95d6a56b554f12d327b59cc2fd915376f6072f7b: focused hook tests, 44/44 passed (tbx_01kx7r7y05qk69r36br5zd561n; run 29140268648).
  • Fresh branch autoreview on final exact head ed5b80b4ee06f5fccc84737c0bbfa072e2065343: no accepted/actionable findings, confidence 0.96.
  • Targeted oxfmt --check on all six changed files and git diff --check: passed.
  • Patch-identical pre-rebase hosted CI run 29140246624: 46 successful jobs, zero failures, including both QA Smoke profiles, docs, lint, production/test types, build artifacts, contracts, and all selected test shards. The repository prepare wrapper accepted this as recent-rebase evidence for final head ed5b80b4ee06f5fccc84737c0bbfa072e2065343.

No authenticated live provider call was run; routing is covered at the handler-to-embedded-runner boundary, while the runner's existing model-selection contract owns the provider call.

@clawsweeper

clawsweeper Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 1:02 AM ET / 05:02 UTC.

Summary
The PR activates the session-memory hook’s existing model setting by forwarding it to the embedded runner, removes duplicate default-model resolution, and updates focused tests and documentation.

PR surface: Source -3, Tests -7, Docs +3. Total -7 across 6 files.

Reproducibility: yes. from source: current main reads the session-memory hook configuration but drops its model before slug generation; this review did not run the live failing provider path.

Review metrics: 1 noteworthy metric.

  • Config behavior activated: 1 existing setting changed from ignored to effective. The setting can redirect slug-generation traffic to another configured model or provider after upgrade.

Stored data model
Persistent data-model change detected: serialized state: src/hooks/bundled/session-memory/handler.ts, unknown-data-model-change: src/hooks/bundled/session-memory/HOOK.md, vector/embedding metadata: src/hooks/llm-slug-generator.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #89551
Summary: This PR is the active candidate fix for the canonical ignored-model bug; previous competing implementations are closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦞 diamond lobster
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Attach redacted current-head live output or logs showing a real session-memory reset select a non-default slug model and produce the expected memory filename or timestamp fallback.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The current PR body explicitly says no authenticated live provider call was run. Add redacted current-head logs or terminal output from a real /new or /reset, removing IP addresses, keys, phone numbers, private endpoints, and other sensitive details; update the PR body to trigger review, and ask a maintainer to comment @clawsweeper re-review if needed.

Risk before merge

  • [P1] A previously ignored accepted setting becomes runtime-effective and can route slug generation to another model or provider; source and tests support the behavior, but the revised head has no real provider-observed proof.

Maintainer options:

  1. Require current-head live proof (recommended)
    Capture redacted output or logs from a real /new or /reset using a distinct configured slug model before merge.
  2. Explicitly accept contract proof
    A maintainer may own the remaining routing uncertainty by overriding the real-behavior proof gate.

Next step before merge

  • [P1] The patch has no actionable code defect; the maintainer must require live proof or explicitly override that proof gate.

Maintainer decision needed

  • Question: Should this PR wait for a real current-head /new or /reset run using a non-default slug model, or should the existing shared-resolver contract tests be accepted as an explicit proof override?
  • Rationale: The implementation is correct by source and focused contract coverage, but repository policy requires after-fix real behavior proof for external non-docs PRs and the PR explicitly states no authenticated provider call was run.
  • Likely owner: steipete — He is the current assignee and authored the latest implementation revision, making him the clearest owner for the proof-gate decision.
  • Options:
    • Require live routing proof (recommended): Keep the PR blocked until redacted logs or terminal output show the current head selecting the configured slug model in a real session-memory run.
    • Override the proof gate: Accept the handler seam tests plus existing embedded-runner E2E and model-selection tests as sufficient for this narrowly delegated routing change.

Security
Cleared: The diff adds no dependency, workflow, permission, secret-handling, downloaded-code, package-resolution, or other supply-chain surface.

Review details

Best possible solution:

Keep the embedded runner as the single model-resolution owner and merge after redacted current-head runtime evidence confirms a non-default slug model is selected, or after an explicit maintainer proof override.

Do we have a high-confidence way to reproduce the issue?

Yes from source: current main reads the session-memory hook configuration but drops its model before slug generation; this review did not run the live failing provider path.

Is this the best way to solve the issue?

Yes. Forwarding the raw optional model into the established embedded-runner resolver is the narrowest maintainable fix and avoids a parallel hook-specific routing implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c47ceb0f3dcc.

Label changes

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded bug fix for optional session-memory slug model routing.
  • merge-risk: 🚨 compatibility: An accepted but previously ignored setting begins changing runtime behavior after upgrade.
  • merge-risk: 🚨 auth-provider: The model string can redirect the embedded slug call to another configured alias, model, or provider.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦞 diamond lobster. Replaced prior rating: 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The current PR body explicitly says no authenticated live provider call was run. Add redacted current-head logs or terminal output from a real /new or /reset, removing IP addresses, keys, phone numbers, private endpoints, and other sensitive details; update the PR body to trigger review, and ask a maintainer to comment @clawsweeper re-review if needed.
Evidence reviewed

PR surface:

Source -3, Tests -7, Docs +3. Total -7 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 2 5 8 -3
Tests 2 21 28 -7
Docs 2 9 6 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 35 42 -7

What I checked:

  • Current bug path: On current main, the session-memory handler reads the hook configuration but calls the slug generator without forwarding model, while the slug generator always resolves the agent default itself. (src/hooks/bundled/session-memory/handler.ts:209, c47ceb0f3dcc)
  • Patch owner boundary: The current head forwards only the optional raw hook model and removes the hook-local default resolver, leaving provider, alias, bare-ID, and fallback resolution to runEmbeddedAgent. (src/hooks/llm-slug-generator.ts:73, 95d6a56b554f)
  • Shared resolver contract: The embedded runner normalizes optional model input, resolves configured aliases and provider-qualified references through the shared resolver, uses the agent default provider for bare IDs, and uses the configured agent model when omitted. (src/agents/embedded-agent-runner/run.ts:587, c47ceb0f3dcc)
  • Existing contract tests: Current tests cover omitted model defaults, provider-qualified model-only inputs, and configured alias resolution; the PR adds hook handoff assertions without duplicating resolution logic. (src/agents/embedded-agent-runner.e2e.test.ts:365, c47ceb0f3dcc)
  • Config contract: Internal hook entries intentionally allow handler-specific keys and preserve unknown fields, so model is an accepted existing hook setting rather than a new schema surface. (src/config/zod-schema.hooks.ts:80, c47ceb0f3dcc)
  • Current-head provenance: The current implementation revision is commit 95d6a56b554f12d327b59cc2fd915376f6072f7b, authored by Peter Steinberger on July 11, 2026 after the previous review head. (src/hooks/llm-slug-generator.ts:73, 95d6a56b554f)

Likely related people:

  • steipete: He is the current assignee, authored the latest implementation revision, and has the strongest sampled contribution history across the affected hook and runner files. (role: recent branch reviser and likely decision owner; confidence: high; commits: 95d6a56b554f; files: src/hooks/llm-slug-generator.ts, src/hooks/bundled/session-memory/handler.ts, src/agents/embedded-agent-runner/run.ts)
  • qingminlong: Current-main blame attributes the existing slug generator, session-memory handler, and embedded model resolver lines to this commit author. (role: current-main implementation provenance; confidence: medium; commits: eccd4f02f84e; files: src/hooks/llm-slug-generator.ts, src/hooks/bundled/session-memory/handler.ts, src/agents/embedded-agent-runner/run.ts)
  • cpojer: Repository shortlog shows substantial prior contribution across the central slug-generator, session-memory, and embedded-runner files. (role: recent area contributor; confidence: low; files: src/hooks/llm-slug-generator.ts, src/hooks/bundled/session-memory/handler.ts, src/agents/embedded-agent-runner/run.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-06-26T09:40:04.639Z sha 89b4a414bf936b7990fb428ac02c24e3ba29c8c5 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-07T13:09:16.679Z sha 9967f3e7603084782a47d28023912e51ce4a1991 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-07T18:18:48.018Z sha 9967f3e7603084782a47d28023912e51ce4a1991 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T03:55:16.262Z sha 8ae536be74b9faed964847fc499fc7baaf4f5f1c :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 26, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jun 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 7, 2026
@steipete steipete self-assigned this Jul 11, 2026
@steipete
steipete force-pushed the fix/session-memory-slug-model-89551 branch from 9967f3e to 8ae536b Compare July 11, 2026 03:39
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 11, 2026
@steipete steipete changed the title fix(session-memory): forward hook config model to LLM slug generator fix(session-memory): honor configured slug model Jul 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
@steipete
steipete force-pushed the fix/session-memory-slug-model-89551 branch from 8ae536b to 95d6a56 Compare July 11, 2026 04:50
@steipete

steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Land-ready at final exact head ed5b80b4ee06f5fccc84737c0bbfa072e2065343.

Maintainer cleanup centralized model selection in the embedded runner, compacted the regression coverage, corrected alias semantics, and added the public hook documentation. The final diff is 35 additions and 42 deletions across six files.

Proof:

  • Sanitized AWS Crabbox original-head run run_536260e8afbc: 46 focused tests passed.
  • Blacksmith Testbox lease tbx_01kx7r7y05qk69r36br5zd561n on patch-identical pre-rebase head: pnpm test src/hooks/llm-slug-generator.test.ts src/hooks/bundled/session-memory/handler.test.ts — 44/44 passed (run).
  • Fresh autoreview on final exact head ed5b80b4ee06f5fccc84737c0bbfa072e2065343: no accepted/actionable findings, confidence 0.96.
  • Targeted oxfmt --check and git diff --check: passed.
  • Patch-identical pre-rebase hosted CI: 46 successful jobs, zero failures.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 97007: hosted exact-or-recent-rebase gates passed; final local and remote heads match.

Proof gap: no authenticated live provider call was run. The changed routing boundary is directly covered by the handler and slug-generator tests; the unchanged embedded runner owns provider/model resolution.

Thanks @SunnyShu0925 for the contribution.

SunnyShu0925 and others added 2 commits July 11, 2026 06:03
…ator

When llmSlug is enabled with a model override in the session-memory hook
config, that model was ignored — slug generation always resolved the
agent default model via resolveDefaultModelForAgent.

Add an optional model parameter to generateSlugViaLLM and pass
hookConfig.model from the session-memory handler. When a hook model is
provided, only the model is forwarded (provider is omitted) so
runEmbeddedAgent's built-in resolveInitialEmbeddedRunModel chain handles
alias, provider-qualified ref, and bare-name resolution through a single
source of truth — avoiding the routing drift that blocked prior PRs.

Fixes openclaw#89551

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Honor the session-memory slug model override while keeping default, alias, and provider-qualified model selection in the embedded runner.

Co-authored-by: SunnyShu <[email protected]>
@steipete
steipete force-pushed the fix/session-memory-slug-model-89551 branch from 95d6a56 to ed5b80b Compare July 11, 2026 05:03
@steipete
steipete merged commit a6bdc80 into openclaw:main Jul 11, 2026
102 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 11, 2026
* [AI] fix(session-memory): forward hook config model to LLM slug generator

When llmSlug is enabled with a model override in the session-memory hook
config, that model was ignored — slug generation always resolved the
agent default model via resolveDefaultModelForAgent.

Add an optional model parameter to generateSlugViaLLM and pass
hookConfig.model from the session-memory handler. When a hook model is
provided, only the model is forwarded (provider is omitted) so
runEmbeddedAgent's built-in resolveInitialEmbeddedRunModel chain handles
alias, provider-qualified ref, and bare-name resolution through a single
source of truth — avoiding the routing drift that blocked prior PRs.

Fixes openclaw#89551

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* fix(session-memory): centralize slug model resolution

Honor the session-memory slug model override while keeping default, alias, and provider-qualified model selection in the embedded runner.

Co-authored-by: SunnyShu <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: session-memory hook model config ignored for LLM slug generation

2 participants