Skip to content

fix(code-simplifier): eliminate python3 bash-policy failures, fix jq split bug, add guardrails#37268

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/agentic-token-optimizer
Draft

fix(code-simplifier): eliminate python3 bash-policy failures, fix jq split bug, add guardrails#37268
Copilot wants to merge 4 commits into
mainfrom
copilot/agentic-token-optimizer

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 6, 2026

The code-simplifier workflow has been on a 5-run failure streak (100% failure rate), burning ~864 AIC/run by exhausting all 50 turns hitting Permission denied errors for python3 (not in the bash allowlist) and a broken jq expression that corrupted recent-commits.jsonl on every run.

Changes

  • Fix jq arithmetic errorsplit("\t"; 2)split("\t")
    The two-arg form split(str; flags) treats the second arg as a regex flags string; passing integer 2 caused jq to evaluate "g" + 2 internally, producing string ("g") and number (2) cannot be added on every run and writing a corrupt recent-commits.jsonl.

    - | jq -R 'select(length > 0) | split("\t"; 2) | {sha: .[0], subject: (.[1] // "")}' \
    + | jq -R 'select(length > 0) | split("\t") | {sha: .[0], subject: (.[1] // "")}' \
  • Add jq * to bash allowlist — gives the agent a supported, allowlisted tool for JSON processing so it doesn't reach for python3

  • Python3 prompt guardrail — adds to ## Command Guardrails: "Do NOT use python3 for JSON parsing; use jq, cat, or head instead." Directly addresses the root cause: 11 Permission denied denials per run from python3 -c "..." invocations

  • Consecutive permission-denied guardrail — adds: "If you encounter 3 or more consecutive Permission denied errors for the same type of command, stop immediately and call report_incomplete." Provides a measurable threshold before the 50-turn/25M-token hard caps are hit

  • Recompile lock file via gh aw compile code-simplifier

Copilot AI and others added 2 commits June 6, 2026 06:02
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…t bug, add permission-denied guardrail

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Python bash-policy failures in code simplifier fix(code-simplifier): eliminate python3 bash-policy failures, fix jq split bug, add guardrails Jun 6, 2026
Copilot AI requested a review from pelikhan June 6, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agentic-token-optimizer] Code Simplifier — eliminate Python bash-policy failures that waste 864 AIC/run

3 participants