feat(cell): source-code investigation tools (PR 1) - #138
Merged
Conversation
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
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
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-bashrun inside the DO; no Cloudflare Containers, no dynamic workers). This PR is the cell foundation, built to the three confirmed decisions:checkout_repofetchesgithub.com/<owner>/<repo>as a tarball and untars into an in-DO store; plus writesRECENT_COMMITS.mdfrom the commits API (recent changes without git history).checkout_repois a tool the agent calls on demand (after telemetry points at a service); investigations that don't touch code cost nothing.service: '*'(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-onlycheckout_repo/list_dir/read_file/grep_code+ a seed-prompt addendum ("consult code only after telemetry points at a service; cite file paths").investigationDO/realTurn: composed with the APM executors, offered only when repos are configured, gated byserverInvestigations.REPOS_JSON(+ optionalGITHUB_TOKEN) for now; PR 2 threads them from app Settings.parseRepo/resolveRepoForService(service mapping + wildcard) /stripTopDir.Activate
Needs a cell redeploy and
REPOS_JSONset 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