Skip to content

🤖 Task launch: count only other backends' leases when dropping a kept brief (#5544 follow-up) #5588

Description

@ThomasK33

Problem

Follow-up from #5581 (fix for #5544), from the normal review of its head 674dc20 (review thread on dropKeptTaskPromptAlreadyInHistory).

#5581 keeps a kept sub-agent brief while any backend holds a turn use lease on the task, so another backend's in-flight reawakening, whose row a Stop can still roll back, never counts as proof. The check (isHeld(taskId, "turn")) also counts this backend's own lease. AgentSession starts that lease's release without awaiting it before the send returns. If the user retries right after a reawakening send that wrote its row and then returned Err, the lease can still look held. The kept brief then stays, and the next reawakening sends it again. The result is a duplicate, never a loss, and it is no worse than before #5581.

Fix (ready, not merged)

Branch fix/5544-foreign-lease-narrowing, commit f16e62c, on top of the #5581 head. The check counts only other backends' leases (findForeignUse). This backend's reawakenings already hold the event and tree locks that the drop runs under, so its own lease adds nothing. The commit adds an ownTurnReleasing test variant, which fails without the change, and moves the roll-back variant's spy to findForeignUse. Size: +20/-15. Rebase it onto main once #5581 merges, then open it as a PR.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions