mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-07 16:09:43 +02:00
fix(cases): bounded path probe landing fixes (#516)
- hooks-config: a probe the bulk cap refused gets ONE bounded re-probe past the cap (probeBeforeTouching), and whatever is still unknown is skipped. The per-spawn hook and statusLine helpers used to fall back to an unbounded lstat/readFile there, which on a dead workspace never settled and could take the last threadpool workers (and hang the boot hook sweep). New test: cap engaged, stat/lstat/readFile hanging on two more paths; both helpers return. - describeUnknownPath()/unknownPathReason(): POST /api/sessions, quick-start and GET /api/cases/:name now say a folder was not checked (other mounts are still not answering) instead of blaming a healthy folder at the stall ceiling. errorCodes unchanged. - #535 x #516: Create in a custom folder probes the parent through the bounded probe before realpath/stat/lstat/readdir touch it; an unknown parent is 422 OPERATION_FAILED (UNREACHABLE) within the probe timeout. New test. - Docs: MAX_STALLED default is 2 (follows UV_THREADPOOL_SIZE), CaseInfo .unreachable covers a refused probe, the boot sweep skips an unanswering workspace, a CLAUDE.md gotcha for bounded probes, verbs.md documents the 422 (plugin mirror synced), api-reference documents the custom-folder 422. - Tests: the launcher case-lookup describe is no longer nested in the Grok block, and the cap-below-ceiling test no longer depends on an inherited UV_THREADPOOL_SIZE / CODEMAN_PATH_PROBE_MAX_STALLED. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,9 @@
|
||||
* probe is still bounded and still recorded as stalled if it hangs (so a dead
|
||||
* path costs at most one worker however often it is retried), but it is not
|
||||
* refused just because unrelated mounts are dead. Bulk scans (the case list)
|
||||
* and per-spawn helpers keep the cap. `pastCap` still stops at
|
||||
* keep the cap; the per-spawn hook and statusLine helpers retry one refused
|
||||
* probe past it and then skip a path that still answers "unknown", rather than
|
||||
* touch it with an unbounded call. `pastCap` still stops at
|
||||
* `PATH_PROBE_STALL_CEILING` (the threadpool size minus one), so explicit
|
||||
* requests against several dead paths can never take the last worker.
|
||||
*
|
||||
@@ -203,6 +205,31 @@ export async function probePathKind(path: string, options: PathProbeOptions = {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Why a probe of `path` answers "unknown" right now: its mount is not answering
|
||||
* (`'stalled'`, it is near a stalled probe), new probes are refused because enough
|
||||
* UNRELATED paths are stalled (`'refused'`; `pastCap` picks which limit applies), or
|
||||
* neither, so the filesystem answered with an error such as EACCES or EIO
|
||||
* (`'unreadable'`). For messages only: it reads the state now, not at probe time.
|
||||
*/
|
||||
export function unknownPathReason(path: string, options: PathProbeOptions = {}): 'stalled' | 'refused' | 'unreadable' {
|
||||
if (isNearStalledPath(path)) return 'stalled';
|
||||
if (stalled.size >= (options.pastCap ? PATH_PROBE_STALL_CEILING : MAX_STALLED_PATH_PROBES)) return 'refused';
|
||||
return 'unreadable';
|
||||
}
|
||||
|
||||
/**
|
||||
* User-facing sentence for an "unknown" probe of `path` (`label` names it, e.g.
|
||||
* "workingDir"). A refused probe says so, rather than blaming a folder that was never
|
||||
* checked: at the ceiling every new folder reads "unknown" until a dead mount answers.
|
||||
*/
|
||||
export function describeUnknownPath(label: string, path: string, options: PathProbeOptions = {}): string {
|
||||
return unknownPathReason(path, options) === 'refused'
|
||||
? `${label} was not checked: folders on other unreachable mounts are still not answering, ` +
|
||||
`so Codeman is not checking new folders until one does (see the server log): ${path}`
|
||||
: `${label} is not responding or not readable: ${path}`;
|
||||
}
|
||||
|
||||
/** Tri-state probe of `path`; see the module comment for what "unknown" means. */
|
||||
export async function probePath(path: string, options: PathProbeOptions = {}): Promise<PathProbeState> {
|
||||
const kind = await probePathKind(path, options);
|
||||
|
||||
Reference in New Issue
Block a user