Repository navigation
Conversation
…kFlowLab#658) The in-process admission lock could not stop two backends that share a projects directory from starting overlapping turns. Record the live agent session in catalog.sqlite3, refuse a second start with the same 409, and expire or release the row so a crash does not block the project. A queued successor may replace its predecessor in the same transaction so single-instance queue behavior stays the same.
david6666666
left a comment
There was a problem hiding this comment.
非表决 COMMENT · 175355a · Fixes #658
技术结论:暂不建议合入。68/100(范围 3、正确性 2、验证 1、主张证据 2、简洁度 3;各满分 3)。把准入放进共享 SQLite transaction 是对的;在租约有效时,两实例不会同时领到项目。但仅拦开始不够,失去租约的旧 turn 还能继续执行、写回,和接手者重叠。建议把当前 lease 的身份校验带到收尾,并在失去所有权时停止旧 turn。
作者报告 94 项局部测试;我核对了源码与 exact-head Release logs,未重跑。这版单独缺 Python 分片登记,跨实例用例没有被对应工作流选到。
English recap: Shared admission is useful, but lease loss must stop or fence the old turn. The new test module is also missing from the shard manifest.
Dot,代表 @david6666666 作非表决审查。
| process cannot take the slot in between. | ||
| """ | ||
| now = time.time() | ||
| existing = self.active_agent_session(db, project_id, now=now) |
There was a problem hiding this comment.
旧 turn 续租失败后,现在只是结束 renewal task;运行本身和 conversations.update(finish=...) 不校验当前 lease。这时这里能把已经过期的项目交给新 turn,旧 turn 恢复后仍能写回。建议失去租约时终止旧执行,并在提交结果时核对同一 lease;补一个所有权已交接、旧 turn 的完成被拒的回归。
| return root + '/assistant' | ||
|
|
||
|
|
||
| def test_two_apps_sharing_a_repository_cannot_run_overlapping_turns(tmp_path, monkeypatch): |
There was a problem hiding this comment.
这个用例对跨实例行为很关键,但目前整个文件没有登记到 Python shard manifest,同版 CI 在文件对账处失败。请把它加到合适分片,再确认 CI 实际收集并运行这里的回归。
Fixes #658
Summary
The in-process admission lock could not stop two backends that share a projects directory from starting overlapping turns. This change records the live agent session in
catalog.sqlite3, refuses a second start with the existing 409, and expires or releases the row so a crash does not block the project. A queued successor may replace its predecessor in the same transaction so single-instance queue behavior stays the same.Changes
Test plan
tests/test_agent_turn_mutex.pyplus conversations/queue/trace related coverage: 94 passedSuggested labels:
type:bug,area:agent(this account cannot add labels).