Skip to content

feat(agent): add the native agent foundation - #100

Merged
fcoury merged 51 commits into
codersauce:masterfrom
fcoury-oai:feat/agent-native-foundation
Jul 13, 2026
Merged

fcoury merged 51 commits into
codersauce:masterfrom
fcoury-oai:feat/agent-native-foundation

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

Red needs a first-use agent workflow that is safe with unsaved work, usable in small terminal panes, and resilient across terminal disconnects. The previous plugin and terminal surfaces could lose prompt/output visibility, bypass reviewable edits, or diverge from the documented runtime and LSP contracts.

What changed

  • Add schema-pinned ACP v1 transport, bounded framing/cancellation, an isolated proposal filesystem, and bundled OpenAI/Codex companions. Agent reads see unsaved buffers, writes stay off disk until explicitly reviewed and accepted, and red --agent-check [--strict] gives actionable offline setup diagnostics.
  • Add the bundled Agent workflow: Space A/:Agent, lazy backend setup with a masked session-only API-key prompt, a wrapping Unicode-safe multiline composer and bounded history, streamed Markdown conversation panels, permissions, hunk review/conflict handling, attributed history, and selective revert. Narrow-pane scrolling now uses the actual rendered width so wrapped output remains reachable while streaming.
  • Add Unix detach/reattach and crash recovery with bounded/authenticated IPC, native mouse/paste/resize forwarding, wide-character-safe delta rendering, and atomic snapshots. Harden Vim editing, undo/macro/dot-repeat behavior, exact buffer snapshots, and terminal resize paths.
  • Complete the daily-driver LSP edit path with URI/UTF-16/CRLF-correct workspace edits, revision/version/root/symlink checks, safe resource operations, formatting/code actions/rename/signature help/completion, and fair bounded transport behavior.
  • Migrate and validate the Husk plugin surface, transactional reload/quarantine, process isolation, canonical host API and examples; align the docs, release packaging, workflows, and performance/link gates with the shipped runtime.

How to Test

  1. Build and run the focused safety/regression suites:

    cargo build --bins
    cargo test --test acp_conformance --test agent_check --test codex_acp --test openai_acp --test detach --test lsp_lazy -- --test-threads=1
    cargo test --lib plugin::panel::tests:: -- --test-threads=1
    cargo test --lib ui::agent_composer::tests:: -- --test-threads=1

    Expected: ACP callbacks/proposals, adapter failure paths, detach, LSP edits, Markdown reflow/scrolling, and multiline composer regressions pass without real credentials.

  2. Check a fresh profile and the non-happy setup path:

    XDG_CONFIG_HOME="$(mktemp -d)" NO_COLOR=1 target/debug/red --self-check
    XDG_CONFIG_HOME="$(mktemp -d)" NO_COLOR=1 target/debug/red --agent-check --strict

    Expected: every bundled plugin is active and self-check ends with red self-check ok; strict agent-check clearly reports a missing credential/backend instead of silently starting or persisting a secret.

  3. In a disposable workspace with an authenticated backend, open an unsaved file, press Space A, submit a multiline prompt that produces Markdown and an edit, then shrink the pane below 52 columns while output streams. Focus the conversation, scroll up/page/top/bottom, and resize again. Run :AgentReview, accept one hunk and reject another, then save.

    Expected: composer borders/cursor and all wrapped output remain visible and reachable, reading position is stable during streaming, disk is unchanged before acceptance/save, and rejected edits never enter the buffer.

  4. On Linux/macOS, run target/debug/red --detach=smoke <file>, start a turn, detach with Ctrl-\\, reattach with target/debug/red --attach smoke, and finish with target/debug/red --stop smoke.

    Expected: the live session and unsaved state survive reconnect; resize, mouse, paste, and wide Unicode render correctly.

Final local validation passed formatting, strict all-target/all-feature Clippy, all 1,158 Rust tests, the 21 focused panel regressions, Markdown-link self-tests/checks, and git diff --check.

Detach is intentionally Linux/macOS-only, and custom ACP commands are not claimed reviewable; the documented Windows and adapter boundaries remain explicit.

@fcoury

fcoury commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

@codex review

fcoury and others added 29 commits July 13, 2026 13:19
Document the phased roadmap for Vim compatibility, ACP integration,
resilient sessions, and typed plugin compatibility. Define measurable
product contracts and architecture spikes before implementation begins.
@fcoury-oai
fcoury-oai force-pushed the feat/agent-native-foundation branch from a5002b9 to 0d9a8e7 Compare July 13, 2026 16:23
Use the process token SID when protecting Windows session snapshots
and keep platform-specific tests aligned with supported filesystem
behavior.

Remove ACP cancellation and dispatcher timing races, and keep Codex
project trust construction warning-free on every target.
@fcoury
fcoury merged commit 7cdd0f9 into codersauce:master Jul 13, 2026
16 of 18 checks passed
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.

2 participants