mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
wip
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
# Task 04 Plan: Auto‑Mount Entire Repo & Auto‑CD
|
||||
|
||||
> *This task is specific to codex-rs.*
|
||||
|
||||
## Status
|
||||
|
||||
**General Status**: Not started
|
||||
**Summary**: Planning phase; missing Implementation details (How it was implemented and How it works).
|
||||
|
||||
We’ll break Task 04 into discrete subtasks so we can implement, review, and test each part in isolation:
|
||||
|
||||
## Subtasks
|
||||
|
||||
### 04.1 – Config → `ConfigToml` + `Config`
|
||||
- Add `auto_mount_repo: bool` and `mount_prefix: String` to `ConfigToml` (with proper `#[serde(default)]` and defaults).
|
||||
- Wire these fields through to the `Config` struct.
|
||||
|
||||
### 04.2 – Git root detection + relative‐path
|
||||
- Implement a helper in `codex_core::util` to locate the Git repository root given a starting `cwd`.
|
||||
- Compute the sub‐directory path relative to the repo root.
|
||||
|
||||
### 04.3 – Bind‑mount logic
|
||||
- In the sandbox startup path (`apply_sandbox_policy_to_current_thread` or a new wrapper before it), if `auto_mount_repo` is set:
|
||||
- Bind‑mount `repo_root` → `mount_prefix` (e.g. `/workspace`).
|
||||
- Create target directory if missing.
|
||||
|
||||
### 04.4 – Automate `cwd` → new mount
|
||||
- After mounting, update the process‐wide `cwd` to `mount_prefix/relative_path` so all subsequent file ops occur under the mount.
|
||||
|
||||
### 04.5 – Config docs & tests
|
||||
- Update `config.md` to document `auto_mount_repo` and `mount_prefix` under the top‐level config.
|
||||
- Add unit tests for the Git‐root helper and default values.
|
||||
|
||||
### 04.6 – E2E manual verification
|
||||
- Manually verify launching with `auto_mount_repo = true` in a nested subfolder:
|
||||
- TTY prompt shows sandboxed cwd under `/workspace/<subdir>`.
|
||||
- Commands executed by Codex see the mount.
|
||||
|
||||
## Next steps
|
||||
Please review the plan above. If it looks good, I’ll implement the subtasks in order.
|
||||
|
||||
## Implementation
|
||||
|
||||
**How it was implemented**
|
||||
*(Not implemented yet)*
|
||||
|
||||
**How it works**
|
||||
*(Not implemented yet)*
|
||||
@@ -10,10 +10,34 @@ last_updated = "2025-06-25T01:40:09.800000"
|
||||
|
||||
> *This task is specific to codex-rs.*
|
||||
|
||||
## Status
|
||||
## Subtasks
|
||||
|
||||
**General Status**: Not started
|
||||
**Summary**: Not started; missing Implementation details (How it was implemented and How it works).
|
||||
Subtasks to implement in order all in one P:
|
||||
|
||||
### 04.1 – Config → `ConfigToml` + `Config`
|
||||
- Add `auto_mount_repo: bool` and `mount_prefix: String` to `ConfigToml` (with proper `#[serde(default)]` and defaults).
|
||||
- Wire these fields through to the `Config` struct.
|
||||
|
||||
### 04.2 – Git root detection + relative‐path
|
||||
- Implement a helper in `codex_core::util` to locate the Git repository root given a starting `cwd`.
|
||||
- Compute the sub‐directory path relative to the repo root.
|
||||
|
||||
### 04.3 – Bind‑mount logic
|
||||
- In the sandbox startup path (`apply_sandbox_policy_to_current_thread` or a new wrapper before it), if `auto_mount_repo` is set:
|
||||
- Bind‑mount `repo_root` → `mount_prefix` (e.g. `/workspace`).
|
||||
- Create target directory if missing.
|
||||
|
||||
### 04.4 – Automate `cwd` → new mount
|
||||
- After mounting, update the process‐wide `cwd` to `mount_prefix/relative_path` so all subsequent file ops occur under the mount.
|
||||
|
||||
### 04.5 – Config docs & tests
|
||||
- Update `config.md` to document `auto_mount_repo` and `mount_prefix` under the top‐level config.
|
||||
- Add unit tests for the Git‐root helper and default values.
|
||||
|
||||
### 04.6 – E2E manual verification
|
||||
- Manually verify launching with `auto_mount_repo = true` in a nested subfolder:
|
||||
- TTY prompt shows sandboxed cwd under `/workspace/<subdir>`.
|
||||
- Commands executed by Codex see the mount.
|
||||
|
||||
## Goal
|
||||
Allow users to enable a flag so that each session:
|
||||
|
||||
@@ -5,6 +5,7 @@ check_tasks.py: Run all task-directory validation checks in one go.
|
||||
- Detect circular dependencies among non-merged tasks.
|
||||
- Enforce only .md files under agentydragon/tasks/ (excluding .worktrees/ and .done/).
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -23,6 +24,19 @@ def skip_path(p: Path) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def iter_task_markdown() -> Path:
|
||||
"""Yield all task markdown files under agentydragon/tasks, pruning .worktrees and .done dirs."""
|
||||
wt = worktree_dir()
|
||||
done = task_dir() / ".done"
|
||||
root = task_dir()
|
||||
for base, dirs, files in os.walk(str(root)):
|
||||
# do not descend into .worktrees or .done
|
||||
dirs[:] = [d for d in dirs if (Path(base) / d) not in (wt, done)]
|
||||
for fn in files:
|
||||
if re.fullmatch(r"[0-9]{2}-.*\.md", fn):
|
||||
yield Path(base) / fn
|
||||
|
||||
|
||||
def check_file_types():
|
||||
failures: list[Path] = []
|
||||
for p in task_dir().iterdir():
|
||||
@@ -35,10 +49,7 @@ def check_file_types():
|
||||
|
||||
def check_frontmatter():
|
||||
failures: list[tuple[Path, str]] = []
|
||||
wt = worktree_dir()
|
||||
for md in task_dir().rglob("[0-9][0-9]-*.md"):
|
||||
if skip_path(md):
|
||||
continue
|
||||
for md in iter_task_markdown():
|
||||
try:
|
||||
load_task(md)
|
||||
except Exception as e:
|
||||
@@ -49,10 +60,7 @@ def check_frontmatter():
|
||||
def check_cycles():
|
||||
merged = set()
|
||||
deps_map: dict[str, list[str]] = {}
|
||||
wt = worktree_dir()
|
||||
for md in task_dir().rglob("[0-9][0-9]-*.md"):
|
||||
if skip_path(md):
|
||||
continue
|
||||
for md in iter_task_markdown():
|
||||
meta, _ = load_task(md)
|
||||
if meta.status == "Merged":
|
||||
merged.add(meta.id)
|
||||
|
||||
@@ -77,19 +77,17 @@ def main(agent, tmux_mode, interactive, shell_mode, task_inputs):
|
||||
|
||||
wt_root.mkdir(parents=True, exist_ok=True)
|
||||
if not wt_path.exists():
|
||||
# --- COW hydration logic ---
|
||||
# --- COW hydration logic via rsync ---
|
||||
# Instead of checking out files normally, register the worktree empty and then
|
||||
# perform a filesystem-level reflink of tracked + untracked files for near-instant setup.
|
||||
# On macOS/APFS this uses `cp -cRp` (clonefile); on Linux we pass `--reflink=auto`.
|
||||
# perform a filesystem-level hydration via rsync (with reflink if supported) for
|
||||
# near-instant setup while excluding VCS metadata and other worktrees.
|
||||
run(['git', 'worktree', 'add', '--no-checkout', str(wt_path), branch])
|
||||
src = str(repo_root())
|
||||
dst = str(wt_path)
|
||||
# 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()))
|
||||
# Hydrate the worktree filesystem via rsync, excluding .git and any .worktrees to avoid recursion
|
||||
rsync_cmd = [
|
||||
'rsync', '-a', '--delete', f'{src}/', f'{dst}/',
|
||||
'--exclude=.git*', f'--exclude={worktrees_rel}'
|
||||
'--exclude=.git*', '--exclude=.worktrees/'
|
||||
]
|
||||
if sys.platform != 'darwin':
|
||||
rsync_cmd.insert(3, '--reflink=auto')
|
||||
|
||||
Reference in New Issue
Block a user