runAgent integration — swap mkdtemp+clone for worktree #5
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
User story
As a worker, I want
runAgentto acquire a persistent worktree from the workdir module instead of cloning into a freshmkdtempdirectory each task, so that Forgejo is no longer re-cloned per dispatch and worktree state carries across turns for the same(agent, branch).Acceptance criteria
runAgentrewrite (src/main.ts)mkdtemp(...)+git cloneblock(agent.branch_prefix, issue_number)to match the skill template (e.g.boss/4-event-sourcing); document the derivation in a single helperacquireWorktree(repo, agent, branch)to get the workdirgitIdentityEnv(agent)+gitAuthEnv(agent)intoquery({ env })finally { rm(workdir, ...) }block withreleaseWorktree(repo, agent, branch, { keep: true })releaseWorktree({ keep: false })for each agentgit config user.name/user.emailsetup commands inrunAgentare removed (env vars now own this)Smoke / integration check
releaseWorktree({ keep: false })runs and the directory is goneFailure handling
acquireWorktreethrows, the task fails fast with a useful error in the dashboard event stream (not a silent retry loop)Out of scope
References
Dependencies
issue-3-workdir-module(rebase #4 on top via cherry-pick, or wait for both to merge)