Repository navigation
feat(consolidation): resolution=auto_v1(规格 C) - #139
Merged
Merged
Conversation
… and undo Model gives judgments and mutual-merge drafts only; scores, lifecycle and annotations are written by code per spec C: - C1 mutual details: drafted body passes deterministic checks (unique fragments, numbers, negation scopes, qualifiers, subject mentions, time expressions, entities, no new content words) or both are kept with outcome=mutual_merge_rejected and a fixed reason. - C2 contradictions: supersedes / reported_vs_self / coexist / undecided, any failed check is undecided; role speech alone never decides. - C3 dependencies: independent original messages traced through evidence_trace (no lost sources, no self_output); 0 forgets. - C4 only an unresolved contradiction blocks merges of shared memories. - Protected (pinned / manual edit) work is recorded without model calls. - Undo endpoint with expected_revision; 409 on any later change. Migration 037 lets only an undo transaction restore a merge placeholder. - Superseded forgotten memories are not revived by reconfirmation. - Settings and report UI; default stays report_only_v1. - evals: auto_v1 run on consolidation_v2 or --corpus, deterministic auto_score.py, external merge-detail materials.
- Annotations are keyed per action, so a cleared earlier annotation never absorbs a new one and undo clears only its own action's annotations. - Mutual-merge drafts must use exactly the union of both bodies' words, function words included (prompt mutual_merge_v2 says so). - Undo re-points dependents of a restored body to its new revision, cancels pending dependency losses the action caused and refunds applied ones. - Undo restores retention by difference for forgotten memories as well. - C3 counts the target's own non-role messages as independent support. - adjust_retention never restores a superseded forgotten memory; only an explicit restore or undo clears the annotation. - C4: in auto mode a classified but unfinished contradiction blocks merges of its shared memories. - auto_score: unprocessed items are never correct and are reported by category; rewritten merges are listed and checked deterministically.
…cay report - Pairs with a forgotten member that has an uncleared superseded annotation are skipped at planning without a model call (broad, mutual and report_only suggestions), recorded once per run as skip:superseded_member. Restore or undo changes the snapshot and puts the pair back. - Daily decay reports restored only when the memory actually became active; a blocked restore is a skipped item (superseded), not a daily change.
consolidation_annotations.automatic (migration 037, default 0) marks annotations written after auto_v1 rules checked and executed a judgment. The restore guard, the superseded_member planning skip and the restore clearing only consider those; report_only model suggestions keep their existing behaviour.
- A model reason never blocks a checked conclusion: if it fails grounding it is archived and the report uses text generated from verified fields (pair classification, ordinary and mutual merges, conflicts, dependencies). Draft rejections keep their specific codes. - Textual IDs that name exactly one visible ID are converted; protocol slips (type, missing keep_id, extra fields, unknown IDs) get the one mechanical repair and are re-authorized. Nothing is guessed. - auto_v1 classification uses consolidation_pair_auto_v1.md; report_only keeps pair_v3. - Merge fragments that are not body substrings get one bounded correction; a conflict is no longer turned into uncertain by the fragment check. - Related pairs kept apart by visibility are recorded at planning. - auto_score: recorded exclusions count for keep_both, coexist judged by state (no new disputed/superseded), label and work counts reported.
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.
按 SPEC-C 实现整理
resolution=auto_v1。默认值不变:新库和现有库仍是report_only_v1,未知或旧值归一成report_only_v1,运行快照写入consolidation_runs.settings_json。未调用真实模型。实现
主体[...]、时间表达、实体名(主体名/别名、拉丁标识、书名号等、jieba nr/ns/nt/nz)、内容词不超出双方并集(只放行 并、且、并且、同时、以及、另外、还)、说话人/立场/涉及人/event_time/可见范围、未保护。任一失败记mutual_merge_rejected和固定原因,不写建议。通过后存续记忆(preferred_keep_id)写新正文、修订号+1、清向量,另一条走既有合并路径。superseded标注;reported_vs_self:转述降一档并标disputed;coexist:只记录;undecided:两条标disputed。independent_support_ids;src/iris/evidence_trace.py追溯原始消息并去重,只到 self_output 的不算,0 条时遗忘并标insufficient_support。M2 扣减不变。blocked只含仍未解决的 undecided 矛盾;invalid_details、失败和规划失败只影响本对。report_only 的阻塞逻辑不变。protected,不调用模型。evidence_trace是共用模块,persona._trace未改。memory_ops.superseded_forgotten;学习的confirm_once遇到“已被替代且遗忘”只追加来源,弃项原因superseded_no_restore;管理员恢复或撤销时清除标注。POST /admin/api/maintenance/{run}/consolidation/{work}/undo(管理员会话、CSRF、expected_revision)。逐字段核对,有变化返回 409,不部分撤销。consolidation_undo_guard,并重建consolidation_no_resurrection触发器。被并入的占位只能在撤销事务内恢复。run.py --resolution auto_v1(默认语料consolidation_v2.json,支持--corpus/--out,按entries设置可见范围)。auto_score.py用代码计算误处理、正确处理、保护、写回损坏和调用计数。合并丢细节导出外部材料,评分说明是新文件merge_details_scoring_auto_v1.md,待规划者审查后冻结。提示词(新文件,旧文件保留)SHA-256:
consolidation_conflict_auto_v1.md249a1a2c4a60a6088ca027f61052740c92eed512ccdaec35d2a13e6625ee825econsolidation_dependency_auto_v1.mde3605ac6cb21118f7e1cac81af40e3870c2e6fcb2c7a0977bd4c3801adb22466consolidation_mutual_merge_v1.md6adee5e4718c91c1467d0a9c7794c5da6ff48bb037ee324e6d22ce5630b656c4merge_details_scoring_auto_v1.md5624b7fce5a3e5ebd7a1bcfa2935a92c32547986e0859a06bfad81d81392866f选了保守做法、需规划者确认的地方
entry_profile_kind);auto_v1 下入口画像的普通合并不提供撤销。原因:合并触发器单向复制回执和准入状态,撤销无法完整复原。merge_exclusion(数字不兼容、一侧有否定等)命中时记merge_not_allowed,不起草。公开集 CV002 c/d 标为 merge,但 d 含“不修改”,按现有排除规则会保持两条(计为未识别,不计误处理)。是否放宽需要规划者决定。source_revision一并前移,避免补细节被当成“更正”;撤销时还原。存续记忆为 active 时保留合并后的衰减量,其余字段严格核对。验证
tests/test_consolidation_auto.py(各规则通过/失败两个方向、中断重跑、修订号冲突、撤销 409、跨对互不连带、设置、补2)和tests/test_consolidation_auto_eval.py(公开集 24 例假模型运行、计分、材料完整性、双轮细节判分)。按标注作答的假模型下,公开集 20 个矛盾和 14 个依赖全部按规则执行正确。这只说明规则与标注一致,不代表质量结果。tests/test_media_retention.py::test_old_backup_without_cleanup_columns_or_manifest_imports:该测试假设最新迁移是 036,已在本 PR 中补上回退 037,两个版本单独重跑均 63 passed。tests/test_persona_streaming.py::test_future_deadline_closes_stream_worker_and_preserves_shared_client:已有问题,origin/main 上同样失败,与本 PR 无关。npm test、npm run build、uv build通过。