Rewrite GraphCoder around the harness client and shared TUI

Merged
VA
2d ago
+17800-9677

GraphCoder parses argv, opens LocalHarness, observes its authorized task files, renders the harness widgets, and forwards input as file writes. Native scenarios, fixtures/fake providers, the command console, native/native_writeback and the old wire host are deleted. Qualification scripts consume the filesystem JSONL dialect.

Head: f308e4948. GraphCoder: 4,914 → 243 production lines, excluding tests: main 102 + argv 33 + composition 108. Owned source files are below 800 lines; client/session.rs is 791. Main through #778 (cebe2675e) is merged. The #626-only delta is 248 files, +17,785/-9,677.

Execution, admission/recovery, command dispatch, publication retries and folds live in the harness library. Representative files: client/commands/session.rs (631), session_input.rs (108), client/task_projection.rs (278), client/local_identity.rs (71), client/session_tasks.rs (77 including tests), and filesystem/execution_journal/. Terminal ownership remains in harness-tui.

Final thread fixes

  • Restored JSONL operations check their saved outcome and drive saved work while stdin remains open; no extra input frame is required.
  • Headless error teardown drains the active one-request owner before disconnecting native mounts and preserves the original input/output error.
  • Claimed prompt recovery resumes first, then recovers a missing pre-admission turn from the immutable request under the same operation identity. Claimed ordinary tool effects are not blindly replayed.
  • Switching the followed task evicts former task transcripts, retaining the shared conversation and current bounded tail.
  • Destructive confirmation publication uses the checked generation CAS, so a withdrawal before publication prevents the request. Its instrumented Loom model includes the old rebase as a negative control.

Each finding has a deterministic regression/property and negative control. Those five review threads have evidence replies and are resolved.

Decisions

  • Per the coordinator's #778 sequencing instruction, the existing task-file view code is retained in client/task_compat/ and exported as TaskFileViews. The newly merged public ClientViews/swarm reducer and its APIs are preserved. The immediate follow-up after #626 lands will adopt that reducer and delete task_compat plus the separate projection path; this PR does not perform that migration.
  • Request/session identity is persisted in the workspace private volume. Interactive restart reopens unfinished work; identical unfinished -p input resumes. Completed requests start fresh, with --operation as an explicit override.
  • There is one filesystem JSONL dialect: submit writes a request file; observation emits a snapshot followed by cursor changes. Request limits and bounded observation retention remain separate. Follow drops archived chunks while preserving essential files.
  • Live Markdown, UTF-8 suffix repairs (including the saved retained-history euro seed), cancellation, edited-message submission, startup typeahead and terminal decoding use the production bindings. Generation retries retain publication identity; concurrent peer edits remain protected.

Latest review threads

Fixed in f308e4948; all current review threads have evidence replies and are resolved.

  • Execution results now reserve their exact record framing before serialization. The property covers near-limit task/session result files, a durable omitted terminal outcome, and reopening without another effect dispatch. Its negative control detects the former payload-only accounting failure.
  • The restored JSONL test checks both ready malformed input (rejected) and a scheduled first frame (saved completion settles immediately), with no provider redispatch. The existing open-stdin restoration/control coverage is retained.
  • Task-session range coverage is checked separately from display filtering. The property preserves the selected namespace and foreign exclusion assertions, then checks the four expected display records. Its negative control detects treating every range candidate as displayable.

At f308e4948, one bb1 batch passed all six focused cases (maximum 0.62s), the default production GraphCoder build, all six executable PTYs once, and the Windows GNU harness --lib --tests check with the unchanged native feature closure. Log: 2026-10-17T045336257Z-2453709.log (exit 0). The wasm32/native-grpc export matrix below remains valid; these subsequent fixes do not change exports or feature gates.

Platform export correction

client/mod.rs was rebuilt from main with only #626's bindings re-added. SwarmClient retains main's native-grpc/wasm32-wasm cfg; SwarmClientLimits and SwarmUpdate remain unconditional. WasmClientViews comes from crate::wasm::swarm and WasmHypothesisClient is exported separately. The wasm-only build also exposed an unconstrained summary-file decode when filesystem is disabled; its captured value now explicitly has type context::SummarySource, matching the existing filesystem branch.

At 54fafc5e0, bb1 passed:

  • Default production cargo build --locked -p graphcoder, with no extra harness features.
  • Harness wasm32-unknown-unknown --lib with --no-default-features --features wasm.
  • Native harness --lib with the existing filesystem-local,native-execution,terminal,tui,test-support,grpc,search-http closure.
  • All six PTYs once against the default production binary, retaining their 8s deadlines.
  • Windows GNU harness --lib --tests with the unchanged native closure.

Log: 2026-10-17T044204763Z-2432423.log (exit 0). The earlier native/model results below remain unchanged; no runtime logic or reducer migration was added in this correction.

Validation

All Linux execution and Windows GNU cross-checks ran on bb1, with the existing feature sets; no local builds.

  • 19 focused harness cases passed, covering restoration/teardown controls, claim-gap recovery/control, transcript eviction/control, bounded task tails and mount recovery. All command-session cases passed. Exact cases have a 9s deadline; the longest focused case was 2.29s.
  • Both affected executable JSONL cases passed. All six PTYs passed once: typeahead, success, cancel, cancel-preparation, command-recovery and uncertain, each with its 8s deadline.
  • Seven Loom cases passed: confirmation checked-cut/control and the five projection ownership models/controls. Dedicated flags: --cfg acyclic_harness_loom --cfg acyclic_loom. Each completed in at most 0.22s.
  • Windows GNU checks passed for harness --lib --tests, GraphCoder --bin graphcoder --tests, and the runtime ui_prompt fuzz consumer. The final Windows-only source correction preserves #778's replay_revision accessor and updates the JSONL fixture's new header fields; unchanged runtime/PTY results were reused.
  • Runtime/model log: 2026-10-17T035415945Z-2287768.log. Final Windows log: 2026-10-17T042344240Z-2362600.log. The first batch completed all runtime/models before the Windows check found the two compatibility issues; the final Windows batch passed.

Earlier unchanged coverage includes kill/restart without argv identity, near-limit prompts, >10,000 fragmented chunks with bounded retention/control, authority rejection, streaming intermediate frames/control, and UTF-8 render/composition partition/work properties.

Parity and live steps

Q:/lanes/tui-parity.md records every row's production status; tests/parity_status.json is the reviewable copy. Deferred rows explicitly include breadcrumbs, usage hints, previews, specialized tool renderers, diff pager/changes panel, agent tree/navigation, questions/dock, transcript search/rewind/selection, smooth scrolling/scrollbars, older-history anchoring, hyperlinks, themes/feedback, frame skipping and resize coalescing. Clipboard and external-editor effects are deferred. Shared widget tests do not claim missing production bindings.

Real Windows ConPTY execution remains OS qualification; these executable PTYs ran on Linux. The coordinator runs real Codex-login acceptance after merge.