Skip to content

Add /indigo:debug-sqllogger skill + command#30

Merged
simons-plugins merged 2 commits into
mainfrom
feat/debug-sqllogger-skill
Apr 18, 2026
Merged

Add /indigo:debug-sqllogger skill + command#30
simons-plugins merged 2 commits into
mainfrom
feat/debug-sqllogger-skill

Conversation

@simons-plugins

@simons-plugins simons-plugins commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Summary

New /indigo:debug-sqllogger command that walks through identifying which Indigo device is causing the repeating generic "SQL Logger Error: One or more failures updating device history" message, then applies one of three user-chosen fixes and reverts all temporary patches.

SQL Logger swallows per-device exceptions behind self.logger.debug(..., exc_info=True). With sqlDebugLogging disabled (the default), the event log only shows a generic spam line every ~60s with no device ID and no traceback. This skill codifies the workflow I used by hand:

  • Promote the two swallowed logger.debug call sites (_update_device_history, _create_table_for_dev) to logger.error via a [DEBUG-PATCH]-tagged Edit
  • Restart plugin, read indigoplugin.sql-logger/plugin.log, extract the failing device_history_<id> + exception class
  • Resolve device via mcp__indigo__get_device_by_id, cross-reference the state list for overflow candidates (INT4 cumulative counters are the usual cause — NumericRangeError, PG code 22003)
  • Present findings + three fix options, ask the user which to apply:
    • (a) exclude device entirely (sharedProps["sqlLoggerIgnoreStates"] = "*", via Indigo UI)
    • (b) exclude specific states only (comma list, via Indigo UI)
    • (c) drop + rebuild the table (one-shot DROP TABLE IF EXISTS device_history_<id> in startup(), reverted immediately after the rebuild confirmation line appears)
  • Revert every [DEBUG-PATCH] edit, grep to confirm zero hits remain, restart, watch event log to verify the error stops

Safety

  • Every temporary edit carries the literal tag [DEBUG-PATCH]; revert is grep-verified
  • SQL DROP string hardcodes the specific <id> extracted in Phase 3 — never parameterised from elsewhere
  • Interactive only; one device per pass
  • Plugin + log paths discovered via mcp__indigo__list_plugins with workspace mount-prefix handling (same pattern /indigo:update-plugins uses) — nothing hardcoded

Version

  • plugin.json + marketplace.json: 1.7.0 → 1.8.0 (minor: new user-visible feature)

Test plan

  • /indigo:debug-sqllogger loads on a session with no active SQL Logger errors and exits cleanly at Phase 1 (nothing to debug)
  • Against live jarvis.local SQL Logger spam: skill locates SQL Logger plugin and its log path, promotes both logger.debug calls with [DEBUG-PATCH] tags, restart + log extraction surface the real exception + device_history_<id>
  • get_device_by_id resolves the device and the report names it
  • Three fix options presented; skill waits for user choice
  • Option (c) end-to-end: DROP block added, rebuild confirmed in log, block removed, grep [DEBUG-PATCH] returns zero, event log silence verified
  • Options (a)/(b): skill directs user to Indigo UI sharedProps path rather than patching another function
  • CI version-check passes (1.7.0 → 1.8.0, synced across both manifests)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated plugin version to 1.8.0.
  • Documentation

    • Added comprehensive debugging documentation and interactive workflow guide for diagnosing and resolving SQL Logger device history errors, featuring step-by-step troubleshooting procedures and multiple remediation options for users experiencing device history issues.

Walks through debugging which Indigo devices are causing the generic
"SQL Logger Error: One or more failures updating device history"
spam. Promotes the two swallowed logger.debug(..., exc_info=True)
calls to error-level via a [DEBUG-PATCH]-tagged edit, extracts the
failing device_history_<id> + exception, resolves the device via MCP,
and asks the user which of three fixes to apply (exclude device /
exclude states / drop + rebuild table). Reverts every patch on the
way out; grep-verifies cleanup.

Interactive only. One device per pass. SQL DROP is hardcoded to the
specific device ID extracted during the run — never parameterised.

Bumps plugin version 1.7.0 → 1.8.0 (minor: new user-visible feature).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@simons-plugins has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 7 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 52 minutes and 7 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 55eb838f-5760-4328-b8ab-b500f1ea81d8

📥 Commits

Reviewing files that changed from the base of the PR and between 9e94085 and b54d2cb.

📒 Files selected for processing (1)
  • skills/debug-sqllogger/SKILL.md
📝 Walkthrough

Walkthrough

This PR updates the plugin version from 1.7.0 to 1.8.0 in the manifest files and introduces comprehensive documentation for a new SQL Logger debugging workflow, including both a command specification and a detailed skill guide for diagnosing and resolving device history errors.

Changes

Cohort / File(s) Summary
Version Bump
.claude-plugin/marketplace.json, .claude-plugin/plugin.json
Updated plugin version from 1.7.0 to 1.8.0 across manifest metadata files.
SQL Logger Debug Documentation
commands/debug-sqllogger.md, skills/debug-sqllogger/SKILL.md
Added new documentation defining an interactive multi-phase workflow for debugging SQL Logger device history errors, including temporary code patching, exception extraction, device resolution, and remediation options (exclude device, exclude states, or rebuild table via SQL DROP).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 A logger once swallowed the truth in the night,
So we penned a grand skill to bring hidden light!
With patches and SQL, we'll surface the pain,
Then Version 1.8.0 makes debugging sane! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a new debug-sqllogger skill and command to the Indigo plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/debug-sqllogger-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Five fixes from code-reviewer + direct source verification against
the installed SQL Logger plugin on jarvis:

1. Correct the create-path patch example — line 476 in the real
   SQL Logger source does NOT carry exc_info=True (only line 529
   does). Skill now shows both before/after snippets accurately and
   tells agents to add exc_info=True when promoting, otherwise the
   traceback never lands in the log and the patch is useless.

2. Fix the update-path example message text to match reality
   ("with device changes" not "for device {dev.id}"). Edit-tool
   matching would have failed cold otherwise.

3. Inline the mount-prefix probe (same loop used in
   update-plugins/references/install-workflow.md § "Deploy path
   portability") so a cold agent doesn't have to go hunting, and
   add an explicit canonical reference for the full pattern.

4. Promote the "revert on any abort" rule to a Safety Rule and wire
   it into Phase 4's "none" branch. Previously nothing prevented a
   mid-flow interrupt from leaving [DEBUG-PATCH] logger.error calls
   in plugin.py spamming the event log every 60s.

5. Clarify Phase 7's "re-run from Phase 2" — Phase 6 has already
   reverted the patch, so the "next device" case needs a full
   Phase 2 → 7 re-patch cycle, not just re-reading the log.

Also: defence-in-depth on the Option (c) DROP statement — assert
<id> matches ^[0-9]+$ before embedding in SQL. Indigo device IDs
are always ints, but a Phase 3 extraction bug could theoretically
produce something else; cheap to guard.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@simons-plugins simons-plugins merged commit f0397a2 into main Apr 18, 2026
3 checks passed
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.

1 participant