AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. ai-agents-sde
  4. gh-1544
  5. plan
  6. plan.md
plan.md(3.1 KB)· Apr 2, 2026· 2 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks

Plan: Fix shell quoting bug in tech-sweep-exec inline comment posting#

Summary#

Refactor tech-sweep-exec SKILL.md to use safe JSON construction (jq -n + gh api --input -) for inline PR comment posting, replacing the current -f body='<text>' pattern that breaks on newlines, quotes, and backticks. Also add a dedicated post-inline-comment.sh tool script with built-in error handling and a regression test.

Files#

FileActionDescription
.openclaw/workspace/skills/tech-sweep-exec/SKILL.mdmodifyReplace inline comment API section with safe jq + --input - pattern; update failure behavior to log-and-continue
scripts/tools/post-inline-comment.shcreateReusable shell script for posting inline PR comments via safe JSON construction (mirrors post-review.sh pattern)
scripts/tools/test-inline-comment-quoting.shcreateRegression test exercising comment bodies with newlines, double-quotes, and backticks

Steps#

  1. Create scripts/tools/post-inline-comment.sh — a shell script that accepts --repo, --pr, --commit, --path, --line, --body-file (or stdin), constructs JSON via jq -n --arg, and posts via gh api --input -. On non-2xx response, exit non-zero with logged error. Follow the pattern established by scripts/tools/post-review.sh.
  2. Update tech-sweep-exec/SKILL.md inline comment API section (lines 29–43) to instruct the executor to write the comment body to a temp file, then call post-inline-comment.sh (or equivalently use jq -n + --input - directly). Remove the raw -f body='<text>' pattern entirely.
  3. Update tech-sweep-exec/SKILL.md failure behavior section (lines 82–84) to log-and-continue on inline comment POST failure instead of halting all remaining actions. Top-level review still posts first; if an inline comment fails, log the error and proceed to the next inline comment and subsequent state updates.
  4. Create scripts/tools/test-inline-comment-quoting.sh — a dry-run regression test that constructs a JSON payload with a body containing newlines, double-quotes, and a backtick, validates JSON is well-formed via jq ., and optionally posts to a real PR if --live flag is provided.

Verification#

  • Run test-inline-comment-quoting.sh and confirm JSON construction succeeds for bodies with all three tricky character types.
  • Manually trigger a tech-sweep-exec run against a test PR with an inline comment containing newlines + quotes + backticks and confirm the comment posts successfully.
  • Confirm that a simulated inline POST failure (e.g., invalid line number) logs the error but does not prevent remaining actions from executing.

Risks#

  • Skill instruction change scope: tech-sweep-exec is a Claude skill (prompt-level instructions), not compiled code. Changes to SKILL.md alter agent behavior at next invocation — no deployment needed, but the agent must re-read the skill on its next run.
  • post-inline-comment.sh adoption: The new helper script is opt-in for the skill; if the SKILL.md update references it, the script must exist on the runner's filesystem before the next sweep cycle.
ContextPrd