Require parent interpreter for persona speech

This commit is contained in:
Meta Vens 2026-06-07 04:18:07 +01:00
commit ccaf856b53
6 changed files with 32 additions and 69 deletions

View file

@ -574,14 +574,6 @@ async function executeRepoPersonaJobWithInterpreter(
});
}
const firstObligationRoute = routeUnparsedWouldSay(firstResponse, firstInterpretation, {
job,
faceOutputText: firstText,
});
if (firstObligationRoute) {
return firstObligationRoute;
}
if (firstInterpretation.decision === "drop") {
return dropRepoPersonaActionBlocks(firstResponse, firstInterpretation);
}
@ -635,14 +627,6 @@ async function executeRepoPersonaJobWithInterpreter(
});
}
const retryObligationRoute = routeUnparsedWouldSay(retryResponse, retryInterpretation, {
job,
faceOutputText: retryText,
});
if (retryObligationRoute) {
return retryObligationRoute;
}
await auditLog.record({
type: "repo_persona.parent_interpreter_drop",
actorId: job.requester.id,
@ -786,59 +770,6 @@ function routeRepoPersonaInterpretedOutput(
};
}
function routeUnparsedWouldSay(
response: ProviderResponse,
interpretation: RepoPersonaParentInterpretation,
input: { job: JobRecord; faceOutputText: string },
): ProviderResponse | undefined {
if (input.job.command !== "repo-persona-rumination") {
return undefined;
}
if (!interpretation.reasons.some((reason) => /parseable reason|did not provide/i.test(reason))) {
return undefined;
}
const content = extractUnconditionalWouldSay(input.faceOutputText);
if (!content || isNonPublicRepoIdentitySpeech(content)) {
return undefined;
}
return routeRepoPersonaInterpretedOutput(
response,
{
decision: "route",
reasons: [
"Persona produced an unconditional Would say and the parent interpreter failed to parse a routing reason.",
],
routedOutput: [
"Parent interpreter fallback: routed unconditional Persona Would say.",
"",
"SAY",
"identity: current_persona_id",
"channel: current_room",
"reply_to:",
"content:",
...content.split(/\r?\n/).map((line) => ` ${line}`),
"END",
].join("\n"),
},
input,
);
}
function extractUnconditionalWouldSay(outputText: string): string | undefined {
const match = outputText.match(/(?:^|\n)Would say:\s*([\s\S]*?)(?=\n\n[A-Z][A-Za-z /-]{2,}:|\n\nWhat should stick:|\n\nWork\/proposal:|\n\nPrivate thought:|$)/i);
const content = match?.[1]?.trim();
if (!content) {
return undefined;
}
const normalized = content.toLowerCase().replace(/^["'`]+|["'`]+$/g, "").trim();
if (/^(nothing|nothing public|nothing right now|stay private|no public speech)\b/.test(normalized)) {
return undefined;
}
return content;
}
function normalizeInterpretedRepoPersonaSpeechDestinations(
outputText: string,
input: { job: JobRecord; faceOutputText: string },