Skip to content

fix: load knowledge memories without enabling automation - #590

Merged
pedronauck merged 1 commit into
mainfrom
fix/issue-586-knowledge-memories
Sep 10, 2026
Merged

pedronauck merged 1 commit into
mainfrom
fix/issue-586-knowledge-memories

Conversation

@pedronauck

@pedronauck pedronauck commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

Problem and root cause

Closes #586.

With the shipped memory.enabled = false default, opening Command Palette → Knowledge requests GET /api/memory?profile=default&scope=workspace&workspace_id=... and receives HTTP 500, including for an empty workspace.

Tracing the palette's useMemories → memoriesListOptions → listMemories → BaseHandlers.ListMemory → scoped Store.CatalogHeaders exposed a boot dependency error: the daemon created state.memoryStore only when automatic memory was enabled. Disabled-memory boot migrated the catalog and either retained it privately for compaction or closed it. Public HTTP/UDS handlers therefore received a nil store and returned memory.internal. The existing boot feature-flag suite reproduced the failure in both memory-off combinations before the fix; memory-on combinations passed. The issue does not include the reporter's configuration, so this identifies a reproduced shipped-default cause rather than claiming inspection of their machine.

The list query also inherited TanStack Query's automatic retry behavior, multiplying the failing request, while the adapter displayed a technical status message.

Resulting behavior and implementation

  • Retain the already-created catalog as memoryCatalogStore for operator API/CLI access regardless of automatic-memory enablement. Reuse it for compaction, publish it with the daemon generation, and close it once through the existing shutdown/failed-boot ownership paths.
  • Keep the automation-bound memoryStore and its existing enablement checks intact. Listing Knowledge does not opt the user into prompt injection, extraction, background dreaming, or native agent memory writes.
  • Preserve existing scope resolution, durable workspace identity, profile binding, filtering, pagination, and catalog-read error handling. Existing documents load; an empty workspace returns the normal counted empty page. Invalid storage still returns 500, with HTTP redaction and UDS diagnostics preserved.
  • Disable automatic list retries in the shared query factory. Server failures remain KnowledgeApiError with their original status and a readable message; an explicit refetch can recover normally.
  • Update the official memory reference, public memory documentation, and MS-001 regression walk.

Validation

  • Before-fix reproduction: TestBootInjectsComposedAssemblerForFeatureFlagCombinations failed in the two memory-off cases because the public memory store was absent. After the fix, all four combinations pass with -race, preserving the existing prompt inclusion/exclusion assertions.

  • CGO_ENABLED=1 go test -race ./internal/api/core -run '^TestMemoryHandlersAndHelpers$' -count=1 — passed; includes existing workspace/profile isolation coverage.

  • CGO_ENABLED=1 go test -race -tags integration ./internal/daemon -run '^TestDaemonE2EKnowledgeWithoutMemoryAutomation$' -count=1 — passed. Real CLI-started daemons, real SQLite, unique temporary homes/workspaces/ports/sockets, HTTP and UDS requests, populated/empty/invalid-storage cases, source-byte preservation, and harness-owned process teardown. Both memory automation and compaction are disabled in these cases.

  • bunx turbo run test --filter=./web -- src/systems/knowledge/hooks/__tests__/use-knowledge.test.tsx src/systems/knowledge/adapters/__tests__/knowledge-api.test.ts — 37 tests passed. The retry regression uses an actual QueryClient with three retries configured globally and proves one failed list attempt followed by successful explicit recovery.

  • bunx turbo run build --filter=./web — passed, including the dependent web typecheck and codegen check.

  • Final diff reviewed; git diff --check passed. The integration test passes the test-convention helper; that helper reports existing violations in untouched portions of the older daemon_test.go file.

  • env -u COMPOZY_INTERNAL_RESTART_OPERATION_ID make gate — passed: Go lint (0 issues), race-enabled daemon/skills suites, web lint (0 warnings/errors), typecheck, and all 7,118 web tests across 771 files. Gate evidence is recorded under .cache/gate/.

  • Published-head CI: CI run 34497282148 passed for 9526f110aaa57d5059a8990b6197ce30b147d55c, including Go race shards, static/build/platform checks, frontend lint/typecheck/tests/build, runtime E2E, desktop E2E, and all four web E2E shards. React Doctor and Vercel also passed; CodeRabbit approved and Greptile reported no actionable findings.

Local daemon tests remove the inherited COMPOZY_INTERNAL_RESTART_OPERATION_ID only from their own process environment. No active host daemon was restarted or modified.

Cross-surface and compatibility impact

Audit owner: this PR, following docs/_memory/change-impact.md.

  • Native tools: no IDs, schemas, capabilities, risk flags, or registry descriptors change. Native agent memory dependencies remain tied to the existing automatic-memory enablement; the repaired dependency is the operator HTTP/UDS/CLI store.
  • Extensibility/hooks/config: no new config or default changes. Provider registration, extension memory dependencies, extraction, dreaming, and prompt assembly retain their existing opt-in gates. Pressure compaction reuses the retained catalog under its existing independent switch.
  • Workspace/profile isolation: the API still resolves the requested workspace before binding the store and uses the existing per-profile owner. No query keys, selector semantics, storage paths, or authorization checks change. The catalog returns the existing durable workspace ULID, distinct from the registration ws_... reference accepted on ingress.
  • User state: no schema changes, migration changes, resets, file deletion, or new compatibility shim. Existing Markdown and database data remain intact.
  • Public/internal compatibility: HTTP/UDS routes and response DTOs remain unchanged; failed-storage responses remain errors. The private checkpoint-store field is renamed with every consumer updated. The official skill and site docs explain listing availability without opting into automation.
  • Web/QA: the shared Knowledge query affects the Command Palette and Knowledge window; MS-001 documents the three outcomes and recovery/isolation checks.

Limits

Local execution was on macOS. No local Linux or Electron run, live ACP-provider validation, or manual browser walkthrough is claimed. Required PR CI is the delivery gate for the published head. The successful web build emitted existing warnings for ::highlight rules in unchanged session-search CSS, large chunks, and plugin timings; this change does not suppress them. The full web test suite also emits React act(...) and timer warnings from unchanged tests; scoped Knowledge tests pass without those warnings.

@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
compozy-site Ready Ready Preview Sep 10, 2026 3:44pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: cbe85ee1-f127-473b-8c86-c8c9d204fa4b

📥 Commits

Reviewing files that changed from the base of the PR and between e76cb83 and 9526f11.

⛔ Files ignored due to path filters (3)
  • docs/qa/scenarios/MS-001.md is excluded by !**/*.md
  • packages/site/content/docs/memory/index.mdx is excluded by !**/*.mdx
  • skills/compozy/references/memory.md is excluded by !**/*.md
📒 Files selected for processing (13)
  • internal/daemon/boot.go
  • internal/daemon/boot_checkpoint.go
  • internal/daemon/boot_memory_catalog.go
  • internal/daemon/boot_publish.go
  • internal/daemon/daemon_memory_e2e_integration_test.go
  • internal/daemon/daemon_runtime_state.go
  • internal/daemon/daemon_shutdown_resources.go
  • internal/daemon/daemon_test.go
  • internal/daemon/runtime_dependencies.go
  • web/src/systems/knowledge/adapters/__tests__/knowledge-api.test.ts
  • web/src/systems/knowledge/adapters/knowledge-api.ts
  • web/src/systems/knowledge/hooks/__tests__/use-knowledge.test.tsx
  • web/src/systems/knowledge/lib/query-options.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


Walkthrough

The daemon now keeps the memory catalog available when memory automation is disabled. Runtime dependencies and shutdown use the catalog store. The web client reports server failures with a user-facing message and disables automatic retries.

Changes

Workspace memory catalog availability

Layer / File(s) Summary
Memory catalog boot lifecycle
internal/daemon/boot.go, internal/daemon/boot_memory_catalog.go
The boot state names the store memoryCatalogStore. Boot reuses an existing memory store or creates and opens a catalog store independently of session compaction.
Catalog runtime wiring and shutdown
internal/daemon/boot_checkpoint.go, internal/daemon/daemon_runtime_state.go, internal/daemon/boot_publish.go, internal/daemon/runtime_dependencies.go, internal/daemon/daemon_shutdown_resources.go
The catalog store flows through checkpoint fallback, runtime publication, public dependencies, and shutdown cleanup.
Daemon catalog validation
internal/daemon/daemon_memory_e2e_integration_test.go, internal/daemon/daemon_test.go
Tests verify existing and empty catalogs, inaccessible sources, HTTP and UDS responses, workspace identity, and source-file preservation without memory automation.
Web memory error and retry handling
web/src/systems/knowledge/adapters/knowledge-api.ts, web/src/systems/knowledge/adapters/__tests__/knowledge-api.test.ts, web/src/systems/knowledge/lib/query-options.ts, web/src/systems/knowledge/hooks/__tests__/use-knowledge.test.tsx
Server errors use a user-facing message. Memory queries disable automatic retries. Tests verify error exposure and explicit retry recovery.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 9526f

Knowledge memories can load without automatic memory automation, with empty states and user-friendly server errors while avoiding automatic retries. The change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 13 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: loading Knowledge memories without enabling automatic memory automation.
Linked Issues check ✅ Passed The changes address issue #586. The daemon exposes the memory catalog independently of automation, the API can load existing and empty workspace catalogs, unavailable storage returns an error, and the…
Out of Scope Changes check ✅ Passed The reviewed changes are related to issue #586. They update daemon memory catalog handling, Knowledge API error behavior, query retry behavior, and regression tests. No unrelated code changes are evid…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-586-knowledge-memories

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 9526f11.

@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR separates operator access to the durable memory catalog from automatic memory processing.

  • Retains and publishes the catalog store even when memory.enabled and session compaction are disabled.
  • Reuses the retained catalog for checkpoint compaction while preserving automation-specific gates.
  • Aligns catalog ownership with failed-boot cleanup and daemon-generation shutdown.
  • Disables automatic Knowledge-list retries, improves 5xx presentation, and adds focused unit and integration coverage.
  • Updates operator documentation and the MS-001 regression procedure.

Confidence Score: 5/5

The PR appears safe to merge, with catalog availability, automation gating, scope binding, retry behavior, and lifecycle ownership aligned.

No actionable failure remains: the retained catalog follows daemon generation ownership, scoped requests preserve their existing binding, automation-only services stay gated, and explicit frontend recovery remains available after retries are disabled.

Important Files Changed

Filename Overview
internal/daemon/boot_memory_catalog.go Retains an opened catalog store for operator access in every memory-automation configuration.
internal/daemon/runtime_dependencies.go Supplies the retained catalog to shared HTTP and UDS handlers without enabling automation-specific services.
internal/daemon/daemon_shutdown_resources.go Consolidates catalog closure under the published memory-catalog lifecycle handle.
internal/daemon/boot_checkpoint.go Reuses the retained catalog for checkpoint coverage when the automatic memory store is absent.
internal/daemon/daemon_memory_e2e_integration_test.go Covers populated, empty, and inaccessible catalogs over HTTP and UDS with automation disabled.
web/src/systems/knowledge/lib/query-options.ts Disables automatic retries specifically for the paginated Knowledge list query.
web/src/systems/knowledge/adapters/knowledge-api.ts Preserves typed list failures while presenting a readable generic message for server errors.
docs/qa/scenarios/MS-001.md Documents disabled-automation listing, error recovery, source preservation, and scope-isolation regression checks.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  C[Knowledge UI / API / CLI] --> H[HTTP or UDS memory handlers]
  H --> K[Retained memoryCatalogStore]
  K --> D[(Catalog database)]
  K --> F[Profile and workspace memory files]
  E{memory.enabled} -->|true| A[Automatic memory runtime]
  E -->|false| X[No prompt injection, extraction, or dreaming]
  A --> K
  S{session.compaction.enabled} -->|true| P[Checkpoint summary runtime]
  P --> K
  B[Daemon boot] --> K
  K --> Q[Published runtime generation]
  Q --> Z[Single shutdown ownership]
Loading

Reviews (1): Last reviewed commit: "fix: load knowledge memories without ena..." | Re-trigger Greptile

@pedronauck
pedronauck merged commit 53aa246 into main Sep 10, 2026
49 checks passed
@pedronauck
pedronauck deleted the fix/issue-586-knowledge-memories branch September 10, 2026 16:07
This was referenced Sep 27, 2026

This branch was successfully deployed

1 active deployment
Preview — 9526f110 Deployed Sep 10, 2026 by vercel[bot]
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.

Command Palette Knowledge fails with 500 when fetching workspace memories

1 participant