Skip to content

fix: validate before sending, and print a reply address that runs - #12

Merged
abruption merged 1 commit into
mainfrom
fix/7-8-validation-and-errors
Sep 7, 2026
Merged

abruption merged 1 commit into
mainfrom
fix/7-8-validation-and-errors

Conversation

@abruption

Copy link
Copy Markdown
Owner

Summary

Closes #7, #8, #9.

Validation ran too late. It lived inside post_to_socket(), which --dry-run never calls and the remote path reaches only after ssh has already rejected the argument. A rehearsal could pass where the real send failed, and an empty message could ride out on its reply line alone — starting a turn on another machine to say nothing. check_message() now runs before dispatch, against the body the user actually wrote.

The 1M cap was never true over SSH. The message travels as a command-line argument and meets MAX_ARG_STRLEN around 98K after base64 expansion. There is now a stated remote limit (90,000) enforced up front, with an error that explains why it differs and what to do instead.

The reply address was not runnable as printed. It named no user, so a worker running as ubuntu could not reach this laptop's abruptly; and it named a bare cc-peer, which a non-interactive SSH session does not have on PATH. It now carries the sending user, an absolute script path, and --no-reply-to.

Verification

Every row reproduced failing first.

before after
empty body piped from /dev/null Would post ... (64 chars) refusing to send an empty message
1,000,001 chars under --dry-run reported success rejected with the limit
150,000 chars to a remote host ssh exited 1 names the 90,000 SSH limit and the reason
malformed --b64 binascii.Error traceback --b64 is not valid base64-encoded UTF-8
--reply-to outside a session silently dropped says a reply needs a session to name

The reply line was then tested end to end: generated here, pasted verbatim into a shell on the KR host, and the message arrived in this session.

Reply: python3 ~/.claude/skills/cc-peer/cc_peer.py send --host [email protected] --to documents-57 --no-reply-to
→ Posted to documents-57's inbox on [email protected] (46 chars).

The username is the sender's and is not guaranteed valid on the far side, but it is correct whenever accounts match and strictly better than omitting it.

Type

  • feat
  • fix
  • docs
  • chore / refactor / test / perf

Checklist

  • python3 cc_peer.py list works locally
  • python3 cc_peer.py list --host <a real host> works over SSH
  • --dry-run resolves a target without posting anything
  • Commits follow Conventional Commits
  • Docs updated if behavior changed (README / SKILL.md / CLAUDE.md)
  • No secrets, tokens, or session keys in the diff

Verified against

v2.1.263 — macOS 26 (arm64) ↔ Ubuntu 24.04 (arm64), round trip in both directions.

Notes

SKILL.md and README still describe the old reply form; that and the remaining cleanups are #10.

Validation lived inside post_to_socket, which --dry-run never calls and the
remote path reaches only after ssh has already refused the argument. So a
rehearsal could pass where the real send failed, and an empty message could
ride out on the strength of its reply line alone — starting a turn on another
machine to say nothing. check_message() now runs before dispatch, on the body
the user actually wrote.

The advertised 1,000,000 cap was never true over SSH: the message travels as
a command-line argument and meets MAX_ARG_STRLEN around 98K after base64. The
remote limit is now stated, enforced up front, and explains itself.

The reply address was not runnable as printed. It named no user, so a worker
running as ubuntu could not reach a laptop's abruptly; it named a bare
cc-peer, which a non-interactive SSH session does not have on PATH. It now
carries the sending user, an absolute script path, and --no-reply-to.
Verified by running the generated line verbatim from KR — the message
arrived.

Also: --reply-to outside a session was dropped in silence, and now says why;
malformed --b64 and a mid-write socket failure raise CcPeerError instead of
escaping as tracebacks; the half-close comment no longer claims a delivery
guarantee it never provided.
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.

Advertised 1M character cap breaks around 98K on the remote path, with a raw traceback

1 participant