mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
wip
This commit is contained in:
@@ -31,7 +31,8 @@ def resolve_slug(input_id: str) -> str:
|
||||
@click.option('-a', '--agent', is_flag=True,
|
||||
help='Launch Developer Codex agent after setting up worktree.')
|
||||
@click.option('-t', '--tmux', 'tmux_mode', is_flag=True,
|
||||
help='Open each task in its own tmux pane; implies --agent.')
|
||||
help='Open each task in its own tmux pane; implies --agent. '
|
||||
'Attaches to an existing session if already running.')
|
||||
@click.option('-i', '--interactive', is_flag=True,
|
||||
help='Run agent in interactive mode (no exec); implies --agent.')
|
||||
@click.option('-s', '--shell', 'shell_mode', is_flag=True,
|
||||
@@ -45,6 +46,12 @@ def main(agent, tmux_mode, interactive, shell_mode, task_inputs):
|
||||
if tmux_mode:
|
||||
agent = True
|
||||
session = 'agentydragon_' + '_'.join(task_inputs)
|
||||
# If a tmux session already exists, skip setup and attach
|
||||
if subprocess.call(['tmux', 'has-session', '-t', session]) == 0:
|
||||
click.echo(f"Session {session} already exists; attaching")
|
||||
run(['tmux', 'attach', '-t', session])
|
||||
return
|
||||
# Create a new session and windows for each task
|
||||
for idx, inp in enumerate(task_inputs):
|
||||
slug = resolve_slug(inp)
|
||||
cmd = [sys.executable, '-u', __file__]
|
||||
@@ -77,24 +84,17 @@ def main(agent, tmux_mode, interactive, shell_mode, task_inputs):
|
||||
run(['git', 'worktree', 'add', '--no-checkout', str(wt_path), branch])
|
||||
src = str(repo_root())
|
||||
dst = str(wt_path)
|
||||
if sys.platform == 'darwin':
|
||||
reflink_cmd = [
|
||||
'cp', '-cRp', f'{src}/.', f'{dst}/',
|
||||
'--exclude=.git', '--exclude=.gitlink'
|
||||
]
|
||||
else:
|
||||
reflink_cmd = [
|
||||
'cp', '--reflink=auto', '-Rp', f'{src}/.', f'{dst}/',
|
||||
'--exclude=.git', '--exclude=.gitlink'
|
||||
]
|
||||
try:
|
||||
run(reflink_cmd)
|
||||
except subprocess.CalledProcessError:
|
||||
# Fallback on filesystems without reflink support
|
||||
run([
|
||||
'rsync', '-a', '--delete', f'{src}/', f'{dst}/',
|
||||
'--exclude=.git*'
|
||||
])
|
||||
# Hydrate the worktree filesystem excluding .git and other worktrees to avoid recursion
|
||||
# Use rsync with reflink if possible
|
||||
worktrees_rel = str(worktrees_dir().relative_to(repo_root()))
|
||||
rsync_cmd = [
|
||||
'rsync', '-a', '--delete', f'{src}/', f'{dst}/',
|
||||
'--exclude=.git*', f'--exclude={worktrees_rel}'
|
||||
]
|
||||
if sys.platform != 'darwin':
|
||||
rsync_cmd.insert(3, '--reflink=auto')
|
||||
run(rsync_cmd)
|
||||
# Install pre-commit hooks in the new worktree
|
||||
if shutil.which('pre-commit'):
|
||||
run(['pre-commit', 'install'], cwd=dst)
|
||||
else:
|
||||
|
||||
@@ -215,7 +215,7 @@ def status():
|
||||
unblocked = [tid for tid in sorted_ids if tid not in merged_ids and not deps_map.get(tid)]
|
||||
if unblocked:
|
||||
print(f"\n\033[1mUnblocked:\033[0m {' '.join(unblocked)}")
|
||||
print(f"\033[1mLaunch unblocked in tmux:\033[0m create-task-worktree.sh --agent --tmux {' '.join(unblocked)}")
|
||||
print(f"\033[1mLaunch unblocked in tmux:\033[0m python agentydragon/tools/create_task_worktree.py --agent --tmux {' '.join(unblocked)}")
|
||||
|
||||
@cli.command()
|
||||
@click.argument('task_id')
|
||||
|
||||
93
codex-orchestration-plan.md
Normal file
93
codex-orchestration-plan.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Codex Orchestration Framework: Plan & Open Questions
|
||||
|
||||
This document collects the high‑level architecture, planned features, and unresolved design decisions for the proposed **codex-agents** orchestration framework.
|
||||
|
||||
## 1. Architecture & Core Components
|
||||
|
||||
- **XDG‑compliant configuration & state**
|
||||
- Repo‑local overrides: `<repo>/.codex-agent/config.toml`
|
||||
- User‑wide config: `$XDG_CONFIG_HOME/codex-agents/config.toml`
|
||||
- Global task registry: `$XDG_DATA_HOME/codex-agents/tasks.json`
|
||||
|
||||
- **CLI & optional TUI**
|
||||
- `codex-agent init` → bootstrap repo (copy prompts, create directories)
|
||||
- `codex-agent status [--tui]` → show global and per‑repo task/merge status
|
||||
- `codex-agent config` → inspect or edit effective config
|
||||
- `codex-agent agents` → view per‑agent instruction overrides
|
||||
|
||||
- **Task management (`codex-agent task`)**
|
||||
- `add`, `list`, `edit`, `worktree add|remove`, `validate`, `review`, `complete`
|
||||
- Interactive AI Q&A flow for `task add` to auto‑populate slug, goal, dependencies, and stub file
|
||||
|
||||
- **Worktree hydration**
|
||||
- OS‑aware reflink: macOS `cp -cRp`, Linux `cp --reflink=auto`, fallback to `rsync`
|
||||
- COW setup via `git worktree add --no-checkout` + hydration step
|
||||
|
||||
- **Merge & Conflict Resolver (`codex-agent merge`)**
|
||||
- `merge check` → dry‑run merge in temp worktree
|
||||
- `merge resolve` → AI‑driven conflict resolution or explicit bail-out
|
||||
- `merge rebase` → manual rebase entrypoint
|
||||
|
||||
- **Code Validator (`codex-agent task validate|review`)**
|
||||
- Run linters/tests, then invoke Validator agent prompt
|
||||
- Enforce configurable policies (doc coverage, style rules, test thresholds)
|
||||
|
||||
- **Project Manager (`codex-agent manager`)**
|
||||
- Wave planning, parallel launch commands, live monitoring of worktrees
|
||||
|
||||
## 2. Phased Roadmap
|
||||
|
||||
Phase | Deliverables
|
||||
:----:|:--------------------------------------------------------------------------------------
|
||||
1 | XDG config + global `tasks.json` + basic `task list|add|worktree` CLI
|
||||
2 | Merge check & conflict-resolver prompt + `merge check|resolve` commands
|
||||
3 | Validator agent integration + `task validate|review`
|
||||
4 | Project Manager planning & launching (`manager plan|launch|monitor`)
|
||||
5 | Interactive `task add` QA loop + per-agent instruction overrides
|
||||
6 | TUI mode for `status` + live dashboard
|
||||
7 | Polishing docs, tests, packaging, and PyPI release
|
||||
|
||||
## 3. Open Questions & Design Decisions
|
||||
|
||||
1. **Global registry schema**
|
||||
- What additional fields should `tasks.json` track? (e.g. priority, owner, labels)
|
||||
|
||||
2. **Config file format & schema**
|
||||
- TOML vs YAML vs JSON for `config.toml`?
|
||||
- Which policy keys to expose for Validator and Resolver agents?
|
||||
|
||||
3. **Per‑agent instruction overrides**
|
||||
- How to structure override files (`validator.toml`, `conflict-resolver.toml`, etc.)?
|
||||
- Should we fallback to AGENTS‑style instruction files in the repo root if present?
|
||||
|
||||
4. **CLI command names & flags**
|
||||
- Confirm subcommand verbs (`merge resolve` vs `task rebase`, `task validate` vs `task lint`)
|
||||
- Standardize flags for interactive vs non‑interactive modes
|
||||
|
||||
5. **Conflict Resolver scope**
|
||||
- Auto‑resolve only trivial hunks, or attempt full rebase‑based AI resolution?
|
||||
- How and when can the agent “give up” and hand control back to the user?
|
||||
|
||||
6. **Validator policies & auto‑fix**
|
||||
- Default policy values (max line length, doc coverage %)
|
||||
- Should `--auto-fix` let the agent rewrite code, or only report issues?
|
||||
|
||||
7. **Interactive Task Creation**
|
||||
- Best UX for prompting the user: CLI Q&A loop vs opening an editor with agent instructions?
|
||||
- How to capture dependencies and inject them into the new task stub?
|
||||
|
||||
8. **Session restore UX**
|
||||
- Always on for `codex session <UUID>`, or opt‑in via flag?
|
||||
- How to surface restore failures or drift in transcript format?
|
||||
|
||||
9. **TUI implementation**
|
||||
- Framework choice (curses, Rich, Textual)
|
||||
- Auto‑refresh interval and keybindings for actions (open worktree, resolve, validate)
|
||||
|
||||
10. **Packaging & distribution**
|
||||
- Final PyPI package name (`codex-agents` vs `ai-orchestrator`)
|
||||
- Versioning strategy and backwards‑compatibility guarantees
|
||||
|
||||
---
|
||||
|
||||
_This plan will evolve as we answer these questions and move through the roadmap phases._
|
||||
Reference in New Issue
Block a user