mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
tasks: add --agent mode to create-task-worktree.sh to spawn codex agent in task workspace
This commit is contained in:
@@ -25,9 +25,16 @@ Tasks live under `agentydragon/tasks/` as individual Markdown files. Please upda
|
||||
### Branch & Worktree Workflow
|
||||
|
||||
- **Branch convention**: work on each task in its own branch named `agentydragon/<task-id>-<task-slug>`.
|
||||
- **Worktree helper**: run `create-task-worktree.sh <task-id>-<task-slug>`
|
||||
in `agentydragon/tasks/` to create or reuse a worktree at
|
||||
`agentydragon/tasks/.worktrees/<task-id>-<task-slug>` off the `master` branch.
|
||||
- **Worktree helper**: in `agentydragon/tasks/`, run:
|
||||
-
|
||||
- ```sh
|
||||
- create-task-worktree.sh [--agent] <task-id>-<task-slug>
|
||||
- ```
|
||||
-
|
||||
- Without `--agent`, this creates or reuses a worktree at
|
||||
- `agentydragon/tasks/.worktrees/<task-id>-<task-slug>` off the `master` branch.
|
||||
- With `--agent`, after setup it launches a Codex agent in that workspace,
|
||||
- preloaded to work on the specified task from its Markdown file.
|
||||
|
||||
---
|
||||
|
||||
|
||||
39
agentydragon/tasks/14-ai-generated-approval-predicates.md
Normal file
39
agentydragon/tasks/14-ai-generated-approval-predicates.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Task 14: AI‑Generated Approval Predicate Suggestions
|
||||
|
||||
> *This task is specific to codex-rs.*
|
||||
|
||||
## Status
|
||||
|
||||
**General Status**: Not started
|
||||
**Summary**: Not started; missing Implementation details (How it was implemented and How it works).
|
||||
|
||||
## Goal
|
||||
|
||||
When a shell command is not auto-approved, the approval prompt should include 1–3 AI-generated approval predicates. Each suggestion is a time-limited Python predicate snippet plus an explanation of the full set of permissions it would grant. Users can pick one suggestion to append to the session’s approval policy as a broader-scope allow rule.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- When a command is not auto-approved, show up to 3 suggested predicates inline in the TUI approval dialog.
|
||||
- Each suggestion consists of:
|
||||
- A Python code snippet defining a predicate function.
|
||||
- An AI-generated explanation of exactly what permissions or scope that predicate grants.
|
||||
- A TTL or expiration timestamp indicating how long it will remain active.
|
||||
- Users can select one suggestion to append to the session’s list of approval predicates.
|
||||
- Predicates are stored in session state (in-memory) for the duration of the session.
|
||||
- Provide a slash/CLI command (`/inspect-approval-predicates`) to list current predicates, their code, explanations, and timeouts.
|
||||
- Support headless and interactive modes equally.
|
||||
|
||||
## Implementation
|
||||
|
||||
**How it was implemented**
|
||||
*(Not implemented yet)*
|
||||
|
||||
**How it works**
|
||||
*(Not implemented yet)*
|
||||
|
||||
## Notes
|
||||
|
||||
- Reuse the existing AI reasoning engine to generate predicate suggestions.
|
||||
- Represent predicates as Python functions returning a boolean.
|
||||
- Ensure that expiration is enforced and stale predicates are ignored.
|
||||
- Integrate the new `/inspect-approval-predicates` command into both the TUI and Exec CLI.
|
||||
@@ -7,8 +7,26 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
agent_mode=false
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-a|--agent)
|
||||
agent_mode=true
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 [-a|--agent] <task-id>-<task-slug>"
|
||||
echo " -a, --agent after creating/reusing, launch a codex agent in the task workspace"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <task-id>-<task-slug>"
|
||||
echo "Usage: $0 [-a|--agent] <task-id>-<task-slug>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -38,4 +56,10 @@ else
|
||||
echo "Worktree for $branch already exists at $worktree_path"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
echo "Done."
|
||||
|
||||
if [ "$agent_mode" = true ]; then
|
||||
echo "Launching codex agent for task $task_slug in $worktree_path"
|
||||
cd "$worktree_path"
|
||||
codex "Read the task definition in agentydragon/tasks/$task_slug.md and update its **Status** and **Implementation** sections to make progress on the task. Continue editing the file until the task is complete."
|
||||
fi
|
||||
Reference in New Issue
Block a user