Skip to content

The Memories page's Pinned and Conflicted filters cover the whole namespace - #1137

Open
dilipna wants to merge 1 commit into
ClickHouse:mainfrom
dilipna:fix/memories-status-filters
Open

dilipna wants to merge 1 commit into
ClickHouse:mainfrom
dilipna:fix/memories-status-filters

Conversation

@dilipna

@dilipna dilipna commented Nov 22, 2026

Copy link
Copy Markdown

Related: #719

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in a release)

Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):

On the Memories page, Pinned and Conflicted now cover the whole namespace: Pinned is filtered on the server (memory.list takes pinned_only), and Conflicted reads every conflicted row by key, so a pinned or conflicted memory older than the newest 1,000 rows is listed and counted.

Why

Pinned, Conflicted and Verified read the newest 1,000 rows and kept the matching ones in the browser. In a namespace with more than 1,000 live memories, a pinned or conflicted memory older than those rows was not listed, and the count only covered the matches among them (#719), against the dashboard design guide's rule that a filter covers what the server holds or says what it covers.

The store already had a pinned filter (pinned_only on list_by_namespace and count_by_namespace); memory.list did not expose it. For Conflicted, the page already read the conflicted keys with conflicts.list (keys_only) for the cards' chips, so it now reads those rows by key with memory.bulk_get instead of filtering the newest rows.

This PR does not close #719: Verified is unchanged, pending the question in the issue (#719 (comment)). It can follow here or in a second PR, whichever you prefer.

Scope and risk

  • server/memory/api/models_crud.py: MemoryListInput.pinned_only (default off, MCP_HIDDEN like contains and tags_every).
  • server/memory/app/query.py: pinned_only reaches the recency read, both counts (total and today), the hidden-under-prefix count, and the score path (sort_by="score"), and it is part of the count cache key so a filtered count is not served from an unfiltered entry. The per-type quota trim in _list_by_score moved into _within_quotas unchanged, because the extra filter took that function over the function-length gate's 50 statements.
  • frontend/src/views/memoryListReads.ts: Pinned sends pinned_only. Conflicted reads the keys with conflicts.list and the rows with memory.bulk_get in batches of 1,000 (memory_keys caps a call at 1,000). The memory.list read before it asks for one row, so the 8 s poll still stops at an unchanged namespace_version. Agent and tag filters stay on the page for Conflicted, over the complete set.
  • frontend/src/views/Recent.tsx: the count uses the server's total for a Pinned read the server filtered, as it does for a tag or agent filter. The note under the toolbar says "the newest matches" for a cut-short Pinned read, and "the memories of the newest 5,000 conflicted keys" when the keys read reach conflicted_keys' cap of 5,000. Verified keeps the old note.
  • Unchanged: the store, ClickHouse statements, the conflict chips' read, the inspector, auth and tenant isolation. No migration.

On the 5,000-key cap: I first paged conflicted_keys with the before_version keyset that list_conflicted uses, and dropped it. Memory versions are time.time_ns() values (about 1.7e18), above 2^53, so a cursor read back by the dashboard as a JSON number is rounded to a multiple of 256 (JSON.parse("1763500000123456789") is 1763500000123456800). With version < cursor, a cursor rounded up repeats the page's last key, and one rounded down skips any key whose version falls in the gap. The issue offered the note as the other option, so this PR takes it. The same rounding applies to the review queue's row cursor (listConflicts, next_before_version), which I have not changed or tested here; I can open a separate issue if useful.

Compatibility, rollout and rollback

  • Wire: memory.list adds pinned_only (bool, default false, hidden from the MCP listing). Nothing changed or removed.
  • Rolling upgrade: a replica a release behind names pinned_only in ignored_args and lists every row; the page then keeps the pinned rows among the newest it read and counts them itself, as before. Conflicted uses only existing ops and fields.
  • Operator steps: none.
  • Rollback: a revert restores the old filters. Nothing is stored.

Tests

Head 84651b178, on Linux (Python 3.12, Node 22.13), ClickHouse latest started with the CI config mounts (dev/ci_start_clickhouse.sh's volumes), server from source with the integration job's environment.

  • make format-check (shfmt v3.10.0, as CI pins), make lint, make typecheck: exit 0. The generators (sdk_py_gen, sdk_py_client_gen, sdk_ts_gen, docs_reference, op_reach_census) with --check: current.
  • npm --prefix frontend run test: exit 0, 317 files, 3715 tests passed. (A run started beside the integration server timed out 55 tests across unrelated components; alone, every test passes.) npm --prefix frontend run build and npm --prefix frontend run budget: exit 0.
  • New dashboard tests in Recent.lists.test.tsx: Pinned sends pinned_only and counts from the server's total; a server that names pinned_only in ignored_args keeps the pinned rows among those read; Conflicted lists a key that is not among the newest rows with 1,500 conflicted keys, read as two memory.bulk_get batches (1,000 and 500); 5,000 keys show the cap note. Two existing tests that picked Pinned against a mock returning unfiltered rows now pick Verified, the status they describe (kept among the rows read).
  • pytest tests/integration/test_memory_delete_list.py against the server: exit 0, 12 passed. The new test_list_pinned_only_reaches_past_the_rows_read fails on a server built from main (memory.list ignores pinned_only and returns the three newest rows) and passed 5 runs in a row on this branch. Its pinned row is written first under a key that sorts last, because the list orders by created_at in whole seconds and then by key.
  • Unit tests in the 73 files under tests/unit that name memory.list, MemoryListInput, the score path, quotas or MCP_HIDDEN, plus test_public_copy.py and test_mcp_listing_budget.py: exit 0, 3281 passed, 20 skipped (on the base before the last rebase, which applied without conflicts).

Not run locally: the full unit suite and the full integration suite (left to CI, as AGENTS.md says), Playwright e2e, Postgres memory authority.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. I read the paths it changed, checked the design against the issue and the existing ops, and ran every gate listed above myself.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

…espace

Pinned, Conflicted and Verified read the newest 1,000 rows and kept the matching ones, so in a larger namespace an older pinned or conflicted memory was missing and the count was wrong. memory.list takes pinned_only (hidden from the MCP listing), passed to the recency and score reads, both counts and the count cache key. Conflicted reads the conflicted keys and their rows with memory.bulk_get, 1,000 keys at a time, and says when the keys read reach the 5,000-key cap. Verified is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: dilipna <163414135+dilipna@users.noreply.github.com>
@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
loom-docs Ready Ready Preview Nov 22, 2026 3:21am UTC

Request Review

@zlareb1 zlareb1 self-assigned this Nov 22, 2026

@zlareb1 zlareb1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One reproduced identity regression remains in the Conflicted filter. The 25 submitted list tests and 120 MCP listing tests pass; a same-key, two-agent regression fails on this head and passes with the prior list implementation.

return {
entries,
truncated: keys.length >= CONFLICT_KEYS_CAP,
total: entries.length,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — Preserve the identity of the conflicted row. conflicts.list(keys_only=true) returns only keys, while wildcard memory.bulk_get chooses the newest row per key (reads.py uses LIMIT 1 BY memory_key). If agent A has an older conflicted shared-key and agent B has a newer active shared-key, selecting Conflicted drops A and displays B as conflicted. A component regression with those two list entries, conflict keys ["shared-key"], and the bulk answer for B fails here and passes with the prior implementation. Read the conflict rows by their ids or full identities so another agent cannot replace the row being listed; cover this case in a regression test.

This branch has not been deployed

No deployments
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.

The Memories page's Pinned, Conflicted and Verified filters miss rows older than the newest 1,000

2 participants