Skip to content

The request ledger identifies unchanged memory polls - #1487

Merged
zlareb1 merged 1 commit into
ClickHouse:mainfrom
ningsiyuan1024:feat/memory-get-poll-ledger
Nov 26, 2026
Merged

zlareb1 merged 1 commit into
ClickHouse:mainfrom
ningsiyuan1024:feat/memory-get-poll-ledger

Conversation

@ningsiyuan1024

@ningsiyuan1024 ningsiyuan1024 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Related: #1149

Changelog category

Improvement

Changelog entry

The request ledger records whether a conditional memory.get matched the revision its caller already held.

Why

A get and an unchanged poll can name the same memory id and version on two requests in a run. The existing event recorded the id and version for both. Recording the handler's unchanged result lets a reader identify the poll without looking up the current memory.

Scope and risk

The flag describes an exact get. Fields selected by a caller and MCP response trimming still govern the content it receives. Search receipts and client-reported reliance remain separate work under the linked issue.

Compatibility, rollout and rollback

The event's existing args map gains out_unchanged as a string when the handler reported a boolean. Earlier rows lack the key and have unknown poll status. Operators can deploy or revert the change without a migration or backfill.

Tests

python -m pytest -q tests/unit/test_ledger_invariants.py -k get_ledger_distinguishes checks two revisions of one memory in a run, an unchanged poll, a metadata projection and a miss. On the base commit it fails on the missing ledger field. The ledger, event projection, MCP response and documentation selections passed (315 tests).

With a private HTTP server and ClickHouse, set a memory, read it under a run, update it, read it again and poll with if_version equal to the updated version. The three persisted request ids were distinct. The first row retained the original revision. The other two named the updated revision with out_unchanged set to false and true respectively.

AI assistance in the code

AI-generated. I designed and reviewed the change. OpenAI Codex implemented the patch.

Checklist

  • The run documentation describes the event field and its interpretation.
  • The change requires no generated files, migration, plugin update or frontend build.
  • Commit signed off.

Note

Low Risk
Observability-only addition to ledger argument projection with no migration; older rows simply omit the new field.

Overview
The request ledger now records out_unchanged on memory.get rows when the handler returns a boolean unchanged, so analysts can tell an if_version poll that matched the caller’s revision (true) from a normal read or metadata-only response (false) even when out_memory_id and out_version are identical. Older rows without the field are documented as having unknown poll status.

Run documentation in runs.md was updated to describe out_memory_id, out_version, and out_unchanged together and to clarify that these fields do not imply agent reliance.

A unit test exercises two revisions, an unchanged poll, a trimmed metadata get, and a miss to lock in the invariant.

Reviewed by Cursor Bugbot for commit 56f7dfe. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Nov 25, 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 25, 2026 5:06pm UTC
loom-telemetry Ready Ready Preview Nov 25, 2026 5:06pm UTC

Request Review

@cla-assistant

cla-assistant Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@zlareb1 zlareb1 self-assigned this Nov 25, 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.

No findings. HTTP and MCP record the poll flag without storing the memory value. All 28 focused ledger and event projection tests pass.

@zlareb1

zlareb1 commented Nov 25, 2026

Copy link
Copy Markdown
Member

@ningsiyuan1024 plz sign CLA

@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.

The Postgres 18 storage job times out while flushing trace_log. The same test returns ClickHouse code 159 on clean main when the trace log is delayed. It passes with the repair's query-log-only flush while the trace log is still delayed. Failed job · Repair #1495

@zlareb1
zlareb1 merged commit 4cbfb3e into ClickHouse:main Nov 26, 2026
126 of 127 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