fix: address 14 PR review comments from coderabbitai/chatgpt-codex

- guards.py: split confirm bypass into explicit check; use .get() for
  dict description to prevent KeyError on missing action keys
- resources.py: use `is not None` for logs stream cache check; add
  on-demand subscribe_once fallback when auto_start is disabled so
  resources return real data instead of a perpetual "connecting" placeholder
- setup.py: always prompt before overwriting credentials even on failed
  probe (transient outage ≠ bad credentials); update elicitation message
- unraid.py: always elicit_reset_confirmation before overwriting creds;
  use asyncio.to_thread() for os.path.realpath() to avoid blocking async
- test_health.py: update test for new always-prompt-on-overwrite behavior;
  add test for declined-reset on failed probe
- test_resources.py: add tests for logs-stream None check, auto_start
  disabled fallback (success and failure), and fallback error recovery
- test-tools.sh: add suite_live() covering cpu/memory/cpu_telemetry/
  notifications_overview/log_tail; include in sequential and parallel runners
- CLAUDE.md: correct unraid_live → live action reference; document that
  setup always prompts before overwriting; note subscribe_once fallback
This commit is contained in:
Jacob Magar
2026-03-16 03:10:01 -04:00
parent efaab031ae
commit 884319ab11
8 changed files with 149 additions and 17 deletions

View File

@@ -90,10 +90,19 @@ async def gate_destructive_action(
Pass a str when one description covers all destructive actions.
Pass a dict[action_name, description] when descriptions differ.
"""
if action not in destructive_actions or confirm:
if action not in destructive_actions:
return
desc = description[action] if isinstance(description, dict) else description
if confirm:
logger.info("Destructive action '%s' bypassed via confirm=True.", action)
return
if isinstance(description, dict):
desc = description.get(action)
if desc is None:
raise ToolError(f"Missing destructive-action description for '{action}'.")
else:
desc = description
confirmed = await elicit_destructive_confirmation(ctx, action, desc)
if not confirmed:
raise ToolError(