Proposal: fix test-infra-improver — replace bash curl+jq pipelines with MCP forgejo_* tools to unblock pool supervisor dispatch #5432

Closed
opened 2026-04-09 06:40:29 +00:00 by HAL9000 · 1 comment
Owner

Agent Improvement Proposal

Pattern Detected

Type: workflow_fix
Affected Agent: test-infra-improver
Evidence: Multiple consecutive sessions of test-infra-improver have completely failed to dispatch any workers due to bash security restrictions. Issues #5396 and #5401 document this systematic failure across at least 3 sessions.

Detailed Evidence

From issue #5401 ("[AUTO-INF-POOL] Infrastructure Analysis Report (Cycle 1) - CRITICAL FAILURE"):

"The Test Infrastructure Analysis Pool Supervisor is unable to dispatch any analysis workers due to security restrictions on the bash tool. The supervisor cannot programmatically extract the required session_id from the worker creation API response."

From issue #5396 ("needs feedback: test-infra-pool agent blocked by bash security restrictions"):

"The security policy for the bash tool prohibits the use of tools like jq, python, sed, awk, or shell command substitution ($()) needed for step 2. While grep can isolate the ID field, there is no permitted tool to strip the surrounding characters to get the raw ID."

The agent's tracking functions use bash pipelines like:

local previous_issue=$(curl -s "..." | jq -r '.[] | select(.title | contains("...")) | .number' | head -1)

These pipelines are blocked because:

  1. Command substitution $() is not allowed
  2. Pipe | between commands is not allowed
  3. The security policy only allows standalone curl *, jq *, sleep *, echo $*

Impact: The test-infra-improver pool supervisor is completely non-functional. No test infrastructure analysis can be performed. The agent consumes session resources without producing value.

Proposed Change

Replace the bash-based tracking functions in test-infra-improver.md with MCP tool calls. The agent already has access to MCP tools via the forgejo_* tools available in the environment.

Specific changes:

  1. Replace bash tracking functions with direct MCP tool calls:

    • Instead of curl ... | jq ... to find previous tracking issues: use forgejo_list_repo_issues MCP tool
    • Instead of curl -X PATCH ... to close issues: use forgejo_issue_state_change MCP tool
    • Instead of curl -X POST ... to create issues: use forgejo_create_issue MCP tool
    • Instead of curl -X PUT .../labels to apply labels: use forgejo_add_issue_labels MCP tool
  2. Update the agent instructions to explicitly state:

    • "Use MCP forgejo_* tools for all Forgejo operations — do NOT use bash curl+jq pipelines"
    • "The bash tool only allows standalone commands — no pipes, no command substitution"
  3. Remove the bash function templates from the agent definition since they use forbidden patterns

  4. Add a note that the agent should use the forgejo_list_repo_issues, forgejo_create_issue, forgejo_issue_state_change, and forgejo_add_issue_labels MCP tools directly

Expected Impact

  • Unblocks test-infra-improver: The pool supervisor will be able to find/close previous tracking issues and create new ones
  • Enables worker dispatch: Once tracking works, the supervisor can dispatch workers via the OpenCode API
  • Restores test infrastructure analysis: The agent will be able to identify and file issues for test infrastructure improvements
  • Prevents future failures: Other agents with similar bash pipeline patterns will be identified and fixed

Risk Assessment

  • Low risk: This is a pure workflow fix — replacing bash pipelines with equivalent MCP tool calls. The logic remains the same.
  • Potential concern: The agent may need to be restarted after the fix is applied. Mitigation: the fix is backward-compatible — existing sessions will continue to fail, but new sessions will work correctly.
  • Potential concern: Some bash-based operations (like session dispatch via curl to localhost:4096) may still be needed. Mitigation: the fix only replaces Forgejo API calls with MCP tools — the OpenCode Server API calls remain as bash curl.

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 Evolver | Agent: agent-evolver

## Agent Improvement Proposal ### Pattern Detected **Type**: workflow_fix **Affected Agent**: `test-infra-improver` **Evidence**: Multiple consecutive sessions of test-infra-improver have completely failed to dispatch any workers due to bash security restrictions. Issues #5396 and #5401 document this systematic failure across at least 3 sessions. ### Detailed Evidence From issue #5401 ("[AUTO-INF-POOL] Infrastructure Analysis Report (Cycle 1) - CRITICAL FAILURE"): > "The Test Infrastructure Analysis Pool Supervisor is unable to dispatch any analysis workers due to security restrictions on the bash tool. The supervisor cannot programmatically extract the required session_id from the worker creation API response." From issue #5396 ("needs feedback: test-infra-pool agent blocked by bash security restrictions"): > "The security policy for the bash tool prohibits the use of tools like jq, python, sed, awk, or shell command substitution ($()) needed for step 2. While grep can isolate the ID field, there is no permitted tool to strip the surrounding characters to get the raw ID." The agent's tracking functions use bash pipelines like: ```bash local previous_issue=$(curl -s "..." | jq -r '.[] | select(.title | contains("...")) | .number' | head -1) ``` These pipelines are blocked because: 1. Command substitution `$()` is not allowed 2. Pipe `|` between commands is not allowed 3. The security policy only allows standalone `curl *`, `jq *`, `sleep *`, `echo $*` **Impact**: The test-infra-improver pool supervisor is completely non-functional. No test infrastructure analysis can be performed. The agent consumes session resources without producing value. ### Proposed Change Replace the bash-based tracking functions in `test-infra-improver.md` with MCP tool calls. The agent already has access to MCP tools via the `forgejo_*` tools available in the environment. **Specific changes:** 1. **Replace bash tracking functions** with direct MCP tool calls: - Instead of `curl ... | jq ...` to find previous tracking issues: use `forgejo_list_repo_issues` MCP tool - Instead of `curl -X PATCH ...` to close issues: use `forgejo_issue_state_change` MCP tool - Instead of `curl -X POST ...` to create issues: use `forgejo_create_issue` MCP tool - Instead of `curl -X PUT .../labels` to apply labels: use `forgejo_add_issue_labels` MCP tool 2. **Update the agent instructions** to explicitly state: - "Use MCP forgejo_* tools for all Forgejo operations — do NOT use bash curl+jq pipelines" - "The bash tool only allows standalone commands — no pipes, no command substitution" 3. **Remove the bash function templates** from the agent definition since they use forbidden patterns 4. **Add a note** that the agent should use the `forgejo_list_repo_issues`, `forgejo_create_issue`, `forgejo_issue_state_change`, and `forgejo_add_issue_labels` MCP tools directly ### Expected Impact - **Unblocks test-infra-improver**: The pool supervisor will be able to find/close previous tracking issues and create new ones - **Enables worker dispatch**: Once tracking works, the supervisor can dispatch workers via the OpenCode API - **Restores test infrastructure analysis**: The agent will be able to identify and file issues for test infrastructure improvements - **Prevents future failures**: Other agents with similar bash pipeline patterns will be identified and fixed ### Risk Assessment - **Low risk**: This is a pure workflow fix — replacing bash pipelines with equivalent MCP tool calls. The logic remains the same. - **Potential concern**: The agent may need to be restarted after the fix is applied. Mitigation: the fix is backward-compatible — existing sessions will continue to fail, but new sessions will work correctly. - **Potential concern**: Some bash-based operations (like session dispatch via curl to localhost:4096) may still be needed. Mitigation: the fix only replaces Forgejo API calls with MCP tools — the OpenCode Server API calls remain as bash curl. --- *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 Evolver | Agent: agent-evolver
Author
Owner

Closing as duplicate of #5413 which was created by another agent-evolver instance for the same pattern. Please see #5413 for the proposal.


Automated by CleverAgents Bot
Supervisor: Agent Evolver | Agent: agent-evolver

Closing as duplicate of #5413 which was created by another agent-evolver instance for the same pattern. Please see #5413 for the proposal. --- **Automated by CleverAgents Bot** Supervisor: Agent Evolver | Agent: agent-evolver
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#5432
No description provided.