Repository navigation
Conversation
The Atomic Memory residual check narrows content Sources with a free-text match on the substring "memory" and then read the stored envelope unconditionally. Sources captured before the payload envelope existed keep the source value itself, so any prompt mentioning memory aborted apply and verify with KeyError: 'value' before collections could be removed. Judge the parsed payload instead: without a Work payload there is no legacy citation to report, the same outcome the existing model lookup gives for unrelated enveloped Sources.
happy-v587
requested review from
AlexStocks,
PsiACE and
frostming
as code owners
October 11, 2026 14:08
AlexStocks
reviewed
Oct 11, 2026
AlexStocks
reviewed
Oct 11, 2026
The residual fix skipped every payload without the stored envelope, which silently accepted a legacy row that still cited a removed collection, and the conversion path and the Dream input check still read the envelope unconditionally, so the same row aborted apply with KeyError: 'value'. Read one layout in all three places through a shared helper, and rewrite a legacy row in the layout it was written with instead of wrapping it.
Contributor
Author
|
@AlexStocks 两条意见已修复,commit 改动摘要:
验证: 我没有在 oceanbase/powercontext 上的 review 请求权限(账号只有 pull),无法用 API 重新指派审查,麻烦你手动再看一遍。CI 正在跑。 |
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.
Which issue or RFC does this PR close?
Closes #1934
Rationale for this change
atomic-memory-migrate --action applyaborted withKeyError: 'value'before it could remove any collection, so an upgraded Server could not start at all. Three places in the offline reference conversion read a stored Source payload'svaluefield without checking that the row actually uses the stored envelope:residual_issues()narrows candidate content Sources with a free-text match and then readpayload["value"]. Sources written before the payload envelope existed keep the source value at the top level, so a captured prompt merely containing the substringmemorycrashed the final acceptance check._work_sources()and_dream_inputs_change()read the same field, so a legacy structured Work Source crashed the conversion itself, or made an unfinished Dream run look unaffected.The runtime read path already tolerates both layouts through
_decode_legacy_payload(), so the offline checks are the only places that assumed the envelope unconditionally.What changes are included in this PR?
_stored_work_payload()reads one stored Source payload in either layout and returns its typed Work payload, the value and the stored root._work_sources(),_dream_inputs_change()andresidual_issues()all use it.residual_issues()now judges those rows instead of passing them silently, soready: truecannot be reported while a public Source still cites a removed collection.test_unenveloped_work_source_citations_convert_and_keep_their_layout— a pre-envelopetask-outcomeholding one exact entry citation and one whole-collection reference. Both are converted, the collection relationship is archived, the row keeps its own layout and stays readable, andverifyreturnsready: true. Fails on the previous commit withmigration-evidence/content/legacy-layout-outcome: 'value'.test_unenveloped_source_mentioning_memory_migrates_unchanged— a pre-envelope prompt capture whose free text mentions memory stays byte-identical and does not fail the migration.No public API, persisted format or documentation changes.
Are there any user-facing changes?
No user-facing behavior change. A deployment whose database contains pre-envelope Sources can now complete the Atomic Memory migration instead of failing with a
KeyError, and a legacy structured Work Source is converted rather than skipped.How was this change tested?
pytest tests/e2e/test_atomic_memory_migration_evidence.py -k unenveloped— both tests fail before the fix ('value') and pass after it.pytest tests/e2e/test_atomic_memory_migration_evidence.py tests/e2e/test_atomic_memory_grant_migration.py tests/e2e/test_atomic_memory_migration_vector.py tests/builtin/persistence/test_atomic_memory_startup_legacy_schema.py tests/test_atomic_memory_migration_cli.py— 71 passed, 84 skipped.make check— prek hooks andty checkpass.applyreportedready: truewithremoved_collections: 12,verifyreportedready: truewithverified_entries: 101, andpowercontext server run --env-file .envcompleted startup. That database was also scanned directly: no parsed Source content still cites a removed collection, and no legacy memory artifact or lineage row remains.AI usage statement
Built with OpenCode (opencode/space-bunny-free). The agent reproduced the failure on the user's deployment, located the unconditional envelope reads, wrote the fix and the regression tests, ran the validation commands above, and drafted the issue and this PR description for review. Reviewer feedback on the first commit was verified independently before being acted on: the incomplete-fix finding was reproduced and fixed, and one conclusion this PR originally stated about the conversion query was wrong and has been corrected. The root-cause analysis, the decision to fix rather than work around, and the final wording were reviewed by the user.