Skip to content

[LIT-2879] Wave 1: tool surface + run loop + e2e PR test#1

Draft
ishaan-berri wants to merge 9 commits into
mainfrom
feat/wave-1-run-loop
Draft

[LIT-2879] Wave 1: tool surface + run loop + e2e PR test#1
ishaan-berri wants to merge 9 commits into
mainfrom
feat/wave-1-run-loop

Conversation

@ishaan-berri
Copy link
Copy Markdown
Contributor

Linear

LIT-2879 (Epic C — Agent runtime daemon)

What this PR ships (Wave 1 of 3)

The minimum viable daemon that:

  • Boots in session mode
  • Registers with the proxy via /v2/sessions/{sid}/internal/register
  • Clones a repo (file:// or https with token-injected URL)
  • Runs the LLM tool loop (Anthropic SDK, also works against an Anthropic-compatible LiteLLM proxy via ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN)
  • Executes tool calls locally (read_file / str_replace / shell / grep / glob / todo)
  • Streams events back via /v2/sessions/{sid}/runs/{rid}/events:append
  • Has a thin gh pr create wrapper ready for end-of-run PR opening (not invoked yet — wired up but the LLM decides when to call it via the shell tool, or Wave 2 adds the autoCreatePr flag)

Validation passing

  • pnpm typecheck — clean
  • tests/e2e/fix-typo.test.ts — daemon spawns, registers with an in-process mock proxy, clones a tiny throwaway file:// repo, drives the real LLM through the str_replace tool to fix a typo, and emits the expected event sequence (run_started → assistant_message → tool_call → tool_result → run_finished). Verified the file edit actually landed on disk.

Sample local run output (see PR commits for full logs):

```
[daemon] daemon.starting mode=session sessionId=sess_test_e2e
[daemon] session.registered
[daemon] git.clone.done ref=main
[daemon] loop.request iteration=0..4
[daemon] loop.end_turn iterations=4
[daemon] daemon.exited_cleanly
PASS tests/e2e/fix-typo.test.ts (12.6s)
```

Deferred to Wave 2

  • .cursor/skills/ + .cursor/hooks.json + .cursor/mcp.json harness loaders
  • Warm mode (LITELLM_AGENT_MODE=warm) — entrypoint already routes by mode; warm body throws "reserved for Wave 2"
  • Multi-run within a session (workspace persistence is implicit; explicit poll/loop semantics for long-lived sessions)
  • Production hydrate path (currently reads LITELLM_HYDRATE_JSON env so the e2e harness can inject; production register-response inline TBD)
  • autoCreatePr flag wired into the run loop (helper already exists)

Deferred to Wave 3

  • Validations #5 (skills) #6 (hooks) #7 (MCP) #8 (per-team secrets) #9 (network allowlist iptables) #11 (warm mode integration)
  • Real EC2 boot via Packer AMI (gated on Epic B merge)
  • Daemon restart resilience (validation #10)

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.

1 participant