Skip to content

fix(coordination): let a registered agent close a goal-wide User action on hard_lease goals - #10259

Open
mojunzi wants to merge 1 commit into
loopx-project:mainfrom
mojunzi:codex/close-goal-bound-user-action
Open

mojunzi wants to merge 1 commit into
loopx-project:mainfrom
mojunzi:codex/close-goal-bound-user-action

Conversation

@mojunzi

@mojunzi mojunzi commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Goal And Delivered Outcome

  • Outcome basis / optional anchor: Reproduced defect (direct PR; no separate issue). Related to fix(coordination): let an owner close an exact linked user gate on a single-agent goal #8844, which covers the single-agent user_gate case.

  • Goal/source and gap:

    • On a multi-agent hard_lease goal, authoring accepts a goal-wide User action (task_class=user_action, goal_bound=true, no bound_agent); todo_authoring_scope.test.ts pins that.
    • User actions can never hold an execution lease (todo_not_executable, pinned in task_lease_eligibility.test.ts). The only lease-exempt terminal path in terminalFence() requires bound_agent === actor_agent_id, so it never matches a goal-wide reminder.
    • Result: no one can close it. Without an actor, todo complete / todo update --status done / todo supersede return actor_required; with any registered --agent-id they return handoff_mode_requires_lease, and the lease cannot be acquired. The reminder stays open forever.
  • Observable before → after, with the validation row that proves it:

    • Before: a goal-wide User action on a two-agent hard_lease goal is refused for every actor.
    • After: any registered, non-excluded agent completes it as the same administrative lifecycle edit a bound agent already uses (lease_fence=not_required, no lease written) (regression_parity rows). No actor, an unregistered actor and an excluded actor are still rejected earlier by registeredTodoMutationRejection(), which this PR does not touch.
  • Issue/task and intended base: Base main.

Author Declaration

  • Written by: model_agent (Anthropic Claude, via Claude Code), reviewed and submitted by the human operator.

Implemented against

  • Specification and revision: no written specification; the reproduced defect is the basis, against the existing bound-User-action rule in terminalFence() at 6ad1583.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
A goal-wide User action on a multi-agent hard_lease goal can be completed by a registered agent implemented terminalFence(), loopx/control_plane/coordination/todo_lifecycle_decision.ts test_goal_bound_user_action_completes_by_any_registered_agent (file, sqlite); bound User action closure is administrative…
No actor, an unregistered actor and an excluded actor stay rejected unchanged registeredTodoMutationRejection() runs before terminalFence() existing terminal authority rejects missing, unknown, excluded, bound, and foreign actors
A bound User action still closes only by its bound agent implemented bound_agent === actor_agent_id branch kept existing bound_agent_mismatch case
Active holders, explicit fences, delegated overrides and supersede are unchanged implemented existing guards in the same condition existing lease_fence_required, version_mismatch, lease_cas_mismatch, supersede cases
  • Self-check before submission: The change is one condition: bound_agent !== null && bound_agent === actor becomes bound_agent === null || bound_agent === actor. It changes one existing assertion. todo_terminal_decision.test.ts asserted that an unbound User action gets handoff_mode_requires_lease, but that refusal cannot be satisfied because a User action cannot acquire a lease. I replaced that assertion with the positive goal-wide case. I kept the explicit bound_agent === actor_agent_id half of the condition even though registeredTodoMutationRejection() already rejects a foreign actor on the terminal path, because evaluateCoordinationTerminalFence() reaches terminalFence() without that check. Multi-agent user_gate behavior from fix(coordination): let an owner close an exact linked user gate on a single-agent goal #8844's review is unchanged; this touches user_action only.

Scope And Continuation

  • Completed scope and remaining work: Complete within this scope. Already-stuck goal-wide reminders become closable after upgrading. supersede keeps its current lease requirement, matching the bound case.
  • Slice boundary / successor: N/A.

Validation

  • Tested revision: cdfb0a9
  • Run state: finished
  • Input classes: synthetic
Check kind Result Public-safe evidence / limitation
regression_parity passed tests/control_plane/test_canonical_handoff_invariants.py::test_goal_bound_user_action_completes_by_any_registered_agent (file/sqlite): fails on base 6ad1583 with handoff_mode_requires_lease, passes on head.
regression_parity passed tests/control_plane_ts/todo_terminal_decision.test.ts: reverting the fix fails the goal-wide case (20 passed, 1 failed); with the fix 21 passed.
integration passed npm run test:control-plane: 7044 passed, 0 failed. Python: test_canonical_handoff_invariants.py 118 passed; test_chat_user_action_handling.py, test_todo_mutation_authority.py, test_chat_gate_decisions.py, test_canonical_todo_writer_isolation.py, test_canonical_lease_acquire.py 76 passed.
static passed npm run typecheck:control-plane clean; scripts/loopx canary premerge --from-git-diff --git-diff-base origin/main passed.
  • Coverage and gaps: macOS, Python 3.13, file and sqlite providers. Not covered: PostgreSQL provider.

See validation disclosure guidance.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • First viewport and preview: N/A
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A
  • Craft review: N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference, when applicable: Core control-plane hardening.

Shared-authority RFC fixture impact

N/A

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • Existing English/Chinese RFC pairs (including ledger entries) both have a diff, and the local premerge check python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD passes, or no paired RFC changed.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

🤖 Generated with Claude Code

…on on hard_lease goals

A User action can never acquire an execution lease, so on a multi-agent
hard_lease goal the only lease-exempt terminal path was for the exact
bound agent. A goal-wide reminder (no bound agent) was refused with
handoff_mode_requires_lease for every actor and actor_required without
one, leaving it impossible to complete or supersede.

Treat a goal-wide User action like a bound one: any registered,
non-excluded actor may complete it as an administrative lifecycle edit.
Active holders and explicit fences are still never bypassed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Wang, Xiang-Han <wanghank00@gmail.com>
Copilot AI balanced review requested due to automatic review settings December 6, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@BigDataDZ BigDataDZ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

独立评审(native Windows)——APPROVE

精确核对 head:cdfb0a9c4。

代码:terminalFence() 的租约豁免管理性关闭从"精确绑定 Actor"扩展到"goal-wide(bound_agent === null)+ 任意注册非排除 Actor"。安全性栅栏全部保留(注册门 ownerIdentityEligible、排除表、非委托、非时间活跃、无显式栅栏、仅 complete、hard_lease、User action 不可持租约——不写租约、lease_fence=not_required)。TS 拒绝表里移除的恰是与新规则直接矛盾的旧行(bound_agent: null → handoff_mode_requires_lease),其余负面行(未注册、绑定不匹配、排除者、supersede、过期栅栏)全部保留——诚实处理,没有靠删负面测试过关。

实测(Windows 10 / Python 3.12 / Node 24.20)

  • tests/control_plane_ts/todo_terminal_decision.test.ts → 21 passed / 0 failed(含更新后的拒绝矩阵)。
  • tests/control_plane/test_canonical_handoff_invariants.py -k "user_action or goal_bound" → 4 passed(绑定旧例双 provider + 新 goal-wide 例双 provider:任意注册 Agent 关闭、lease_fence=not_required、零租约、状态 done)。

CI 信号(该 head 的分片真实运行了)

  • 分片 1–5:零断言失败,全部为 ~54 分钟会话上限截断(数千用例通过)——即 #9567 的时限问题,非本 PR。
  • 分片 6:2 个失败(agy 归档回滚、Lark 并发 BrokenBarrier 竞态),均不在本 PR 域。
  • 本 PR 自身的两个测试文件在本机与 CI 侧均绿。

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants