Skip to content

fix: preserve redirected SSH failure diagnostics - #132

Merged
TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
laozhej:fix/113-ssh-failure-output
Nov 18, 2026
Merged

TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
laozhej:fix/113-ssh-failure-output

Conversation

@laozhej

@laozhej laozhej commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Failed SSH commands now use the captured stdout tail when stderr is empty or whitespace-only, preserving diagnostics from commands using 2>&1. Stderr still takes precedence, both streams retain the existing HOMELAB_MAX_OUTPUT_BYTES bound, and signal failures retain their diagnostic too.

homelab_systemdServices returns the status text for a requested unit when systemctl status exits 3. Other exit codes and failures while listing units remain errors. homelab_certCheck now includes its certificate-retrieval explanation and the original command diagnostic when the OpenSSL pipeline fails.

Why

Fixes #113. Redirected output was discarded on failure, leaving callers with only an exit code. The two affected handlers also skipped their useful status or fallback output. The systemctl behavior follows its documented exit statuses.

Type

  • New MCP tool
  • New skill
  • New rule
  • Bug fix
  • Documentation
  • Other

Testing

  • cd mcp-server && npm run build && npm test passes: 329 tests passed, 10 live-Pi tests skipped on Node 22.23.0.
  • pytest tests/ -v --tb=short passes: 273 tests on Python 3.15.2.
  • Tested against a live Pi (not applicable to this mocked regression run).

Six regression checks fail before the fix and pass after. Tests cover stdout-only errors, whitespace-only stderr, bounded output, stderr precedence, empty output, signal failures, inactive and missing units, list failures, certificate failures, and unrelated SSH errors. git diff --check passes.

Checklist

  • No secrets or credentials committed
  • CHANGELOG.md updated
  • README.md updated (not applicable; no tools, skills, or rules added)
  • CLAUDE.md updated (not applicable; no tools, skills, or rules added)

Prepared with OpenAI Codex assistance. The commit includes the required DCO sign-off. This branch is independent of #131.

Hosted CI currently requires maintainer approval for this fork contribution (MCP Server CI run); the build/test jobs have not run on GitHub yet. Results above are local.

@laozhej
laozhej requested a review from TMHSDigital as a code owner November 18, 2026 04:08
@TMHSDigital
TMHSDigital merged commit 6c67f95 into TMHSDigital:main Nov 18, 2026
13 of 14 checks passed
TMHSDigital added a commit to laozhej/Home-Lab-Developer-Tools that referenced this pull request Nov 18, 2026
Resolve conflicts with TMHSDigital#132 by keeping both changelog entries and both test imports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: TM Hospitality Strategies <[email protected]>
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.

Failing commands that use 2>&1 lose their error text

2 participants