diff --git a/.opencode/agents/auto-agents.md b/.opencode/agents/auto-agents.md index 4ff2ed60b..470da61f4 100644 --- a/.opencode/agents/auto-agents.md +++ b/.opencode/agents/auto-agents.md @@ -93,16 +93,16 @@ Startup steps: 1. Parse and validate prompt parameters 2. Fallback to environment variables, and fetch needed variables, for any missing settings 3. If any required parameters are still missing or malformed, exit immediately and report the error -4. For each supervisor in the managed list, check whether a session with its tag already exists using `async-agent-util`: - - If no session exists → launch a new one (see "Launching a supervisor" below) - - If a session exists and is healthy → log that it is already running, take no action - - If a session exists but is unhealthy → stop it via `async-agent-util` and launch a fresh one -5. Start the main loop (see section "Main loop"), which must run forever until this process is killed +4. For each supervisor in the managed list, check whether a session with its tag already exists using `async-agent-util` and stop it if its busy, then delete the session, again using `async-agent-util` to carry this out. +5. For each supervisor in the managed list, bring up the agent via `async-agent-util`. + + +**CRITICAL:** After the startup sequence above completes successfully immediately start the main loop (see section "Main loop"), which must run forever until this process is killed. Do **not** under any circumstances stop to summerize or pause for further instructions, and do not ask questions. ### Main loop -1. Call `bash("sleep 300", timeout=360000)` — wait 5 minutes -2. For each supervisor in the managed list, perform a health check cycle (see "Health check cycle" below) +1. Load the skill `auto-agents-system` and run, via the bash tool, the script named `session_wait_till_supervisor_idle` from the one of the launched supervisors to become idle. Ensure when calling `session_wait_till_supervisor_idle` that you set the `--expected-supervisors` argument to the number of supervisors in the managed list, and `--timeout` to `{idle_interval}`. +2. For each supervisor in the managed list, perform a health check cycle (see "Health check cycle" below), ensure before moving on all supervisors have busy sessions and are in a healthy state. 3. Go to step 1 ### Health check cycle diff --git a/.opencode/agents/implementation-supervisor.md b/.opencode/agents/implementation-supervisor.md index 57cee4188..ccc7d29f9 100644 --- a/.opencode/agents/implementation-supervisor.md +++ b/.opencode/agents/implementation-supervisor.md @@ -191,13 +191,17 @@ Invoke the `supervisor` subagent as a blocking call via the Task tool, passing i ##### Prompt construction -Build the supervisor prompt by writing it to `/tmp/imp-supervisor-prompt.txt` using the Write tool. This eliminates variable substitution errors. Construct the file with the following content, substituting your ACTUAL resolved values for each credential line at the top, and the literal static text below unchanged: - -The supervisor reads ALL credentials (Forgejo PAT, URL, owner, repo, git identity) directly from environment variables at startup. Do NOT include credential lines in the prompt — they will be resolved by the supervisor itself. +Build the supervisor prompt by writing it to `/tmp/imp-supervisor-prompt.txt` using the Write tool. This eliminates variable substitution errors. Construct the file with the following content, substituting your **actual** resolved values for each line that has a variable substitution (of the form `{variable}`), using the template below replacing **only** the values marked as `{variable}` leaving all text as literal, non-summarized text. Use the following prompt template to construct your your prompt for the `supervisor` subagent, being sure to substitute `{variable}` with the variables value: ``` +Repository base url: `{forgejo_url}` +Repository owner: `{forgejo_owner}` +Repository name: `{forgejo_repo}` +forgejo pat: `{forgejo_pat}` +forgejo username: `{forgejo_username}` +forgejo password: `{forgejo_password}` tag prefix: `{tag_prefix}` worker tag fetch algorithm: 1. Start by copying the worker tag prefix to the new variable for the worker tag called `worker_tag` @@ -213,7 +217,6 @@ worker parameters: - `work_number`: The PR or issue number to handle - `work_title`: The title of the PR or issue - `escalation_tier`: Always pass `1` — the worker determines the actual tier itself - - `tier_agent`: Always pass `tier-haiku` — the worker determines the actual tier itself - `is_first_attempt`: Always pass `true` — the worker determines this itself by reading comments worker parameter fetch algorithms: @@ -221,18 +224,15 @@ worker parameter fetch algorithms: - `work_number`: Taken directly from the task item (PR or issue number) - `work_title`: Taken directly from the task item (PR or issue title) - `escalation_tier`: Always `1` (the worker's dispatcher mode reads comments and adjusts the tier before forwarding) - - `tier_agent`: Always `tier-haiku` (the worker's dispatcher mode may override this based on estimator results) - `is_first_attempt`: Always `true` (the worker's dispatcher mode determines the actual value) task groups in priority order: `failing_ci_pr`, `request_changes_pr`, `new_issue` each task group's fetch algorithm: - PR scripts are invoked using credentials the supervisor resolved from env vars at startup: `npx --yes tsx .opencode/skills/auto-agents-system/scripts/