fix: /compact masked by room role header in both runners

prependRoomRoleHeader was called BEFORE /compact detection, turning
"/compact" into "[PAIRED ROOM: owner]\n/compact" which failed the
exact match check. Now session commands are detected first.
This commit is contained in:
Eyejoker
2026-03-29 21:14:04 +09:00
parent 83ddc4faff
commit 787c05a561
2 changed files with 14 additions and 7 deletions

View File

@@ -504,7 +504,8 @@ async function main(): Promise<void> {
/* ignore */
}
let prompt = containerInput.prompt;
const rawPrompt = containerInput.prompt;
let prompt = rawPrompt;
if (containerInput.isScheduledTask) {
prompt = `[SCHEDULED TASK]\n\n${prompt}`;
}
@@ -512,7 +513,12 @@ async function main(): Promise<void> {
if (pending.length > 0) {
prompt += '\n' + pending.join('\n');
}
prompt = prependRoomRoleHeader(prompt, containerInput.roomRoleContext);
// Prepend room role header AFTER checking for session commands,
// so /compact is not masked by the header prefix.
const isSessionCommand = rawPrompt.trim() === '/compact';
if (!isSessionCommand) {
prompt = prependRoomRoleHeader(prompt, containerInput.roomRoleContext);
}
try {
log('Runtime selected: app-server');