Skip to content

Widen triage bot permissions and add a debug journal - #4703

Merged
springfall2008 merged 3 commits into
mainfrom
fix/triage-bot-permissions-debug-journal
Aug 24, 2026
Merged

Widen triage bot permissions and add a debug journal#4703
springfall2008 merged 3 commits into
mainfrom
fix/triage-bot-permissions-debug-journal

Conversation

@springfall2008

Copy link
Copy Markdown
Owner

Why

The auto-triage bot was hitting permission denials on three things the issue-triage skill actually asks it to do:

  1. Downloading a reporter's logcurl and python3 were not allowed, and a predbat.log is routinely tens of MB, past what WebFetch returns.
  2. Re-syncing the clonegit fetch / git reset --hard were denied, so a run investigated whatever the checkout happened to be at.
  3. Running one targeted test./run_all --test <name> was denied despite the rule being present, most likely because of the shape of the command (compound with a redirect to an out-of-scope path).

What changed

tools/triage_daemon.py

  • Allowlist now covers curl, python3 and the text-slicing commands needed to grep a large log, plus git fetch/reset/checkout/clean for the in-session re-sync, and coverage/run_all variants for running the test from the repo root.
  • New scratch directory (~/predbat-triage-bot/scratch), emptied per issue and passed via --add-dir, so downloads and redirect targets land somewhere in scope for Read/Grep as well as Bash.
  • New DISALLOWED_TOOLS: git push/commit and the publishing gh commands are now denied by the harness rather than only by the skill's prose guardrails — the broad Bash(gh *) entry had been leaving gh pr create, gh release, gh auth and friends open.
  • sync_repo() runs git clean -fd (not -x, so coverage/venv/ survives), making the "hard-reset before the next run" claim in the docstring true for untracked leftovers.
  • --max-turns 40 → 60, since downloading and grepping a log costs turns.

.claude/skills/issue-triage/SKILL.md

  • Documents the download-and-grep recipe for attachments, the sync command, and the save-output-then-grep form for the targeted test run (per the CLAUDE.md testing rule).
  • New guardrail: when a permission block stops a step, say so plainly in the triage comment rather than wording it so a skipped step reads as a completed one.

.claude/skills/issue-triage/references/debug-journal.md (new)

Distilled from maintainer debugging sessions, June–August 2026:

  • Replaying a reporter's predbat_debug.yaml./run_all --debug_file <file> reproduces their plan and lists every config item they have changed from default. Verified by running it against coverage/cases/predbat_debug_agile1.yaml.
  • Check configuration before code, with GH#4222 and GH#4478 as worked examples.
  • Per-integration table — Fox unsupported-setting errno, Solis CID 636 TOU bit, SolaX 10402 and the 10% SOC clamp, Sigenergy midnight counter reset, GE Cloud nulls, Teslemetry nameplate inference and per-cycle TOU rewrite, Sunsynk/DEYE per-slot power register and read_only, grid_power_invert bleeding between two configured systems, Enphase MFA/DTG/CSRF, Octopus IOG and saving sessions, and more — each with the symbol to grep and the registered test name.
  • Symptom → module table and the traps that have wasted time before (stale kernel binaries, test-order pollution, version drift, log noise).

Every symbol cited was checked against the current tree. Three notes did not survive that check and were corrected or dropped: Fox's unsupported errno is now (42015, 44096); load_power_statistics_enable no longer exists; and there is no registered Predheat test, so that row says so explicitly.

CLAUDE.md / AGENTS.md

Gain the --debug_file replay recipe, which was missing from the testing docs entirely, and a pointer to the journal. No pointer to the skill itself — skills are auto-listed to the model each session, so that would be redundant.

Testing

pre-commit passes on all changed files (zcat and errno added to the workspace dictionary). The debug replay was run end to end to confirm the command and flag names before documenting them. No production code is touched — this is bot tooling and docs only.

🤖 Generated with Claude Code

The auto-triage bot was hitting permission denials on three things the
issue-triage skill actually asks it to do: downloading a reporter's log
(routinely tens of MB, past what WebFetch returns), re-syncing the clone,
and running one targeted test.

Daemon:
- Allow curl/python3 and the text-slicing commands needed to grep a large
  log, plus git fetch/reset/checkout/clean for the in-session re-sync.
- Add a scratch directory (emptied per issue, passed via --add-dir) so
  downloads and redirect targets land somewhere in scope.
- Add DISALLOWED_TOOLS so git push/commit and the publishing gh commands
  are denied by the harness rather than only by the skill's guardrails -
  the broad "Bash(gh *)" entry had been leaving those open.
- sync_repo() now runs git clean -fd, so untracked leftovers from the
  previous run really are gone as the docstring claims.

Skill:
- Document the download-and-grep recipe for attachments, the sync command,
  and the save-output-then-grep form for the targeted test run.
- Say plainly in the comment when a permission block stopped a step,
  rather than wording it so a skipped step reads as a completed one.

Journal:
- New references/debug-journal.md distilling past debugging sessions:
  replaying a reporter's predbat_debug.yaml, checking configuration before
  code, per-integration API quirks, symptom-to-module pointers, and traps
  like stale kernel binaries and test-order pollution. Every symbol cited
  was checked against the current tree.
- CLAUDE.md/AGENTS.md gain the --debug_file replay recipe (missing from the
  test docs entirely) and a pointer to the journal.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 24, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current permission harness still allows gh api via Bash(gh *), which can bypass the intended “no publishing” restrictions, and should be explicitly blocked or the gh allowlist tightened.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the automated issue-triage harness and supporting docs so the issue-triage skill can reliably download and slice large attachments, resync the working clone, and run a targeted test, and adds a maintained “debug journal” reference for common investigation starting points.

Changes:

  • Expanded tools/triage_daemon.py tool allowlist, added a per-issue scratch directory, and introduced an explicit disallowlist for publishing-oriented commands.
  • Updated triage skill documentation plus contributor docs (CLAUDE.md, AGENTS.md) with debug-dump replay and investigation workflow guidance.
  • Added a new .claude/skills/issue-triage/references/debug-journal.md and updated the cspell workspace dictionary.
File summaries
File Description
tools/triage_daemon.py Widens/structures permissions, adds scratch dir lifecycle, and adjusts triage invocation parameters/limits.
.claude/skills/issue-triage/SKILL.md Documents scratch usage, attachment download/grep workflow, repo resync, and test log handling guardrails.
.claude/skills/issue-triage/references/debug-journal.md New investigation playbook: replay guidance, symptom→module pointers, and integration-specific notes/tests.
CLAUDE.md Adds debug-dump replay recipe and points to the debug journal.
AGENTS.md Adds debug-dump replay recipe and points to the debug journal.
.cspell/custom-dictionary-workspace.txt Adds errno and zcat to keep spell-check passing with new docs/tooling.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tools/triage_daemon.py
Comment thread .claude/skills/issue-triage/SKILL.md
Comment thread tools/triage_daemon.py
springfall2008 and others added 2 commits August 24, 2026 13:52
Everything Claude prints for an issue now lands in
~/predbat-triage-bot/logs/issue-<number>.log instead of the daemon's own
stdout, so a triage can be read back after the fact. The console keeps the
start/exit lines and names the log path to tail.

Appended rather than truncated: a run that fails leaves the issue
unprocessed and the next poll retries it, and the failed attempt is the
part worth keeping. Each attempt gets a timestamped header and an exit-code
footer.

Also passes --verbose, so the captured log holds the turn-by-turn trace
including which tool calls were denied, rather than just the final message.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@springfall2008
springfall2008 merged commit 3ff184e into main Aug 24, 2026
2 checks passed
@springfall2008
springfall2008 deleted the fix/triage-bot-permissions-debug-journal branch August 24, 2026 12:53
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.

2 participants