fix(ssh): generate a host key ssh2 can actually parse; self-heal the bad one #5516
gluecron[bot]🤖 botAI Reviewcommented 10d ago
AI review unavailable
The platform's AI balance is exhausted, so AI generation is temporarily unavailable. Nothing was lost. You can queue this as a repair for the internal agent from the repository's Health page, or try again once the balance is restored. The PR is otherwise unchanged.
ccantynzAI Reviewcommented 10d ago
AI Triage
(no summary)
Priority: medium Risk area: mixed
Suggested labels: (no label suggestions) Suggested reviewers: (no reviewer suggestions)
Suggestions only — nothing has been applied. The PR author stays in control.
Cross-repo impact
See what breaks downstream if this PR merges.
⮌ Merged
This pull request was merged into main.
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts
Why SSH didn't come up with #5509
The enablement deploy surfaced a dormant Block-SSH-1 bug:
[ssh] failed to start: Cannot parse privateKey: Unsupported key format. Node emits ed25519 keys only as PKCS#8/OpenSSL PEM — formats thessh2library cannot parse — so the ephemeral-generation path never worked;SSH_PORT=0hid it since launch. Worse, #5509's persistence saved that unusable key to the volume, where a PEM-shaped sniff (includes("PRIVATE KEY")) would reload it forever.ssh-keygenemits OpenSSH format, which ssh2 also parses — setSSH_HOST_KEY.)/data/repos/.gluecron/ssh_host_ed25519_key— regenerates in place. The box self-heals on deploy, no manual cleanup.SSH_HOST_KEYis still used as given (failing loudly beats silently substituting a host identity), but the unparseable case now names itself at load time instead of dying as a generic startup error.Tests: 27/27 including two new — the generated key must satisfy
ssh2.utils.parseKey(the outage class, pinned), and a persisted legacy PKCS#8 key is regenerated. Typecheck clean.🤖 Generated with Claude Code