Skip to content

fix(learning): keep runtime vectors out of dropped batch items - #137

Merged
leafliber merged 1 commit into
mainfrom
fix/learning-dropped-serialization
Nov 10, 2026
Merged

leafliber merged 1 commit into
mainfrom
fix/learning-dropped-serialization

Conversation

@leafliber

Copy link
Copy Markdown
Member

学习批次弃项 derived memory changed or invisible 把含 numpy _embedding 的 item 写入 dropped,序列化 result_json 时 TypeError,整批失败(embedding 配置开启时才触发)。

改动

  • src/iris/learning.py:新增 _dropped_memory,两条能看到向量的 dropped 路径都用它(含 feat(learning): 只有角色发言作证据的确认不加保留强度 #136 的 SELF_ONLY_CONFIRMATION)。其余路径在附加 embedding 前执行,或 item 不是记忆。
  • ARCHITECTURE.md:maintenance_batch_retries 改为迁移 036 之后的第 1、3、7 天各一次。

验证

  • 新增 tests/test_learning_dropped_serialization.py,先写失败测试复现(修复前 TypeError),另覆盖 20 条上限弃项。
  • 3.13:5538 passed,1 failed;3.12:5538 passed,1 failed;uv build 通过。
  • 失败项为 tests/test_persona_streaming.py::test_future_deadline_closes_stream_worker_and_preserves_shared_client,与本 PR 无关:在不含本改动的 origin/main 工作树上单独运行同样失败。

A memory dropped because its derived source changed during the model call
still carried the numpy embedding, so writing the batch result raised
TypeError and failed the whole batch. Strip the vector in one helper used by
both _apply paths that can see it. The other dropped paths run before
embeddings are attached or hold no memory item.

ARCHITECTURE: maintenance_batch_retries now retries on days 1, 3 and 7.
@leafliber
leafliber merged commit ca4b9ee into main Nov 10, 2026
1 check passed
@leafliber
leafliber deleted the fix/learning-dropped-serialization branch November 10, 2026 18:56
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