Guard swarm maintenance launches

This commit is contained in:
Meta Vens 2026-06-11 16:39:06 +01:00
commit 51025596f6
3 changed files with 34 additions and 1 deletions

View file

@ -656,6 +656,7 @@ interface RepoFaceParentInterpretation {
decision: "route" | "retry" | "drop";
reasons: string[];
routedOutput?: string;
artifacts?: ProviderArtifact[];
}
async function interpretRepoFaceTurnOutput(
@ -680,7 +681,10 @@ async function interpretRepoFaceTurnOutput(
};
const response = await executeProviderForJob(provider, job, interpreterContext, "interpreter");
const interpretationText = normalizeModelText(response.outputText ?? response.summary);
return parseRepoFaceParentInterpretation(interpretationText, input.attempt, outputText);
return {
...parseRepoFaceParentInterpretation(interpretationText, input.attempt, outputText),
artifacts: prefixProviderArtifacts(`interpreter-attempt-${input.attempt}`, response.artifacts ?? []),
};
}
async function renderRepoFaceDynamicMemoryRecall(
@ -904,6 +908,10 @@ function routeRepoFaceInterpretedOutput(
...response,
outputText: summary,
summary,
artifacts: [
...(response.artifacts ?? []),
...(interpretation.artifacts ?? []),
],
metadata: {
...(response.metadata ?? {}),
repoFaceParentInterpreterDecision: interpretation.decision,
@ -1013,6 +1021,10 @@ function dropRepoFaceActionBlocks(
...response,
outputText: privateSummary,
summary: privateSummary,
artifacts: [
...(response.artifacts ?? []),
...(interpretation.artifacts ?? []),
],
metadata: {
...(response.metadata ?? {}),
repoFaceParentInterpreterDecision: interpretation.decision,
@ -1021,6 +1033,13 @@ function dropRepoFaceActionBlocks(
};
}
function prefixProviderArtifacts(prefix: string, artifacts: ProviderArtifact[]): ProviderArtifact[] {
return artifacts.map((artifact) => ({
...artifact,
name: `${prefix}-${artifact.name}`,
}));
}
function repoFaceHeartbeatCodexOptions(job: JobRecord, role: "face" | "interpreter"): Record<string, string> {
if (job.command !== "repo-face-rumination") {
return {};

View file

@ -823,6 +823,14 @@ async function maybeStartRepoFaceMemoryMaintenance(input: {
try {
await mkdir(paths.statusDir, { recursive: true });
await mkdir(paths.logDir, { recursive: true });
const launchedAt = new Date();
await writeJsonFile(paths.statusPath, {
status: "starting",
startedAt: launchedAt.toISOString(),
stateFile: input.statePath,
launcher: "repo_face_heartbeat",
reason: input.projectedRest.isNapping ? "repo_face_napping_with_short_term_memory" : "repo_face_stale_short_term_memory",
});
const child = spawn(
"powershell.exe",
[
@ -889,6 +897,11 @@ async function readJsonFile(path: string): Promise<Record<string, unknown> | und
}
}
async function writeJsonFile(path: string, value: unknown): Promise<void> {
await mkdir(dirname(path), { recursive: true });
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, "utf8");
}
function isRecentRunningStatus(status: Record<string, unknown> | undefined, maxAgeMinutes: number): boolean {
if (status?.status !== "running" && status?.status !== "running_skip_model" && status?.status !== "starting") {
return false;

View file

@ -342,3 +342,4 @@
{"ts":"2026-06-09T15:22:34Z","type":"implementation","status":"ok","note":"2026-06-09 swarm wake repair: unpaused state/agent-swarm-paused.json, pointed local Face heartbeat default back to Aquarium, disabled the expensive state-projector path locally, limited heartbeat selection to one job/tick, made buildChannelPlan prefer the configured default channel unless a pending mention supplies a source channel, added Interpreter prompt guidance plus worker fallback for bare compact SAY candidates, and manually verified Epiphany spoke in Aquarium via registered webhook message 1513922884798513392."}
{"ts":"2026-06-09T15:28:15Z","type":"verification","status":"ok","note":"After rebuilding and starting a fresh worker from apps/worker/dist/index.js, a live repo-face-rumination job e20403ee-d3f8-4191-93ae-4ef69f71f803 parsed say=1 and posted Huginn to Aquarium channel 1501196543150264332 via webhook message 1513926584904450130. This verifies the swarm speech rail is no longer silently swallowing all Face turns."}
{"ts":"2026-06-09T17:05:08Z","type":"verification","status":"ok","note":"Tightened repo Face speech boundary after live fallback leaked private silence text like 'nothing public yet' into Discord. isNonPublicRepoIdentitySpeech now rejects qualified silence/no-public/stay-private phrases, the bare Interpreter fallback rejects the same routing language, and agents:speech-boundary-smoke covers 'nothing public yet. I want one real specimen first.' plus 'No public line. Silence is cleaner here.' Fresh worker PID 29364 is running rebuilt apps/worker/dist/index.js."}
{"ts":"2026-06-11T15:37:42Z","type":"implementation","status":"ok","note":"Swarm health check on 2026-06-11 found bot/worker alive and repo Face turns completing, but repeated repo_face_memory_maintenance_started events were caused by heartbeat spawn success being treated as ownership even when target repo maintenance status files were missing or stale. Heartbeat now writes a repo-local starting marker before launch, and worker job artifacts now preserve parent Interpreter artifacts under interpreter-attempt-* names so quiet turns can be audited from the job artifact folder."}