Skip to content

fix(memory): defer startup until model profiles settle - #3839

Merged
Yeachan-Heo merged 2 commits into
Yeachan-Heo:devfrom
probepark:fix/memory-startup-profile-race
Aug 5, 2026
Merged

fix(memory): defer startup until model profiles settle#3839
Yeachan-Heo merged 2 commits into
Yeachan-Heo:devfrom
probepark:fix/memory-startup-profile-race

Conversation

@probepark

Copy link
Copy Markdown
Contributor

Summary

  • defer memory backend startup when the root CLI has a startup model profile to apply
  • start the backend only after synchronous or deferred profile activation settles
  • keep direct SDK callers on the existing immediate-start behavior
  • make the deferred starter idempotent and add focused regression coverage

Closes #3838.

Root cause

createAgentSession() started local-memory consolidation while the session still held its bootstrap catalog fallback. Root CLI profile activation happened only after session creation, so the stage-one extractor could capture retired claude-3-5-sonnet-20240620 before the effective profile model was installed.

Verification

  • bun test test/sdk-memory-startup.test.ts test/memories-runtime.test.ts test/cli-args-mpreset.test.ts — 59 pass, 0 fail
  • bun run check:types
  • bunx biome check --write src/sdk/session.ts src/main.ts test/sdk-memory-startup.test.ts
  • git diff --check

probepark and others added 2 commits August 5, 2026 13:46
The defers-memory-startup test creates a full agent session, which can
exceed bun's default 5s per-test timeout on cold CI runners even though
the session creation is not faulty. Raise the explicit timeout to 30s so
the test asserts the deferral behavior without flaking on slow CI.

Lore-id: 8ca3d1f2
Confidence: high
Scope-risk: low
Reversibility: revert-commit
Tested: bun test packages/coding-agent/test/sdk-memory-startup.test.ts (passes)
Not-tested: full CI re-run
@Yeachan-Heo
Yeachan-Heo merged commit 4098986 into Yeachan-Heo:dev Aug 5, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants