Skip to content

Use the selected Goal runtime for Chat task reads and writes - #8717

Open
loopx-agent wants to merge 6 commits into
mainfrom
codex/audit-chat-goal-routing-pr-20261114
Open

loopx-agent wants to merge 6 commits into
mainfrom
codex/audit-chat-goal-routing-pr-20261114

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Goal and delivered outcome

Chat Task detail, edit, completion, Monitor updates and Gate resolution now use the Goal's original registry and runtime. A shared directory can point to that authority. The shared store cannot authorize edits to Tasks that only exist there.

An interrupted confirmation retains the original Todo creation receipt, operation, runtime route and authority store. If the same Goal and Todo IDs appear in a replacement store, a retry refuses the assignment. Once the original route and registry are restored, retry the same confirmation to assign the original Todo once. Older interrupted creations without a source witness need their original receipt checked before assignment.

The branch incorporates main at 74ca883d5b and preserves its managed Task claim, Stop, session and Turn recovery paths.

Validation

Check Result Evidence
Native Chat HTTP with real File and SQLite Passed 114 tests at 347f716d89. All 18 source and interruption regressions repeated at 41cffe5532. The replacement snapshots and revisions stay unchanged, and restoring the source adds one assignment. Detail, edit, complete, Monitor stop and Gate resolution use the same source.
Reviewed create transport Passed Four TypeScript tests at 41cffe5532 cover the File and SQLite transactions and rejection of downgraded wire requests.
Packaged Chat Passed Desktop and 390px Task inspector, real backend editor, draft retention, conflict recovery and saved requirements readback. The packaged UI inputs are identical between 347f716d89 and 41cffe5532.
Local premerge checks Passed Six direct, ten catalog and eight risk-profile checks at 41cffe5532.
Full control-plane typecheck Failed npm run typecheck:control-plane returns the same TS2345 at tests/control_plane_ts/coordination_runtime_shadow.test.ts:380 on 74ca883d5b and 41cffe5532. The required check remains a qualification hold.
PostgreSQL, Windows and installed desktop Not run Local verification used isolated File and SQLite stores and a rebuilt Chat package.

The author verification covers the routing and assignment boundary. Original confirmation after a missing create checkpoint and recovery from a pending display remain tracked in #8725 and #8727. This candidate needs independent review and current required checks before merge.

Canonical registry source witnesses · Independent review findings on the original head

Use the serving coordination runtime for reviewed Todo and Monitor actions when no registered runtime owns the route. Keep the same provider for preview, apply and receipt replay, and retain registry precedence when a source is registered.

Signed-off-by: LoopX Agent <[email protected]>
Route reviewed Todo creation, assignment and Monitor creation through the same Goal source used for Task reads. Use the serving runtime only for an unbound project registry. A shared directory resolves its source registry before any write, and a Monitor confirmation becomes stale when that source registration changes.

Signed-off-by: LoopX Agent <[email protected]>
@mergify

mergify Bot commented Nov 14, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 3347c7f8dbb0a20cfe5bda7bfdbb69af69c1ef0c;对照目标基线 78e936f9d1f1a00505c4026ee0a5857de95cee27。

[P2] 创建回执恢复时会把原任务的分配写入新来源。 从共享目录确认创建 Todo。旧来源已持久化创建回执,但请求在分配前中断;目录随后将同一 Goal 指向另一独立来源,那里有同 ID 的不同任务。 重试原 proposal 时,候选用旧创建回执里的 Todo ID 写入新来源,把无关任务分配给 Agent,并返回 applied / projection_verified=true。原任务仍未分配。基线用同一夹具重试时只改原来源。File 和 SQLite 均复现。 恢复后分配

[P2] 全局目录能读到原任务,编辑和完成却查写共享库。 全局目录同时声明 common_runtime_root 和某个 Goal 的 source_registry,两边都有该 Goal,但包含不同的 Agent Todo。 详情从原来源返回 200,带这个 review_basis 编辑返回 400,完成同一 Todo 也返回 400。仅共享库里的任务详情是 404,直接预览和确认却返回 201/200,并确实修改共享库。精确基线同样失败,这是本次承诺修复的路径仍未覆盖。 预览使用的 runtime

动机 / Motivation

通过本机 App 管理多个 Goal 或在故障后恢复任务创建的用户。 用户在 Chat 打开、创建或修改同一 Goal 的任务。有独立来源时,共享目录只能作为入口。创建中断后用户可以重试已经确认的动作。 本次正常创建、Monitor 创建、独立 Todo 预览和用户完成的原生 HTTP 检查通过,覆盖服务 runtime、已注册 runtime 和共享目录;共享目录的无歧义读取及未换源的创建恢复也通过。 独立复现用源码检出的本地 Chat HTTP 和真实隔离 File/SQLite,仅注入中断,没有调用模型。前端渲染未改;安装态、PostgreSQL 与托管 CI 未查。

改动思路 / Approach

Goal 来源解析器选择 runtime;原生 Todo provider 负责权限、CAS 和回执。Chat proposal checkpoint 只保存操作身份、恢复应由这些事实约束。 沿用同一个来源解析及原生操作回执,收拢 Chat 既有操作与创建恢复的来源选择。新一层猜测或只改错误文案都不会改变写入目标。

具体改动 / Changes

goal_read_runtime_root 给全局目录留出 per-Goal 路由,resolver 在无声明时先尊重显式 override。Todo/Monitor 创建与独立 dry-run/apply 改用 loopx/chat/todo_actions.py 的来源选择;既有 Task、Monitor、Gate 只接入了 runtime fallback。检查覆盖 10 个文件(+369/−53,其中生产 +115/−45);其余是两种 provider 的原生创建、完成及任务正文读回夹具。全局目录 显式 override 预览绑定 既有 Monitor

按 原生来源 witness 与历史回执合同,explicit-runtime-selection、normal-create-source 已验证;checkpoint-source-parity、existing-task-source-parity 未满足。

对主干的风险 / Risks

精确基线在换源后仍分配原任务;原任务预览与详情不一致则是基线就有的缺口,属本次交付范围。另对 1cdd9bb 做本地无写入合并演算,两条保留来源逻辑 loopx/chat/todo_actions.py、loopx/chat_actions.py 有冲突。解决冲突后需要对合入候选重跑这两组测试。

语义与 CI 对齐

PASS:70 个 Python 测试、17 个本地 premerge 检查、同源恢复和显式 runtime 优先。FAIL:两种 provider 的换源恢复会写错库,且既有 Task 详情和编辑/完成仍未同源。UNVERIFIED:已安装桌面、PostgreSQL 和托管 CI。 两组反例都通过真实本机 HTTP 及隔离的原生 File 和 SQLite authority。故障只注入在创建 checkpoint 写入之后;观察来自两份实际 provider head 和最终回执。

我的整体评价 / Verdict

请求修改。让创建 checkpoint 绑定原来源的 registry、runtime 和原 provider 操作身份。重试只在原来源仍可恢复并有当前分配权限时续做;否则保留已创建的回执、拒绝新写入,并让用户处理来源变化。 让详情、预览、编辑、完成及共用的 Monitor/Gate 分支解析同一 Goal 来源;拿该来源的 registry witness 和 provider revision 做预览与写入校验。 用真实 HTTP 在 todo_created 落盘后、todo_assigned 前断一次,再改目录指向包含同 ID 不同内容的第二个库:不能修改替代库或报告完整成功;同源重试仍只分配一次。 在 File 和 SQLite 的原库、共享库各灌入不同 Todo;从详情发出 edit/complete,确认写回原库,并证明共享库独有任务走同一预览入口时被拒绝。

English verdict: REQUEST_CHANGES at 3347c7f. Matched File and SQLite HTTP runs prove a new write to the replacement authority during interrupted-create recovery. Existing edit and completion still use the shared store despite source-correct detail. Keep normal routing and bind all reviewed effects to the same source.

Comment thread loopx/chat_actions.py Outdated
update_goal_todo(
registry_path=self.registry_path,
goal_id=str(parameters["goal_id"]),
registry_path=registry_path,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 创建回执恢复时会把原任务的分配写入新来源。 从共享目录确认创建 Todo。旧来源已持久化创建回执,但请求在分配前中断;目录随后将同一 Goal 指向另一独立来源,那里有同 ID 的不同任务。 重试原 proposal 时,候选用旧创建回执里的 Todo ID 写入新来源,把无关任务分配给 Agent,并返回 applied / projection_verified=true。原任务仍未分配。基线用同一夹具重试时只改原来源。File 和 SQLite 均复现。 让创建 checkpoint 绑定原来源的 registry、runtime 和原 provider 操作身份。重试只在原来源仍可恢复并有当前分配权限时续做;否则保留已创建的回执、拒绝新写入,并让用户处理来源变化。 用真实 HTTP 在 todo_created 落盘后、todo_assigned 前断一次,再改目录指向包含同 ID 不同内容的第二个库:不能修改替代库或报告完整成功;同源重试仍只分配一次。

Comment thread loopx/chat/todo_actions.py Outdated
registry_sha256 = self._registry_fingerprint()
authority = read_canonical_todos_if_promoted(
runtime_root=effective_runtime_root(self.registry_path, None),
runtime_root=effective_runtime_root(self.registry_path, self._todo_runtime_root_arg()),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 全局目录能读到原任务,编辑和完成却查写共享库。 全局目录同时声明 common_runtime_root 和某个 Goal 的 source_registry,两边都有该 Goal,但包含不同的 Agent Todo。 详情从原来源返回 200,带这个 review_basis 编辑返回 400,完成同一 Todo 也返回 400。仅共享库里的任务详情是 404,直接预览和确认却返回 201/200,并确实修改共享库。精确基线同样失败,这是本次承诺修复的路径仍未覆盖。 让详情、预览、编辑、完成及共用的 Monitor/Gate 分支解析同一 Goal 来源;拿该来源的 registry witness 和 provider revision 做预览与写入校验。 在 File 和 SQLite 的原库、共享库各灌入不同 Todo;从详情发出 edit/complete,确认写回原库,并证明共享库独有任务走同一预览入口时被拒绝。

@mergify mergify Bot removed the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 14, 2026

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

评审提交 41cffe553282a3dbd87c8946334749fcb346d64a,对照目标基线 74ca883d5bd3e4bc64671bac54210eac9e97ed05。

[P2] 同源并发创建后,已确认的任务无法续做分配。 Chat 已持久化 todo_created,提交尚未分配时断开响应。另一条正常 Todo 创建推进了同一 Goal 的 provider revision,原任务内容、注册来源与操作身份都未变。 File 和 SQLite 上重试原确认两次均因旧 provider revision 返回 HTTP 400,原任务一直未分配。主干在相同并发下返回 applied,重放读回同一回执。候选没有并发写入时也通过。 分配时使用原 provider revision

[P2] 监控核验后切换注册来源,确认仍写入旧库。 从共享入口确认监控创建。在 Chat 通过当前来源 fingerprint 核验后、调用 Todo provider 前,将同一 Goal 的注册来源指向另一独立库。 候选返回 HTTP 200/applied 并在旧库增加一条监控。主干在相同竞态写入替代库。两个版本在来源变化时都报告成功,候选改变了错误写入的目标。候选普通 Todo 创建挡住相同换源,两库数据不变。 监控写入入口

动机 / Motivation

在 LoopX Chat 管理注册 Goal 中任务和监控的用户。 用户在共享入口确认创建、分配或编辑任务,服务中断后重试同一确认。监控提交也应遵循用户确认时的 Goal 来源。 主干上,创建成功后若另一个正常任务推进同一来源版本,重试仍能分配原任务。主干的监控在晚换源时会写入新库。 先前两项问题的复现已通过。创建中断后提前换源时,候选拒绝改动替代库。原来源恢复后可以续做。同源详情、编辑、完成、停止监控和处理 gate 都走注册来源,共享库独有的任务无法从该 Goal 操作。 使用源码检出的真实 Chat HTTP 和隔离的 File、SQLite,确认打包构建和客户端 schema 测试。安装态、PostgreSQL 及带启动的任务分配分支没有做本次独立复现。托管 CI 未查询。

改动思路 / Approach

Chat 的 Goal resolver 负责选定来源,Todo authority 持有写入许可、CAS 和回执。恢复时,Chat checkpoint 需要保留原创建与分配的身份。 Keep one source resolver and the original writer. The persisted witness needs a current per-attempt CAS for unperformed assignment and the same write fence for monitoring.

具体改动 / Changes

关键代码讲解

  • resolve_chat_todo_source 收拢注册来源选择。恢复时 require_created_todo 校验原创建操作及任务;后续写入却继续使用创建时的全库版本。来源选择及恢复校验 原分配尝试
  • monitor.create 使用 resolver 的目标库。其既有 add_goal_todo 支持校验 registry digest 和 provider revision,当前确认调用没有传入。监控调用 已有写入边界
  • 19 个文件(+839/−121)。前端仅放宽一个来源字段的解码;HTTP 路径和两类 provider 的差异由测试、隔离复现和 provider 读回核查。现有 Chat 路由检查

按 docs/project-agent-todo-contract.md 验收。same-goal-source 已验证,original-create-recovery 和 monitor-commit-source 未满足。先前的同 ID 替代库与详情、编辑、完成失配已有回归覆盖并通过。原生来源与恢复约束 上次评审

对主干的风险 / Risks

分配失败发生在创建已提交后,用户反复确认仍得不到原先请求的分配。监控在错误来源持久化后会出现在后续调度的候选集中。两库的行数和动作回执均已核对。在每次仍未分配的尝试中读回当前来源和原 create 操作身份、原任务内容及当前分配资格,确认与原意图一致后使用当前 provider revision 做 CAS。持久化本次分配的请求身份并用原回执恢复,保留 registry 及目标任务校验。 让监控创建把已审阅来源的 registry digest 和 provider revision 交给原生创建 API,在写入边界校验。末次换源应停写并要求用户刷新确认。

语义与 CI 对齐

候选通过 92 个 Python 测试、40 个 TS 测试、19 项本地标准预合并检查和打包构建。两个反例各在 File 和 SQLite 重现。两处最小因果改动的隔离对照合计通过 8 个用例。全量 TS typecheck 在两版都报既有测试的 TS2345。托管 CI 未查询。

我的整体评价 / Verdict

请求修改。在 File 和 SQLite 分别令创建 checkpoint 持久化后中断,创建无关 Todo,再重试同一确认两次。断言仅分配原任务一次,读回同一回执,且新版内容或换源仍拒绝。 在 File 和 SQLite 的同一个真实 HTTP 入口重复换源,核对两库行数和内容。来源变化应返回失败,独立对照接入现有 native CAS 后两库均无写入。

English verdict: REQUEST_CHANGES at 41cffe5. A concurrent unrelated Todo write strands the original confirmed assignment on both local providers. A late registry switch allows Monitor creation to commit in the obsolete store. Both earlier reported reproductions pass on this head.

Comment thread loopx/chat_actions.py
agent_id=str(agent_id),
authority_reason="owner-confirmed typed Chat action",
update_operation_id=f"chat-assign:{proposal_id}",
update_expected_provider_revision=binding["provider_revision"],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 同源并发创建后,已确认的任务无法续做分配。 Chat 已持久化 todo_created,提交尚未分配时断开响应。另一条正常 Todo 创建推进了同一 Goal 的 provider revision,原任务内容、注册来源与操作身份都未变。 File 和 SQLite 上重试原确认两次均因旧 provider revision 返回 HTTP 400,原任务一直未分配。主干在相同并发下返回 applied,重放读回同一回执。候选没有并发写入时也通过。 在每次仍未分配的尝试中读回当前来源和原 create 操作身份、原任务内容及当前分配资格,确认与原意图一致后使用当前 provider revision 做 CAS。持久化本次分配的请求身份并用原回执恢复,保留 registry 及目标任务校验。 在 File 和 SQLite 分别令创建 checkpoint 持久化后中断,创建无关 Todo,再重试同一确认两次。断言仅分配原任务一次,读回同一回执,且新版内容或换源仍拒绝。

Comment thread loopx/chat_actions.py
metadata["watch_only"] = "true"
result = add_goal_todo(
registry_path=self.registry_path,
**source.writer_scope(),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 监控核验后切换注册来源,确认仍写入旧库。 从共享入口确认监控创建。在 Chat 通过当前来源 fingerprint 核验后、调用 Todo provider 前,将同一 Goal 的注册来源指向另一独立库。 候选返回 HTTP 200/applied 并在旧库增加一条监控。主干在相同竞态写入替代库。两个版本在来源变化时都报告成功,候选改变了错误写入的目标。候选普通 Todo 创建挡住相同换源,两库数据不变。 让监控创建把已审阅来源的 registry digest 和 provider revision 交给原生创建 API,在写入边界校验。末次换源应停写并要求用户刷新确认。 在 File 和 SQLite 的同一个真实 HTTP 入口重复换源,核对两库行数和内容。来源变化应返回失败,独立对照接入现有 native CAS 后两库均无写入。

@mergify

mergify Bot commented Nov 15, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant