Skip to content

refactor(dispatch): replace the code outline database with dispatch-time file checks - #6776

Merged
hurttlocker merged 3 commits into
mainfrom
del/skeleton-dispatch-checks
Nov 25, 2026
Merged

hurttlocker merged 3 commits into
mainfrom
del/skeleton-dispatch-checks

Conversation

@hurttlocker

Copy link
Copy Markdown
Collaborator

Owner decision 2026-11-24 (item 16): replace the code outline ("skeleton") database with checks run at dispatch or gate time. The data was a month stale, and autoscan ran git diff and git ls-files every 30 s per repository.

New: src/lib/repo-files/lookup.ts

Every check runs only for the files a task names, when the task is dispatched or the lane reaches the merge gate:

  • git ls-files, cached per repository until HEAD or the Git index changes (key: HEAD contents plus index inode, size and mtime).
  • Line counts and export lines, read from the files (at most 64 files, 2 MB each).
  • One git grep -o for importers. PCRE is tried first, with ERE as the fallback; each match is resolved back to a path, so a shared basename does not count as an importer.
  • Base-branch line counts for the merge gate, read with one git cat-file --batch.
  • All of it is async and bounded at 2 s (5 s at the merge gate). When a check can't finish, it returns no facts instead of blocking dispatch. Nothing runs on a timer.

Consumers

Consumer Now
Overlap hold (computePredictedFiles / filterOverlappingPackets) Predicts from the tracked-path list. Behaviour fix: a single queued task is now also held against a running task that names the same file. Before, a wave of one skipped the check.
Read budget The targets' own imports, one hop.
Edge-case sites Imports plus importers, scanned fresh. The per-file disk cache is gone.
Preservation envelope, file-size guard Line counts and exports of the named files. These were file and directory matches; they are now file-level only.
Merge gate line counts Changed files' line counts on the base branch. New files have no budget, as before.
Targets panel, o8_targets MCP tool Removed. Keeping it means reading every source file and searching importers per request. On this repo that is about 5,600 files and 870k lines per request, roughly 0.6 s, plus the importer pass. No native or phone surface calls it.
Code Map in src/lib/llm/context.ts Its caller is live (/api/v2/proxy/llm, which the phone's action route uses). The section rendered the whole-repo symbol map, which has no cheap fresh replacement, so the prompt now always uses the file tree it already fell back to.

Read budget and edge-case checks run once per task and file list, so the 10 s headless tick does not search the repository again for a queued task that found nothing.

Cost (o8 repo, 10,026 tracked files, median of 5)

  • Per dispatched task naming three files: about 77 ms (importer git grep 75 ms, file reads 1–2 ms, cached path list 0.3 ms).
  • Path list after a HEAD or index change: about 33 ms, once.
  • Merge gate base line counts: about 18 ms.
  • Resting work removed: the skeleton-autoscan loop (git diff plus git ls-files every 30 s per registered repository), the scans on repo add, clone, create, repoint, open and bootstrap, and about 1,800 outline lines loaded at server startup.

Removed

src/lib/skeleton (scanner, parser, store, renderer, chunker, import graph, autoscan), /api/panel/skeleton, /api/panel/targets with src/lib/targeting and the o8_targets MCP tool. Tables stay on disk.

Tests

  • New tests/dispatch-file-checks-real-path.test.ts, run against a real Git repo:
    • two tasks naming the same file are held apart, including against a running task
    • tasks naming different files run together
    • a newly staged file appears once the index changes
    • imports, importers (not a same-basename file), read budget, edge-case sites and envelope are read from the files
    • base line counts leave new files out
    • outside a repository, no facts come back
  • merge-gate.test.ts passes without a pre-scan.
  • Tests of the deleted modules were removed, along with one compiler-loading case for the skeleton scan.
  • Quarantined under Real-path suites drifted on main because they only run when their own files change #6761: three delegate-dispatch-merge cases and one ws-work-soak case. They are already recorded there as failing on main; I removed their skeleton seeding, so the queue will select these files.
  • Local: typecheck:fast, lint, hermetic units, the nine enumerating suites and the focused dispatch tests pass. In verify:ci's changed-file integration run, require-approval-merge (21 cases) and one implementation-notes case fail locally with "the current application CLI could not be built or verified". They fail the same way on main in this checkout.

🤖 Generated with Claude Code

…ime file checks

Owner decision 2026-11-24: agents search files on demand, so the outline
("skeleton") database goes. Its data was a month stale, and autoscan ran
`git diff` and `git ls-files` every 30 s per repository.

Each consumer now reads the files a task names, at dispatch or gate time,
through src/lib/repo-files/lookup.ts:
- `git ls-files`, cached per repository until HEAD or the index changes
- line counts and export lines read from the files
- one `git grep` (PCRE, ERE fallback) for importers
- async and time-bounded (2 s); never on a timer

Consumers:
- overlap hold: predicted files come from the tracked-path list; a single
  queued task is now also held against a running task naming the same file
- read budget, edge-case sites: the targets' own imports and their importers;
  each runs once per task and file list, not on every headless tick
- preservation envelope and file-size guard: line counts and exports of the
  named files (file-level mentions only)
- merge gate: line counts of changed files at the base branch, one
  `git cat-file --batch`

Removed: src/lib/skeleton (scanner, store, autoscan, renderer), the scans on
repo add, clone, create, repoint, open and bootstrap, /api/panel/skeleton,
the Targets panel route with src/lib/targeting and the `o8_targets` MCP tool,
and the Code Map in the chat system prompt (it now uses the file tree it
already fell back to). Database tables stay on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hurttlocker hurttlocker added the tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional label Nov 25, 2026
@github-actions github-actions Bot added the size/XL Pull request with XL diff size label Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🔍 PR Review Bot

Metric Value
Files changed 58
Additions +592
Deletions -3807
New files 2

⚠️ Large files (>300 lines changed)

  • src/lib/repo-files/lookup.ts — +301/-0
  • src/lib/skeleton/chunker.ts — +0/-308
  • src/lib/skeleton/parser.ts — +0/-329
  • src/lib/skeleton/store.ts — +0/-439

Note: This PR touches 58 files. Consider splitting into smaller PRs.


Automated review — CI workflow

@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
… default

The queue ran require-approval-merge and implementation-notes for the first
time since #6185 made new projects PR-first; a hosted baseline on main fails
the same 22 cases (run 45530887277). The require-approval fixtures now opt the
default project into direct integration, and the worker-notes case asserts its
subject (no diff-budget blocker) instead of a merge the PR-first and
durable-review gates hold. One slow spoken-review merge case gets 60 s.

Also pins that a missed or timed-out base line-count lookup gives the merge
gate no count, so no budget, as an outline-database miss did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
@hurttlocker

Copy link
Copy Markdown
Collaborator Author

Queue failure (run 45529692712) was main drift, not the merge gate: a hosted baseline of main's code with only a comment changed (#6777, run 45530887277, job 138925612348) failed the same 21 require-approval-merge cases and the implementation-notes case. Merges were refused with pr_only (projects default to PR-first since #6185); on this branch the diff-budget check passed in the worker-notes case. b28bf28 opts the fixtures into direct merges, keeps the worker-notes case on its budget assertion, and adds a test that a missed or timed-out base lookup gives no budget, as a database miss did. Locally: 27/27 in the two files, 6/6 in dispatch-file-checks.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Nov 25, 2026
@hurttlocker hurttlocker added tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional and removed tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional labels Nov 25, 2026
@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
The queue's Linux runner finished `git cat-file` inside the 1 ms floor that a
spent deadline still got, so the merge gate received a correct line count from
a lookup that should not have run. A spent deadline now returns no facts before
Git starts, for both the batch reader and plain Git reads.

The test forces each miss deterministically (absent ref, missing repository,
spent deadline with a cleared path cache) and checks the same read with time
left does count the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hurttlocker hurttlocker added tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional and removed tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional labels Nov 25, 2026
@hurttlocker
hurttlocker added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 4d16838 Nov 25, 2026
39 of 41 checks passed
@hurttlocker
hurttlocker deleted the del/skeleton-dispatch-checks branch November 25, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL Pull request with XL diff size tests-removed-ok Human-reviewed: test deletions/assertion loss are intentional

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant