Proposal: improve pr-ci-test-fixer — remove contradictory clone creation code block that conflicts with "use provided directory" instruction #8048

Open
opened 2026-04-13 01:28:22 +00:00 by HAL9000 · 0 comments
Owner

Agent Improvement Proposal

Pattern Detected

Type: prompt_improvement
Affected Agent: pr-ci-test-fixer
Category: Capability gap — agent definition contains contradictory instructions that could cause unnecessary clone creation
Evidence: Direct code inspection of .opencode/agents/pr-ci-test-fixer.md, lines 47-84.

Problem Description

The pr-ci-test-fixer agent definition contains a contradictory "Clone Isolation Protocol" section (lines 47-84):

The text says:

"When invoked by implementation-worker, a working directory is provided — this is the worker's existing clone. Use it directly. Do NOT create a new clone."

But then immediately shows a full clone creation code block:

INSTANCE_ID="pr-ci-test-fixer-<PR_NUMBER>-$$-$(date +%s)"
CLONE_DIR="/tmp/${INSTANCE_ID}"

# Clone
git clone https://<FORGEJO_PAT>@<host>/<owner>/<repo>.git "$CLONE_DIR"
...

Then says:

"If somehow invoked without a working directory, that is an error condition - report the error and exit."

This is a three-way contradiction:

  1. "Use the provided directory, don't create a new clone"
  2. Shows clone creation code (implying it should be used)
  3. "If no directory provided, that's an error — exit"

The clone creation code block is shown but should never be executed (per rule 1 and rule 3). However, an LLM reading this agent definition may interpret the code block as instructions to follow, potentially creating unnecessary clones that:

  • Waste time (git clone of a large repo)
  • Waste disk space
  • May conflict with the implementation-worker's existing clone
  • Create orphaned /tmp/ directories if cleanup fails

Proposed Change

Remove the contradictory clone creation code block entirely, since it should never be used. Replace with a clear, unambiguous instruction:

## Clone Isolation Protocol

**CRITICAL: You MUST use the working directory provided by `implementation-worker`.**

The `implementation-worker` passes its existing clone as `working_directory`. Use this path directly for all git operations. **NEVER create a new clone.**

If no `working_directory` is provided, this is an error condition — post an error comment on the PR and exit immediately. Do NOT attempt to create your own clone.

```bash
# Verify the working directory exists and is a valid git repo
if [ ! -d "$working_directory/.git" ]; then
    echo "ERROR: Invalid working directory: $working_directory"
    exit 1
fi

# Configure git identity in the provided directory
cd "$working_directory"
git config user.name "<GIT_USER_NAME>"
git config user.email "<GIT_USER_EMAIL>"

CLEANUP: Do NOT delete the working directory — it belongs to the implementation-worker.


### Expected Impact

- Eliminates ambiguity about when/whether to create a clone
- Prevents accidental unnecessary clone creation
- Reduces disk usage and time waste from redundant clones
- Makes the agent's behavior more predictable and consistent

### Risk Assessment

**Risk level: Very Low**

- The change removes code that should never be executed anyway
- The remaining instructions are clearer and more explicit
- No functional behavior changes — the agent still uses the provided working directory
- The error handling path (no working directory) is preserved

---
*This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the `needs feedback` label, add `State/Verified`, or comment with approval.*

---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolution | Agent: agent-evolution-pool-supervisor
## Agent Improvement Proposal ### Pattern Detected **Type**: prompt_improvement **Affected Agent**: `pr-ci-test-fixer` **Category**: Capability gap — agent definition contains contradictory instructions that could cause unnecessary clone creation **Evidence**: Direct code inspection of `.opencode/agents/pr-ci-test-fixer.md`, lines 47-84. ### Problem Description The `pr-ci-test-fixer` agent definition contains a contradictory "Clone Isolation Protocol" section (lines 47-84): **The text says:** > "When invoked by `implementation-worker`, a working directory is provided — this is the worker's existing clone. Use it directly. Do NOT create a new clone." **But then immediately shows a full clone creation code block:** ```bash INSTANCE_ID="pr-ci-test-fixer-<PR_NUMBER>-$$-$(date +%s)" CLONE_DIR="/tmp/${INSTANCE_ID}" # Clone git clone https://<FORGEJO_PAT>@<host>/<owner>/<repo>.git "$CLONE_DIR" ... ``` **Then says:** > "If somehow invoked without a working directory, that is an error condition - report the error and exit." This is a three-way contradiction: 1. "Use the provided directory, don't create a new clone" 2. Shows clone creation code (implying it should be used) 3. "If no directory provided, that's an error — exit" The clone creation code block is shown but should never be executed (per rule 1 and rule 3). However, an LLM reading this agent definition may interpret the code block as instructions to follow, potentially creating unnecessary clones that: - Waste time (git clone of a large repo) - Waste disk space - May conflict with the implementation-worker's existing clone - Create orphaned `/tmp/` directories if cleanup fails ### Proposed Change Remove the contradictory clone creation code block entirely, since it should never be used. Replace with a clear, unambiguous instruction: ```markdown ## Clone Isolation Protocol **CRITICAL: You MUST use the working directory provided by `implementation-worker`.** The `implementation-worker` passes its existing clone as `working_directory`. Use this path directly for all git operations. **NEVER create a new clone.** If no `working_directory` is provided, this is an error condition — post an error comment on the PR and exit immediately. Do NOT attempt to create your own clone. ```bash # Verify the working directory exists and is a valid git repo if [ ! -d "$working_directory/.git" ]; then echo "ERROR: Invalid working directory: $working_directory" exit 1 fi # Configure git identity in the provided directory cd "$working_directory" git config user.name "<GIT_USER_NAME>" git config user.email "<GIT_USER_EMAIL>" ``` **CLEANUP:** Do NOT delete the working directory — it belongs to the `implementation-worker`. ``` ### Expected Impact - Eliminates ambiguity about when/whether to create a clone - Prevents accidental unnecessary clone creation - Reduces disk usage and time waste from redundant clones - Makes the agent's behavior more predictable and consistent ### Risk Assessment **Risk level: Very Low** - The change removes code that should never be executed anyway - The remaining instructions are clearer and more explicit - No functional behavior changes — the agent still uses the provided working directory - The error handling path (no working directory) is preserved --- *This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the `needs feedback` label, add `State/Verified`, or comment with approval.* --- **Automated by CleverAgents Bot** Supervisor: Agent Evolution | Agent: agent-evolution-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8048
No description provided.