Skip to content

feat(memory): consolidate working and coding experiences across sessions - #451

Draft
Leeminjing wants to merge 2 commits into
Tencent-Hunyuan:mainfrom
Leeminjing:codex/cross-session-consolidation
Draft

Leeminjing wants to merge 2 commits into
Tencent-Hunyuan:mainfrom
Leeminjing:codex/cross-session-consolidation

Conversation

@Leeminjing

Copy link
Copy Markdown
Contributor

Change

Adds explicit cross-session experience consolidation to the Working/Coding SDK. Callers select source sessions, publish reusable derived experiences, query SQL-only publication receipts, and withdraw results. The change includes source-fingerprint invalidation, whole-batch output validation, SQLite/PostgreSQL migrations and publication contracts, sync/async client APIs, 11-language prompts, and usage/configuration documentation.

This is one independent SDK PR based on upstream 7b85404be1b1. It does not depend on #447 or include that PR's Qdrant native-retrieval interfaces. No VDB adapter, dependency manifest, lockfile, workflow, or MemHub implementation changes are included.

User impact and acceptance

  • Select at least two sessions in an exact user/agent/source/workspace/branch/scene scope; reuse the same source snapshot regardless of session order or request ID.
  • Publish derived experiences through the existing experience-vector channel, including legitimate reusable no_result decisions.
  • Hide a whole batch when any actual input changes or disappears; expose explicitly marked receipt diagnostics for re-review.
  • Preserve explicit withdrawals across reuse/reactivation, and report uncertain commits as outcome_unknown for SQL verification.
  • Retain existing custom repositories' ordinary interfaces; reject unsupported consolidation rather than silently publishing without an atomic transaction.

The acceptance criteria existed before implementation. A separately verifiable failing-test-before-implementation history has not been established; none is backfilled.

Validation

Current tested code: ea99d85. Head 94c7e4d adds documentation only.

  • New consolidation contracts and prompt registry: 161 passed, 0 failed, 0 skipped.
  • Real SQLite/PostgreSQL contracts, including 16 PostgreSQL repository cases, and 8 real business-store × VDB combinations: Chroma, Qdrant Local experience collection, Qdrant Server, and FAISS.
  • Affected paths: public sync/async client entry points and diagnostics, real vector-store publication/search/session filtering/reuse/withdrawal. LLM and embeddings are deterministic stubs; not every client/backend combination is covered end to end.
  • Mutation: relaxing the two-source-session output gate produced the expected failing assertion; normal code passed the same 16 tests. Mutation ran in memory without editing source files.
  • Ruff on all changed Python files, compileall, and diff whitespace checks.
  • Full SDK green: current branch 2002 passed / 72 failed / 33 skipped / 18 errors / 45 deselected, exit 1.
  • Focused regression green: 803 passed / 12 failed / 4 skipped / 15 teardown errors, exit 1.
  • MemHub: N/A; no MemHub files changed.

A complete unmodified archive of upstream 7b85404be1b1, using the same Python/dependencies/test services, produced 1919 passed / 73 failed / 33 skipped / 18 errors / 45 deselected, exit 1. Comparing complete JUnit testcase IDs found no current-only failure/error IDs; 90 IDs were shared. One baseline-only reembed failure was not counted as a fix. This comparison does not establish that every failure has the same cause or that the full suite is green.

Environment: Windows, Python 3.12.10, SQLite 3.49.1, PostgreSQL 17.7/psycopg 3.3.6, Chroma 1.5.9, Qdrant client 1.19.1/Server 1.20.0, FAISS 1.15.1. PostgreSQL and Qdrant used newly created disposable Docker containers.

Commands, versions, results, baseline comparison, native-interface evidence, and limitations.

Native retrieval declaration

Derived experiences reuse existing native dense-vector interfaces: Chroma Collection.upsert/query, Qdrant upsert/query_points, and FAISS IndexFlatIP/add/search. Fixed-version official interface references are linked in the validation record.

New SQL receipt/read-set tables and reverse dependency indexes manage publication, validity, withdrawal, idempotency, and business visibility. They do not produce semantic or term-search candidates. No sidecar retrieval index or new keyword/BM25/full-text/hybrid channel is introduced.

Qdrant Local coverage is limited to the existing experience collection, not full dual-store initialization. Chroma HTTP, multiple Python versions, scale performance, and fresh real-model quality sampling were not run. Historical author-provided quality results are retained separately and are not presented as current-head validation.

Privacy, safety, and dependencies

  • No screen, AXTree, OCR, keyboard/mouse, clipboard, or background-audio collection added; inputs are explicitly selected existing stored records.
  • No credentials, private service addresses, or real user data intentionally included. Test inputs are synthetic and services are disposable; raw local logs containing machine paths are not published.
  • No new runtime dependencies or third-party source copied; existing dependency licenses remain unchanged.

Rollback

Stop invoking the new consolidation APIs. Back up upgraded business databases before reverting code; do not assume older releases can open the new PostgreSQL schema. Use a validated migration or restore procedure rather than dropping receipt/source data. Database downgrade/restore has not been rehearsed in this draft.

Draft status

Keep this PR as draft while current-head CI, the red full/focused regression results, validation limitations, and code review remain to be resolved. No existing #447 CI success is attributed to this PR.

@Leeminjing
Leeminjing marked this pull request as ready for review November 14, 2026 04:17
@Leeminjing
Leeminjing marked this pull request as draft November 15, 2026 08:02
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.

1 participant