fix(memory): read memory records and their provenance in one statement

Merged
WA
23d ago
+201-153

Summary

  • Memory list, read, and the append readback read each record and then its provenance sidecar in a separate query. An append committing between the two paired the old record with the new sidecar's hash, so the read came back as unknown provenance and the whole tool result was withheld (e.g. memory get all from an Agent block while another run writes memory)
  • Read the record and its sidecar in one LEFT JOIN statement, the way the prefix reader already did, and drop the second query
  • Share one MEMORY_SECRET_PROVENANCE_COLUMNS set (named to match readBoundMemorySecretProvenance) across the list/read reader, the prefix reader and the Agent memory handler, removing the hand-written field mapping
  • Billing scope still resolves before any provenance is classified; no policy, schema, or limit changes

Type of Change

  • Bug fix

Testing

  • New integration cases commit an append between the reads for list, read, and append readback: all three return unknown on the old reader and exact on this one
  • Memory integration suites, full app unit suite, type-check, lint, and audits pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)