mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
wip
This commit is contained in:
@@ -57,8 +57,8 @@ Tasks live under `agentydragon/tasks/` as individual Markdown files. Please upda
|
||||
- **Worktree helper**: in `agentydragon/tasks/`, run:
|
||||
-
|
||||
- ```sh
|
||||
- # Accept a full slug (NN-slug) or two-digit task ID (NN), optionally multiple; use --tmux to open each in a tmux window:
|
||||
- agentydragon/tools/create-task-worktree.sh [--agent] [--tmux] <task-slug|NN> [<task-slug|NN>...]
|
||||
- # Accept a full slug (NN-slug) or two-digit task ID (NN), optionally multiple; --tmux opens each in its own tmux pane and auto-commits each task as its Developer agent finishes:
|
||||
- agentydragon/tools/create_task_worktree.py [--agent] [--tmux] <task-slug|NN> [<task-slug|NN>...]
|
||||
- ```
|
||||
-
|
||||
- Without `--agent`, this creates or reuses a worktree at
|
||||
@@ -66,13 +66,13 @@ Tasks live under `agentydragon/tasks/` as individual Markdown files. Please upda
|
||||
- Internally, the helper uses CoW hydration instead of a normal checkout: it registers the worktree with `git worktree add --no-checkout`, then performs a filesystem-level reflink
|
||||
- of all files (macOS: `cp -cRp`; Linux: `cp --reflink=auto`), falling back to `rsync` if reflinks aren’t supported. This makes new worktrees appear nearly instantly on supported filesystems while
|
||||
- preserving untracked files.
|
||||
- With `--agent`, after setup it runs pre-commit checks (aborting on failure), then launches the Developer Codex agent in that workspace (using `prompts/developer.md` and the task file),
|
||||
- and when the developer agent exits, it automatically runs the Commit agent helper to stage fixes and commit the work.
|
||||
- With `--agent`, after setup it runs pre-commit checks (aborting on failure), then launches the Developer Codex agent (using `prompts/developer.md` and the task file).
|
||||
- After the Developer agent exits, if the task’s **Status** is set to `Done`, it automatically runs the Commit agent helper to stage fixes and commit the work.
|
||||
**Commit agent helper**: in `agentydragon/tasks/`, run:
|
||||
|
||||
```sh
|
||||
# Generate and apply commit(s) for completed task(s) in their worktrees:
|
||||
agentydragon/tools/launch-commit-agent.sh <task-slug|NN> [<task-slug|NN>...]
|
||||
agentydragon/tools/launch_commit_agent.py <task-slug|NN> [<task-slug|NN>...]
|
||||
```
|
||||
|
||||
After the Developer agent finishes and updates the task file, the Commit agent will write the commit message to a temporary file and then commit using that file (`git commit -F`). An external orchestrator can then stage files and run pre-commit hooks as usual. You do not need to run `git commit` manually.
|
||||
|
||||
@@ -5,6 +5,7 @@ create_task_worktree.py: Create or reuse a git worktree for a specific task and
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import click
|
||||
@@ -117,6 +118,17 @@ def main(agent, tmux_mode, interactive, shell_mode, task_inputs):
|
||||
prompt = (repo_root() / 'agentydragon' / 'prompts' / 'developer.md').read_text()
|
||||
taskfile = (tasks_dir() / f'{slug}.md').read_text()
|
||||
run(cmd + [prompt + '\n\n' + taskfile])
|
||||
# After Developer agent exits, if task status is Done, invoke Commit agent to stage and commit changes
|
||||
task_path = tasks_dir() / f"{slug}.md"
|
||||
content = task_path.read_text(encoding='utf-8')
|
||||
m = re.search(r'^status\s*=\s*"([^"]+)"', content, re.MULTILINE)
|
||||
status = m.group(1) if m else None
|
||||
if status and status.lower() == 'done':
|
||||
click.echo(f"Task {slug} marked Done; running Commit agent helper")
|
||||
commit_script = repo_root() / 'agentydragon' / 'tools' / 'launch_commit_agent.py'
|
||||
run([sys.executable, str(commit_script), slug])
|
||||
else:
|
||||
click.echo(f"Task {slug} status is '{status or 'unknown'}'; skipping Commit agent helper")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -44,6 +44,24 @@ def status():
|
||||
all_meta[meta.id] = meta
|
||||
path_map[meta.id] = md
|
||||
|
||||
# If a worktree exists, reload the task from that workspace (including .done paths)
|
||||
repo = repo_root()
|
||||
for tid, md in list(path_map.items()):
|
||||
wt_root_dir = wt_root / md.stem
|
||||
# derive relative path of the task file under the repo
|
||||
try:
|
||||
rel = md.relative_to(repo)
|
||||
except Exception:
|
||||
continue
|
||||
wt_task = wt_root_dir / rel
|
||||
if wt_task.exists():
|
||||
try:
|
||||
wt_meta, _ = load_task(wt_task)
|
||||
all_meta[tid] = wt_meta
|
||||
path_map[tid] = wt_task
|
||||
except Exception as e:
|
||||
print(f"Error loading {wt_task}: {e}")
|
||||
|
||||
# Build dependency graph, excluding already merged tasks
|
||||
merged_ids = {tid for tid, m in all_meta.items() if m.status == 'Merged'}
|
||||
deps_map: dict[str, list[str]] = {}
|
||||
@@ -158,10 +176,16 @@ def status():
|
||||
else:
|
||||
branch_info = f'{b_cnt} behind / {a_cnt} ahead (+{stat or 0}) {conflict}'
|
||||
|
||||
# colorize status/worktree
|
||||
stat_disp = meta.status
|
||||
if meta.status in ('Done', 'Merged'):
|
||||
stat_disp = f"\033[32m{meta.status}\033[0m"
|
||||
# Normalize and colorize status/worktree
|
||||
raw_status = str(meta.status)
|
||||
cls_name = meta.status.__class__.__name__
|
||||
prefix = cls_name + "."
|
||||
if raw_status.startswith(prefix):
|
||||
raw_status = raw_status[len(prefix):]
|
||||
if raw_status in ('Done', 'Merged'):
|
||||
stat_disp = f"\033[32m{raw_status}\033[0m"
|
||||
else:
|
||||
stat_disp = raw_status
|
||||
wt_disp = wt_info
|
||||
if wt_info == 'dirty':
|
||||
wt_disp = f"\033[31m{wt_info}\033[0m"
|
||||
|
||||
Reference in New Issue
Block a user