fix(providers): bound launcher diagnostics without losing byte counts

Give Ghidra and Hopper an 8 MiB aggregate retained-output budget while continuing to drain their process pipes. Expose total observed bytes at the supervisor boundary and retained bytes plus explicit truncation in provider diagnostics.

Redact known transport tokens even when the retained prefix ends inside one, preserving adjacent caller path/query evidence. Existing partial-launch and cleanup ownership remain intact.

Validation: 285 tests across 34 focused suites passed; the final cutoff-fixture refinement passed all 31 Ghidra/Hopper diagnostic tests. check:fast and architecture guards passed. Provider fixtures use real child processes; real Ghidra/Hopper applications were not verified.
This commit is contained in:
morluto
2026-10-11 02:50:06 +08:00
parent cb13a27bfa
commit ba056e08a4
14 changed files with 302 additions and 33 deletions
+9 -3
View File
@@ -76,11 +76,16 @@ export interface ProviderProcessSnapshot {
readonly diagnosticTruncated?: boolean;
readonly stdout: {
readonly text: string;
/** Bytes retained in text, limited by maxDiagnosticBytes when configured. */
readonly bytes: number;
/** All bytes drained from this stream since construction or resetOutput. */
readonly observedBytes: number;
};
readonly stderr: {
readonly text: string;
/** Bytes retained in text, limited by maxDiagnosticBytes when configured. */
readonly bytes: number;
readonly observedBytes: number;
};
readonly exitCode: number | null | undefined;
readonly signal: NodeJS.Signals | null | undefined;
@@ -268,8 +273,8 @@ export class ProviderProcessSupervisor {
snapshot(): ProviderProcessSnapshot {
return {
...(this.#diagnosticTruncated ? { diagnosticTruncated: true } : {}),
stdout: this.#stdout.snapshot(),
stderr: this.#stderr.snapshot(),
stdout: this.#stdout.snapshot(this.#stdoutObservedBytes),
stderr: this.#stderr.snapshot(this.#stderrObservedBytes),
exitCode: this.#exitObservation?.code,
signal: this.#exitObservation?.signal,
};
@@ -488,11 +493,12 @@ class ProcessOutputCapture {
this.#chunks.push(Buffer.from(chunk));
}
snapshot(): ProviderProcessSnapshot["stdout"] {
snapshot(observedBytes: number): ProviderProcessSnapshot["stdout"] {
const text = Buffer.concat(this.#chunks, this.#bytes).toString("utf8");
return {
text,
bytes: this.#bytes,
observedBytes,
};
}
}