richardcase / richardcase/clowder

Serialize agent Land and Discard lifecycle operations

Open
#130 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority: critical rust
Dominant language
Rust
Stars
0
Forks
0
Avg merge
1h 14m
Merged PRs (30d)
16

Description

Problem

Land and Discard can run concurrently for the same agent. Both enter finish_agent without a per-agent lifecycle lock, so Discard may remove the worktree or branch while Land is staging or committing.

Evidence: https://github.com/richardcase/clowder/blob/b5492d5/crates/clowder-daemon/src/server.rs#L816-L887

Impact

Uncommitted agent work can be destroyed, and the registry/UI can be left inconsistent.

Acceptance criteria

  • Atomically claim an agent lifecycle operation and reject conflicting duplicate requests.
  • Keep state transitions consistent when the driver fails.
  • Add a regression test that races Land and Discard and proves only one operation can finalize the agent.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/clowder-daemon/src/server.rs around finish_agent at lines 816-887, then trace the Land and Discard request paths and their state transitions. Add a regression test that races both operations, verifies conflicting requests are rejected, and proves only one operation finalizes the agent, including driver-failure behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
backend, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.