Repository navigation
refactor(harness,transport,tui): share SDK manifest and wire framing, enforce TUI attached state - #1856
Merged
Conversation
… enforce TUI attached state
…gh framing The egress-proto blocking codec and the host-agent async migrate codec kept their own copies of the 4-byte big-endian framing. Add blocking read_sync/write_sync to engram_transport::framing and use them, so one place owns the length check before allocation and the prefix encoding. The bytes on the wire and the error kinds and messages do not change. framing::read now states that it is not cancel safe. The prefix counts the body only. The u32 check uses try_from. Review pass: engram-migrate-proto (blocking, no tokio) and engram-substrate-proto (one write per frame) keep their own codecs; a dependency on engram-transport would pull tokio into both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared module still held two decoders for ENGRAM_TOOLS: serde for Claude and a hand-written parser for Codex, chosen by a ToolProvider argument, with a generic ManifestTool<B> and a private ClaudeBindings shim. Both decode the same orchestrator type, where every binding is an optional string. Use one serde decoder for both harnesses and remove ToolProvider, the generic parameter, and the shim. A non-string binding for the other provider now makes the manifest invalid. The orchestrator never sends one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deduplicates harness plumbing and wire framing, adds real transport test coverage, and removes TUI screen-state
.expect()panics:ENGRAM_TOOLSmanifest types,parse_tool_manifest,manifest_from_env, andwith_browser_viewintoengram-harness-sdk/src/tool_manifest.rs, and removes duplicatedemitandQueuedPromptdefinitions inengram-harness-claude. Both harnesses use one serde decoder. A non-string native binding for the other provider now makes the manifest invalid; the orchestrator types every binding as an optional string, so it never sends one.engram-transport/src/framing.rsowns the 4-byte big-endian length prefix (body length only), async and blocking.engram-agentd,engram-harness-proto,engram-egress-proto(async and blocking), and the host-agent async migrate codec use it. Each caller keeps its max frame size and error text. The length is checked before the body is allocated. Wire bytes, EOF behavior (UnexpectedEofmid-prefix and mid-body), and cancel behavior are unchanged.from_env_defaults_to_vsock_and_rejects_garbagetest inengram-transportwith real unit assertions, and adds framing tests for wire bytes, limits before body I/O, and truncated frames.Screenfield.App::screen()derives the screen fromattached, so render paths no longer rely on.expect("attached screen has a session").Not changed:
engram-migrate-proto(blocking, no tokio) andengram-substrate-proto(one write per frame) keep their own codecs, because a dependency onengram-transportwould pull tokio into both.Validation
cargo fmt --check, nativecargo clippy --all-targets -- -D warningson the touched crates, Linux cross-clippy onengram-harness-claude,engram-harness-codex,engram-transport, andengram-egress-proto,cargo hakari generate --diff.cargo nextest runonengram-transport,engram-egress-proto,engram-harness-sdk,engram-harness-codex,engram-harness-proto,engram-agentd(279 passed, including the wire-golden and decode-never-panics suites), the host-agent migrate tests, andengram-tui(perf 3.09 ms p99).🤖 Generated with Claude Code