Remote checks compile only the agent's own files

A check that touched a header recompiled every unit including it (dozens),
which saturated the server while agents worked in parallel. Checks are
feedback; the submission's verification still compiles all dependents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNwtXPYqFu3oKaaXwYwNWW
This commit is contained in:
Saty 2026-10-18 04:44:25 +02:00
commit 9253c439ad
2 changed files with 6 additions and 3 deletions

View file

@ -65,8 +65,9 @@ export class CheckQueue {
let state = 'done';
let result;
try {
const { check, rec } = await this.verifier.check(files, `check-${job.user_id}-${job.id}`);
const { check, rec, changedHeaders } = await this.verifier.check(files, `check-${job.user_id}-${job.id}`, { dependents: false });
result = { gate: 'ok', head: this.repo.head(), ...summarizeCheck(check, rec, new Set(Object.keys(files))) };
if (changedHeaders?.length) result.note = 'Header changes: this check compiled only your own files. The submission is also checked against every file that includes the changed headers.';
} catch (e) {
state = 'failed';
result = { error: e.message };

View file

@ -79,12 +79,14 @@ export class Verifier {
* Compiles `files` (already merged onto HEAD) plus every unit they can affect
* and compares against the current target version.
*/
async check(files, jobName, { allUnits = false, timeoutMs = null } = {}) {
// dependents: false compiles only the submitted units, not every unit that includes a changed
// header (remote checks: quick feedback; the submission's verification still checks them all).
async check(files, jobName, { allUnits = false, timeoutMs = null, dependents = true } = {}) {
const changedHeaders = Object.keys(files).filter((f) => !isUnit(f));
const units = new Set(Object.keys(files).filter(isUnit));
const allProjectUnits = () => listSources(this.repo.dir, this.project, { unitsOnly: true });
if (allUnits) for (const u of allProjectUnits()) units.add(u);
else if (changedHeaders.length) {
else if (changedHeaders.length && (dependents || !units.size)) {
// Only units that include a changed header; all of them until a rebuild has recorded dependencies.
const known = this.store.get('SELECT COUNT(*) AS n FROM unit_deps').n > 0;
const ph = changedHeaders.map(() => '?').join(',');