Widen triage bot permissions and add a debug journal - #4703
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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.pytool 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.mdand 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.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The auto-triage bot was hitting permission denials on three things the
issue-triageskill actually asks it to do:curlandpython3were not allowed, and apredbat.logis routinely tens of MB, past what WebFetch returns.git fetch/git reset --hardwere denied, so a run investigated whatever the checkout happened to be at../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.pycurl,python3and the text-slicing commands needed to grep a large log, plusgit fetch/reset/checkout/cleanfor the in-session re-sync, andcoverage/run_allvariants for running the test from the repo root.~/predbat-triage-bot/scratch), emptied per issue and passed via--add-dir, so downloads and redirect targets land somewhere in scope forRead/Grepas well as Bash.DISALLOWED_TOOLS:git push/commitand the publishingghcommands are now denied by the harness rather than only by the skill's prose guardrails — the broadBash(gh *)entry had been leavinggh pr create,gh release,gh authand friends open.sync_repo()runsgit clean -fd(not-x, socoverage/venv/survives), making the "hard-reset before the next run" claim in the docstring true for untracked leftovers.--max-turns40 → 60, since downloading and grepping a log costs turns..claude/skills/issue-triage/SKILL.md.claude/skills/issue-triage/references/debug-journal.md(new)Distilled from maintainer debugging sessions, June–August 2026:
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 againstcoverage/cases/predbat_debug_agile1.yaml.read_only,grid_power_invertbleeding 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.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_enableno longer exists; and there is no registered Predheat test, so that row says so explicitly.CLAUDE.md/AGENTS.mdGain the
--debug_filereplay 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-commitpasses on all changed files (zcatanderrnoadded 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