openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

orchestration: refresh stale base64 `from` comment/test — current protocol is base58 (defensive unify already handles both)

Open oxoxDev opened this issue 4 months ago • 3 comments

Verdict (2026-07-08, resolved via round-trip + staging DB)

Not a live bug on the current protocol. Peer identity / from on tiny.place latest main is base58, and openhuman already tolerates both encodings. This issue downgrades to a small doc/test refresh in ingest.rs.

What we thought vs what's true

The original report claimed the reverse steer send resolved a messaging key / a base64 form instead of the wallet address, producing signal send: No agent found for "c1qHJX…=". After a full round-trip test (thanks @sanil-23) and a direct read of the staging DB, the accurate picture is:

  • tiny.place latest main sends peer identity / from as base58 (SDK send path derives agentId = derive_crypto_id = base58; resolveRecipientKey normalizes even base64 input → base58; a live carol→dave contact request surfaced base58).
  • openhuman-staging matches: of all bridge sessions, only the first smoke (2026-07-07 19:33) stored a base64 recipient; every run after (19:38 codex, 19:58 claude) stored base58.
  • That one base64 row was produced before the vendored tiny.place SDK was bumped this session (Phase 4 convergence). Pre-bump build emitted a base64 from; post-bump it's base58. The No agent found failure was a reply to that dead first session.

Why nothing actually breaks now

ingest.rs::decode_agent_key decodes either base64 (legacy from) or base58 (directory/pairing form) to the raw 32-byte key, and agent_id_in_linked_set unifies on that — so current base58 flows through and a stray legacy base64 still pairs. The stored session agent_id for every current session is base58, so the reverse send resolves it fine.

The stale bits (the only real work here)

  • src/openhuman/orchestration/ingest.rs:29 — comment states the inbound MessageEnvelope.from "carries the base64 Ed25519 public key". Stale: current protocol is base58. Reword to base58-primary, note base64 as a legacy form the decoder still tolerates.
  • linked_gate_unifies_base58_and_base64_of_same_key test (~line 629) — framed as base64 from "observed in the wild". Keep the test (defensive coverage is good) but reframe base64 as the legacy form, not the current wire shape.

Scope

  • Keep decode_agent_key dual-encoding tolerance — cheap defense against a legacy/garbled peer.
  • Refresh the comment + test framing to base58-primary.
  • The full master → agent steer delivery (prompt injection back into a live agent session) remains Phase 5 and is @sanil-23's — this issue only ever concerned recipient-identity encoding, which is now cleared.

Original error (for reference)

signal send: No agent found for "c1qHJXpt4t1ihVPuoVXyWhFp+PSTkWHU48bXPduUOzg="

Base64 (the =/+), from the pre-SDK-bump first smoke session — not reproducible on current base58 runs.

oxoxDev avatar Jul 07 '26 19:07 oxoxDev

Correction after re-checking: this is not two different keys. The earlier draft compared the send-error key against the master's own wallet by mistake. It's the same Ed25519 identity key in two encodings — base64 (envelope.from, what we store at ingest.rs:444) vs base58 (Solana address, what signal send resolves on). Forward ingest already unifies them via decode_agent_key; only the reverse send skips it. Fix = bs58-encode the 32-byte key before signal send (or store base58 at ingest). No directory reverse-lookup needed. openhuman-side, SDK is fine — base58 is correct as you said.

oxoxDev avatar Jul 07 '26 20:07 oxoxDev

Resolved the encoding question with @sanil-23's round-trip + a direct read of staging's orchestration DB. Verdict: current tiny.place protocol sends base58 from; the one base64 recipient in staging was the first smoke session, produced before this session's vendored-SDK bump. openhuman's decode_agent_key already tolerates both encodings, so nothing breaks on current base58. Downgraded from live bug → doc/test refresh (reword the base64 from comment + test to base58-primary, keep the dual-encoding decoder as legacy tolerance). Full master→agent steer delivery stays Phase 5.

oxoxDev avatar Jul 08 '26 06:07 oxoxDev

Closing — not a defect. Round-trip (@sanil-23) + a direct read of staging's orchestration DB confirmed current tiny.place protocol sends base58 peer identity; the single base64 recipient on staging was the first smoke session, from before this session's vendored-SDK bump. openhuman's decode_agent_key already unifies base64/base58 to the raw 32-byte key, so nothing breaks on current data. The only residual is a stale base64-primary comment/test in ingest.rs — a trivial reword that can fold into any future orchestration change, not worth a standing issue. Master→agent steer delivery is separate, ongoing work.

oxoxDev avatar Jul 08 '26 07:07 oxoxDev