Repository navigation
Description
What happened
Security and stability hardening audit finding H01 / P2 (2026-09-28). Priority is an audit recommendation, not a claim of a production incident.
When the SSH command exits nonzero, run_remote classifies stderr text as an SSH authentication, host-key or timeout failure before it parses stdout. A remote send that was already submitted but reports ok: false (for example a failed wake) exits 1, so any unrelated stderr line containing a marker such as permission denied hides the in-band result.
With a mocked subprocess.run, the remote returned a valid schemaVersion 1 send result (submitted: true, ok: false, wake present), exit status 1, and the stderr line bash: <home>/.env.local: Permission denied from a login-shell startup file. session-peer reported sshFailure: authentication_failed and dropped submitted: true. The same payload with empty stderr was returned correctly. A caller following the authentication hint and retrying would deliver the message twice.
Separately, the 120-second TimeoutExpired on the SSH send path is reported as sshFailure: timeout ("connection timed out"), without stating that the submission outcome is unknown or that automatic retry is unsafe. The Codex queue path and the adapter contract already report such cases as outcome unknown.
What you expected
- A valid schemaVersion JSON result on stdout is trusted before any stderr classification.
- Stderr markers are consulted only when ssh itself failed (exit 255) or stdout is empty.
- A send that times out after the command was started reports the outcome as unknown with automatic retry disallowed.
Environment
- Baseline: published session-peer v1.0.2, commit
2046836822b88e53246de73851186598604cb5ec. - Reproduction: standalone module imported with
subprocess.runmocked; no SSH connection was made. - Audit environment: macOS arm64, Python 3.14.7, OpenSSH 10.3p1.
- No live message tests or production mutation.
Source evidence
- session_peer_core/ssh.py#L76-L94 — stderr marker classification
- session_peer_core/ssh.py#L152-L153 — send timeout mapped to a connection timeout
- session_peer_core/ssh.py#L157-L164 — classification runs before stdout is parsed
- session_peer_core/ssh.py#L188-L201 — in-band send results that should be preserved
- session_peer_core/sending.py#L80 — remote exits 1 for
ok: false - session_peer_core/codex.py#L784-L785 and session_peer_core/registry.py#L88-L91 — existing outcome-unknown wording
Acceptance criteria
- Fixtures: nonzero exit with valid send JSON plus stderr containing each classifier marker; the in-band result, including
submitted, is returned. - Exit 255 or empty stdout keeps the existing authentication, host-key and timeout classification and messages.
- A send timeout reports outcome unknown,
retryAllowed: false, and nosubmitted: falseclaim. -
list,doctorandupdateremote paths keep their current behavior or are covered by equivalent tests.
Scope and limitations
Target: v1.0.3 hardening work. This issue does not authorize a release or operating-service changes. The mocked stderr line is illustrative; no historical incident is attributed to it.
Related, not duplicates: #62 introduced authentication-failure reporting, #181 covers explicit ACK/unknown outcomes for handoffs, #182 covers request-ID deduplication for ordinary sends.
Checked
- Searched existing issues for duplicates.
- Removed credentials, conversation contents, private paths and real device/session identifiers.
- Used isolated fixtures without weakening inbound permissions.
Activity