Repository navigation
test(calendar): retain managed tasks across process restarts - #7781
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration_source=runtime_reported; reasoning_effort=max.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
维护者需要确认,已安排的任务在重启后仍保留原身份、暂停状态和已完成结果。 旧测试在同一进程重建控制器;新测试让独立解释器读取同一物理状态,下一到期点保持暂停,重新启用后只执行一个新窗口。 File 与 SQLite 均保留原 Session、actor、旧 Turn 字节和消息前缀;后续窗口只有一次模型开始和一条原回复,取消后再下一日没有新增执行。
此 PR 仅新增隔离回归,不改变运行时行为,也不证明线上重启、真实模型质量或自然到期送达。 完整服务进程树重启、真实模型报告质量和生产自然到期交付仍需原有周期任务验收。
改动思路 / Approach
核心差异是让新 Python 解释器重新打开原物理数据,而不是继续借用同一进程里的对象。保留现有 setup、HTTP preview/apply、calendar pump、native Turn 和独立 artifact validator;父进程先关闭旧控制器,各子进程顺序退出后才启动下一次。再次启用仍由原配置 owner 决定执行,测试没有另造持久状态或业务规则。
不修改会继续留下明确的证据缺口;重跑旧生命周期用例不能证明解释器内存丢失后的行为。扩展浏览器 fixture 成独立服务会增加不必要的装配。当前边界只给已有 Task 恢复增加有消费者的回归,没有把未完成的编辑器或自然语言旅程改写成已交付。
具体改动 / Changes
关键内容讲解
_resume_calendar_process使用同一 runtime root、registry、Session 和 actor 重建控制器。暂停或取消时先要求模型请求与历史完全不变;恢复路径通过真实 HTTP 配置启用,完成一个窗口后清除配置。该普通 local Session 没有 Lark transport。test_calendar_physical_state_survives_independent_processes独立检查子进程 PID、原 Turn 字节、历史前缀、不同窗口、一次模型开始和每窗一条原回复。取消后的时钟推进到再下一日,避免用“旧窗口已经完成”误充取消证明。PIDs 不要求跨顺序进程永不复用。
独立规格为 周期 Task 合同,revision bc8658523968d2ff5c59d56afeb920fbe95f71ef。original-task-and-session、existing-configuration-transaction、retained-recovery-and-no-replay 在本次隔离边界内 implemented;complete-product-journey deferred,仍由现有产品验收完成。差异仅一份测试文件、105行新增,没有生产、文档、生成资产或兼容分支变化。
对主干的风险 / Risks
没有发现阻塞缺陷。最强反例是同进程缓存掩盖持久化缺失,以及在已完成窗口测试取消而误通过;新解释器和后续到期时钟分别给这两个假设施压。File/SQLite 最终串行两例 PASS(56.45秒),先前单独运行也分别 PASS。Ruff、编译、RFC/差异检查及标准 premerge 的五项直接检查 PASS;该测试差异没有选中额外 catalog smoke。按本 Goal 策略未查询或等待 CI。
首版 fixture 曾错误装配不需要的外部 transport,已在当前差异移除;同轮 SQLite 第一次 native wait 在启动子进程前触及原15秒上限。旧失败完整保留,原因未归因,不能声称已修复其根因。当前分别运行与最终整组验证覆盖同一原生等待及跨进程不变量,没有提高15秒限额或删除生命周期断言;仍应保留再现时的诊断。目标文件公开边界扫描 PASS;aggregate local check 的既有 authority-health 错误没有改称整条命令通过。
已检查既有 controller-only 的 #7706、report fixture 隔离的 #7738 和 editorial 的 #7708。另有同账号25条有界批次观察,存在结果上限且账号被多个 Agent 共用,不作全账号行为推断。该新例保护不同的 OS 解释器边界,保留旧用例的撤权/迟到回调覆盖。没有新增独立 smoke 或第二套服务。合成模型、fake clock、父测试驱动器以及共享 effect-runtime 的生命周期限制仍明确;这不是完整服务树或真实发送恢复验收。
我的整体评价 / Verdict
这是 justified_increment:长期接续行为保持原样,仓库获得对后续周期和旧结果保留的进程边界验证;用户配置、会话和回传步骤不变。主要代价是隔离集成测试增加启动成本,当前两例整体56.45秒;没有费用或运行时提速结论。复用现有测试 owner 和 HTTP 辅助函数,比新服务或新兼容机制更合适,新增测试可单独回退。
当前差异仅为 tests/test_managed_session_calendar_tasks.py,没有渲染、布局或产品文案变化。 没有新增页面验收;已有任务编辑器和线上服务验收仍属后续工作。 完整服务树、真实模型质量与生产自然到期仍欠现有产品工作,不能据此完成其父目标。
English verdict: APPROVE. Head bd531b9fecc68647004404289e265f2b13309343 adds justified process-boundary persistence and no-replay coverage; File/SQLite and required local checks pass. Production service-tree and live-delivery qualification remain outside this increment.
Goal And Delivered Outcome
Existing managed calendar Task recovery tests reconstruct controllers in one Python process. This adds acceptance across actual process exits: fresh Python interpreters reopen the same physical File or SQLite state, retain the original Session and result, honor a saved pause, execute one next independent period after re-enabling, and honor cancellation at a later deadline.
The consumer is the existing managed Session calendar recovery work. This closes a process-boundary evidence gap without changing runtime behavior or introducing a new fixture service.
Author Declaration
Scope And Continuation
The change is confined to the existing calendar integration test module. It reuses the native setup, independent artifact validator, HTTP settings, calendar pump, Task/Turn and physical backend owners. Each child exits before the next starts; there is no Lark transport or external recipient in the resumed local Session.
This qualifies the controlled Python controller/process boundary. Whole-service restart, live model quality, natural production deadlines, complete frontend task authoring and production delivery remain with the existing recurring-task acceptance. No product installation is needed for this test-only increment.
Validation
bd531b9fecc68647004404289e265f2b13309343.python -m pytest -q tests/test_managed_session_calendar_tasks.py -k physical_state_survives: File and SQLite cases passed in 56.45 seconds; each uses three fresh child interpreters. The model is synthetic and computes the independently checked artifact.checkcommand remains non-passing because of unrelated existing authority-health errors; it is not reported as an overall pass.The original in-process lifecycle tests remain unchanged. The final test also advances the cancellation clock to a new deadline, so a completed previous window cannot make that negative case pass accidentally. No performance improvement is claimed.
Frontend / Visual Evidence
Type And Area
Boundary Checklist