Skip to content

Sonny: the lead picks a task's folder: shared, a repository's worktree, or its own - #409

Merged
lydakis merged 15 commits into
mainfrom
claude/project-thread-5nccau
Oct 30, 2026
Merged

lydakis merged 15 commits into
mainfrom
claude/project-thread-5nccau

Conversation

@lydakis

@lydakis lydakis commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Why

A lead whose folder is not a git repository, such as a workspace folder holding several repositories, started every task in its real folder, with no say in it. task::worktree only checked the lead's own folder, and lead.md told the lead each task gets a worktree.

Per-repo worktrees, a copy-on-write clone of the workspace, and create/remove hooks were all considered and rejected. The lead knows the work and the person's tooling (often from memory), so it chooses each task's folder.

What

start_task gives the lead three choices, and every start result says which one the task got:

  • Default: in a git repo, a worktree, as before. Outside git, the task works in the lead's folder itself, shared, and is told so. That's what Claude Code and Codex do outside git, and it fits work on the files that are there (documents, packages).
  • folder: a folder inside the lead's, in a git repository it holds. The task gets a worktree of that repository and works at that folder in it. It is told the rules of the folders above it too, and takes its roles from the lead's folder. lead.md leans toward this for any task that changes a repository, so tasks can try things in parallel. Refused when:
    • the folder is outside the lead's folder, or not in a work tree;
    • the repository keeps its git folder outside the lead's folder;
    • the task's folder in the worktree is a committed link leading out of it.
  • own_folder: an empty folder of the task's own at ~/.agent/worktrees/NAME, recorded as own in ~/.agent/worktrees/.folders/NAME. The task makes there what it works in, such as a workspace on another branch made with the folder's tooling, and reads the lead's folder where it is. It is told the lead folder's rules and memory. Its memory tool and the nightly cleanup's said attribute it to the lead's project.

Setup is always the lead folder's own .agents/setup, never a script inside a nested repository.

remove_task:

  • A worktree, including one of a nested repository, is removed with the same checks as before, through the checkout it was made from. Its branch is deleted in its own repository.
  • An own folder is removed only with discard, after the lead asks the task whether its work is pushed. Sonny never runs git in repositories a task made (Codex security review: their config, such as core.fsmonitor, would run as the person outside the sandbox).

Text updated: lead.md, task.md, the project's task rule, the tool descriptions, and the Tasks row in sonny/FEATURES.md.

Not in this PR

Tests

End-to-end tests in sonny/tests/task.rs:

  • Shared vs own folder: the shared default, the own folder, instructions from the lead's folder, and the name refused from another folder.
  • Own folder removal: removed only with discard. A task-made repo with core.fsmonitor, at the folder's top, checks that nothing runs, and removal from another folder is refused.
  • Repository given as folder:
    • gets a worktree, the workspace rules and the lead's roles, with the brief rewritten to the copy;
    • only the lead's setup runs;
    • refused: ../, a plain folder, .git/hooks, a committed link out;
    • removed from the lead's folder.
  • Linked checkouts and submodules: a linked checkout whose repository is outside the lead's folder is refused, one inside starts and is removed, and a lead in a submodule removes its task.

Locally, cargo fmt --check, cargo clippy --workspace --all-targets -D warnings and cargo test --workspace pass.

🤖 Generated with Claude Code

A lead whose folder is not a git repository, such as a workspace holding
several repositories, started every task in its real folder: no worktree,
no branch, and the lead was told each task had a worktree. Now such a task
gets an empty folder of its own beside the worktrees, makes there what it
works in (a workspace made with the folder's tooling, as its brief says),
and reads the lead's folder where it is. It is told the lead's folder's
rules and memory, and its memory tool saves to the lead's project.

remove_task deletes that folder once every repository in it has nothing
uncommitted or unpushed. lead.md, task.md, the project rule and the tool
descriptions say where a task works, and every start says so in its
result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc
@lydakis lydakis self-assigned this Oct 30, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T05:13:23.021266Z a9c3fd8 New commits
🔒 Security Review ✅ Completed 2026-10-30T05:13:26.774811Z a9c3fd8 New commits

Security findings

Advisory findings (6)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d296882d47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/task.rs Resolved
Comment thread sonny/src/task.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: d296882d47

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
…e or its own

Outside git a task now shares the lead's folder by default, as before but
said so, since work there is often on the files there. start_task's
`folder` names a folder inside the lead's, such as a repository it holds,
whose worktree the task gets, told the rules of the folders above it too;
`own_folder` gives the empty folder. lead.md leans to a worktree for a task
that changes a repository, so tasks can try things in parallel.

Codex review: commits on a detached HEAD count as unpushed when removing a
task's own folder, and the person's words in such a task are attributed
to the lead's project for memory cleanup.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc
Codex security review: a task can write the settings of a repository it
made in its own folder, such as core.fsmonitor, which git runs as the
person, outside the task's sandbox, when remove_task checked it with git
status. Sonny now runs nothing there: a task's own folder is removed only
with discard, once the task says its work is pushed, as lead.md and the
tool say. The fsmonitor test checks that nothing runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc
@lydakis lydakis changed the title Sonny: outside git, a task gets an empty folder of its own Sonny: the lead picks a task's folder: shared, a repository's worktree, or its own Oct 30, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e51391e2e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/task.rs Resolved
Comment thread sonny/src/task.rs Resolved
Codex review:
- A task given a repository inside the lead's folder is told the lead's
  project memory, and is recorded like an own folder, so its memory tool
  and the cleanup's `said` save to the lead's project, even when the
  repository's folder is in no project.
- remove_task finds a worktree's repository by the git folder it shares
  with the lead's, as a submodule's is, or by the main checkout git lists
  for it inside the lead's folder, rather than a git folder named .git.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e37f1bfc9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/task.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 0e37f1bfc9

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
…s top

Sonny records that it gave the task an empty folder of its own, so a
repository the task makes there is never taken for a worktree: remove_task
still removes it with discard, runs no git in it, and a task of the same
name started elsewhere is not given it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b12617ba33

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/task.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: b12617ba33

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
…nny recorded

The record of a task given a folder now holds the checkout its worktree
was made from, so remove_task uses it rather than requiring the
repository's main checkout to be inside the lead's folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc
…the repository's

A repository inside the lead's folder has its .agents no more kept from
the lead's sandbox than the rest of it, and setup runs outside any: so the
script is always the lead's folder's own, which the sandbox keeps, with
AGENT_SOURCE naming the repository's checkout.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 3068abe609

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
A folder in no repository fell back to the task working in it in place,
so a folder git keeps, such as .git/hooks, could become a task's writable
folder, deeper than what keeps it read-only. A task given a folder only
ever gets a worktree of the repository there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: c845ed51b5

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
Whatever a folder named when it was checked, the worktree made from it
must be of a repository whose git folder is inside the lead's folder,
which the task is then given to write: a link swapped in since, or a .git
file naming a repository elsewhere, is refused and its worktree undone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 3e027143ed

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread sonny/src/task.rs Resolved
A folder the last commit has as a link out of the repository, whatever
the lead's checkout has there now, would make the task's folder wherever
the link leads; the start is refused and the worktree undone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 283290ee9c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/served.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf128b4220

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/task.rs Resolved
…'s roles

Codex review: a task given folder was told the rules of the repository's
folder, and its roles were looked for there too, so a profile the lead's
project defines, its task profile included, was not found and the start
failed. Roles now come from the lead's folder, as the project info that
names them does; the rules still come from where the task works.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGCrDV3wjc6rUfmxAoc
@lydakis
lydakis merged commit dd039b0 into main Oct 30, 2026
4 checks passed
lydakis pushed a commit that referenced this pull request Oct 30, 2026
A fork of a task Sonny recorded, made in the same repository, is recorded
as it is, so the lead that started it removes it there; a fork takes
neither folder nor own_folder; snapshots are dropped in the task's own
repository.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013jkdGFna3t1d4P7QjNa2CQ
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.

2 participants