Repository navigation
A dashboard pin keeps the row's tags, entities, confidence, sensitivity and source trace - #218
Merged
Merged
Conversation
…venance memory.pin writes a whole new version through the memory.set path, so a field the request leaves out is not on the pinned row. The inspector's Pin and the Memories list's bulk Pin sent only the value, type and char_limit: the pinned version lost its tags, entities, confidence, source_trace, declared source_class and validity window. pinMemory now takes the row read with memory.get and sends those fields back; source_class only when it is one a caller may declare. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…n keeps them and the sensitivity The dashboard's pin echoed a source_trace memory.get never served, so the pinned version lost its trace and fell back to source_class asserted. The point read and bulk_get now serve source_trace and source_resource_id (bulk_get's fetch selects the latter), and pinMemory sends them back with the row's sensitivity, which a write otherwise re-detects from the value. pinMemory sends the row's type, tags and entities as served. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
row_output now reads it, so a hand-built row without it raised AttributeError. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ment says why it still rewrites Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
memory.get may answer with a row of another agent, user or session (the agent="*" fallback opens those axes); pinning it under the caller's '-' identity wrote a second row beside it and left the original unpinned. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… the listed row by its user and session Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…refused Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… pin leaves Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A procedural declaration on a plain string is stored as semantic. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ns them to the body Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e and source_resource_id Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
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):
Pinning a memory from the dashboard no longer clears its tags, entities, confidence, sensitivity, source trace, source resource or validity window.
memory.getandmemory.bulk_getnow returnsource_traceandsource_resource_id.Why
Failing case: a memory with tags
["infra", "prod"], confidence 0.8 and source traceconversation:t1, pinned from the memory inspector (More, Pin) or from the Memories list's bulk Pin. The pinned version has no tags, confidence 1.0 and no source trace, so tag filters, tag-scoped retention and provenance lose the row.Pattern:
memory.pinismemory.setwithpinnedforced on (handle_memory_pin), andmemory.setwrites a whole version from its input:tags,entities,confidence,source_trace,valid_atandvalid_tocome from the request, not the live row. The dashboard read the row and wrote back only its value, type andchar_limit.Where the fix belongs: the op reference, the MCP description ("Same arguments as memory.set; pinned is forced on") and both SDKs'
pin(setwithpinned=True, the same arguments) all define pin as a full write. Making the server carry fields forward when they are omitted would changememory.settoo, since they share the write path, and a client could no longer clear tags with[]. So the dashboard, the caller doing a read-then-write, echoes the row.Fix:
memory.getandmemory.bulk_getservesource_traceandsource_resource_id(row_output; the bulk fetch now selectssource_resource_id). The dashboard could not send back a trace the read never served: without one,source_class_forfell back toasserted, turning extracted content into an assertion.pinMemorytakes theMemoryDetailread withmemory.getand writes to that row's own agent, user and session (memory.get's fallback can answer with another agent's or session's row, and the bulk Pin now reads another user's row by that user; a pin under the caller's identity wrote a second row beside it and left the original unpinned). It sends the row's value, type, tags, entities, confidence, sensitivity, source trace, source resource, validity window andchar_limit. Sensitivity matters because a write re-detects it from the value when the request has none, so a caller'shighon a value the detector does not flag would drop to''and the row would be embedded and searchable.source_classis sent only when it is one a caller may declare (derived,external,imported); the server derives the others from the source trace.ttl_secondsstays out, which keeps the row's expiry. The write carriesif_match_sha256from the read, so a change to the value since the read answers 409 ("Pin failed") instead of being reverted. The hash covers the value only: a metadata-only write since the read (new tags, say) is still overwritten by the pin, as before; guarding that needs a version precondition onmemory.set. The bulk Pin reads each listed row by its own user and session. The inspector's Unpin addresses the same row, so a Pin of another agent's or session's row can be lifted from the same drawer.Scope and risk
frontend/src/api.ts(pinMemory, six optional fields onMemoryDetail), the inspector's Pin and Unpin, the Memories list's bulk Pin, and two output fields onmemory.get/memory.bulk_get.memory.listalready servedsource_trace.loom import-okfstill rewrites a concept that carries a source resource on every sync: askingmemory.bulk_getfor the new field would be a 422 from a server one build behind.Left alone: the columns
memory.setdoes not take at all, so no caller can send them back on any write.temporal_anchor,temporal_confidence,groundingandevidenceare reset by every revision (REVISION_RESETS, read out of the old value's text), andconceptsis written empty bymemory.set. A pin of an extracted row, from the dashboard or any SDK, still clears them, as anymemory.setrestatement does. Keeping them on a byte-identical restatement is a change to the write path for every client and goes in its own PR.run_idis also not carried:memory.settakes it, butmemory.getdoes not serve it, so a pinned row'srun_idbecomes'-', as it did before this change. The other inspector writes (tag edit, expiry change, value edit) also go throughmemory.setwithout confidence or source trace; they are left for a separate change.Compatibility, rollout and rollback
memory.getandmemory.bulk_getgainsource_traceandsource_resource_id(additive output fields; a build one version behind leaves them out, which the dashboard treats as empty). The dashboard sends only fieldsmemory.pinalready accepts. SDK op tables anddocs/reference/operations/memory.mdregenerated.Tests
src/components/MemoryInspector.pin.test.tsx(new): Pin handspinMemorythe row the inspector read, and Unpin addresses that row's agent, user and session. It failed before the change (the call carried only the value, type andchar_limit).src/views/Recent.lists.test.tsx: the bulk Pin reads the listed row by its agent, user and session, and handspinMemorythe rowmemory.getreturned.src/api.memory.test.ts: thememory.pinbody carries the row's tags, entities, confidence, sensitivity, source trace, source resource, validity andchar_limit;source_classis sent forimportedand left out forasserted; the body names the row's agent, user and session, andif_match_sha256from the read.tests/unit/test_point_reads_locate_then_fetch.py:memory.getandmemory.bulk_getanswer the samesource_traceandsource_resource_idfor one row.tests/integration/test_memory_pin.py(new tests, run in CI):test_pin_of_a_read_row_keeps_its_fieldswrites a row with every carried field, reads it, pins with what the read served and its hash, reads it again and compares each field (source_classstaysextracted);test_pin_of_a_stale_read_is_refusedchanges the value between the read and the pin and expects 409PRECONDITION_FAILED.tests/integration/test_sensitivity_high_canary.py: its fullmemory.getcomparison names the two new fields.npm --prefix frontend run build, Biome, ruff,make typecheck, and the unit files that buildmemory.getrows, the SDK snapshots and docs. Two hand-built row fixtures (test_duplicates_not_served.py,test_memory_small_defects.py) gainedsource_resource_id, whichrow_outputnow reads. The full unit suite runs in CI.Known red checks that also fail on
main:tests/integration/same_key/test_retirement_ch.py(two tests,alias_merges() got an unexpected keyword argument 'cap') andtest_search_statements_pass_analyzer.py::test_patch_part_probe_and_reemit_reads_pass_the_analyzer.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. The op contract was checked against the server write path, the op reference, the MCP description and both SDKs.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed. (Locally: format, ruff, typecheck and the touched unit files; the full unit and integration suites run in CI.)docs/reference/configuration.mdand thedocs/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).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code