Skip to content

feat(cell): source-code investigation tools (PR 1) - #138

Merged
coccyx merged 3 commits into
masterfrom
code-investigation
Aug 15, 2026
Merged

feat(cell): source-code investigation tools (PR 1)#138
coccyx merged 3 commits into
masterfrom
code-investigation

Conversation

@coccyx

@coccyx coccyx commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Lets the server-side investigator read a service's source once telemetry has narrowed to it — the design's PR 12 / Phase 8, now viable per spike S3 (celld-native: @cloudflare/computer's SQLite vfs + just-bash run inside the DO; no Cloudflare Containers, no dynamic workers). This PR is the cell foundation, built to the three confirmed decisions:

  1. Tarballcheckout_repo fetches github.com/<owner>/<repo> as a tarball and untars into an in-DO store; plus writes RECENT_COMMITS.md from the commits API (recent changes without git history).
  2. Lazycheckout_repo is a tool the agent calls on demand (after telemetry points at a service); investigations that don't touch code cost nothing.
  3. Service→repo mapping with a wildcardservice: '*' (or omitted) is a monorepo catch-all (the OTel-Demo-in-one-repo case).

What's here

  • cell/src/workspace/untar.ts (gunzip + minimal tar, no npm dep), repoStore.ts (per-investigation file store in the DO SQLite; reads one file at a time to stay under the in-memory cap; text-only, size/count-capped), checkout.ts (tarball fetch + RECENT_COMMITS.md; parseRepo / resolveRepoForService).
  • cell/src/agent/codeTools.ts — server-only checkout_repo / list_dir / read_file / grep_code + a seed-prompt addendum ("consult code only after telemetry points at a service; cite file paths").
  • Wired in investigationDO/realTurn: composed with the APM executors, offered only when repos are configured, gated by serverInvestigations.
  • Repos from cell env REPOS_JSON (+ optional GITHUB_TOKEN) for now; PR 2 threads them from app Settings.
  • Unit tests: parseRepo / resolveRepoForService (service mapping + wildcard) / stripTopDir.

Activate

Needs a cell redeploy and REPOS_JSON set on the cell, e.g. [{"url":"github.com/open-telemetry/opentelemetry-demo","service":"*"}]. The DO-backed store + live tarball fetch are validated by the cell smoke against a live cell.

Design: docs/research/server-investigations/code-investigation.md.

🤖 Generated with Claude Code

coccyx and others added 3 commits August 14, 2026 19:21
Tarball checkout into an in-DO vfs (per spike S3), lazy checkout_repo
tool, service->repo mapping with a monorepo wildcard, RECENT_COMMITS.md
from the GitHub API. PR breakdown for the build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158jez4WfWj6ttmaxh3HEbT
Lets the server-side investigator read a service's source once telemetry
narrows to it. Celld-native per spike S3 — no Cloudflare Containers, no
dynamic workers.

- workspace/untar.ts: gunzip (DecompressionStream) + minimal tar parse,
  no npm dep. workspace/repoStore.ts: per-investigation file store in the
  DO SQLite, reads one file at a time (stays under the in-memory cap),
  text-only with size/count caps. workspace/checkout.ts: fetch the GitHub
  tarball + write RECENT_COMMITS.md from the commits API;
  service->repo resolution with a `*` monorepo catch-all.
- agent/codeTools.ts: server-only checkout_repo / list_dir / read_file /
  grep_code (lazy — checkout on demand) + a seed-prompt addendum
  ("consult code only after telemetry points at a service; cite paths").
- Wired in investigationDO/realTurn: composed with the APM executors and
  offered only when repos are configured. Repos from cell env REPOS_JSON
  (+ GITHUB_TOKEN) for now; PR 2 threads them from app Settings.
- Unit tests for parseRepo / resolveRepoForService / stripTopDir.

Needs a cell redeploy + REPOS_JSON to activate. Gated by
serverInvestigations like the rest.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158jez4WfWj6ttmaxh3HEbT
…PR 2)

Replaces the cell REPOS_JSON env (autonomous fallback kept) with an
app-configured repo list for interactive investigations.

- Settings → Source repositories: a list editor (url + service; service
  "*"/blank = monorepo catch-all), stored in AppSettings.sourceRepos.
- Transport createInvestigation carries `repos`; InvestigatePage loads
  the list and threads it into both the Investigate-button and the
  new-investigation composer flows.
- Cell: CreateInvestigationBody gains `repos` (wire type SourceRepo);
  coordinator + DO store it in the interactive payload; the code-tool
  wiring and seed addendum use the investigation's repos when present,
  falling back to REPOS_JSON for autonomous runs.

Autonomous (webhook) runs still use the cell env REPOS_JSON — threading
those from Settings is a follow-up. Needs the cell redeploy (PR 1 + this).
Version bump 0.13.35 → 0.13.36.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0158jez4WfWj6ttmaxh3HEbT
@coccyx
coccyx merged commit a8f5980 into master Aug 15, 2026
4 checks passed
@coccyx
coccyx deleted the code-investigation branch August 15, 2026 02:56
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