fix: bootstrap role prompts into resumed sessions

This commit is contained in:
ejclaw
2026-05-25 21:12:03 +09:00
parent 3595a37f1f
commit 48d58a3324
3 changed files with 282 additions and 5 deletions

View File

@@ -12,6 +12,10 @@ import {
prepareReadonlySessionEnvironment,
prepareGroupEnvironment,
} from './agent-runner-environment.js';
import {
preparePromptIngestion,
recordPromptIngestion,
} from './agent-prompt-ingestion.js';
import { runSpawnedAgentProcess } from './agent-runner-process.js';
import { getStoredRoomSkillOverrides } from './db.js';
export {
@@ -164,6 +168,19 @@ export async function runAgentProcess(
'Spawning agent process',
);
const runnerInput: AgentInput = {
...input,
...(group.agentConfig?.codexGoals === true ? { codexGoals: true } : {}),
};
const promptIngestion = preparePromptIngestion({
agentType: group.agentType || 'claude-code',
env,
prompt: runnerInput.prompt,
sessionId: runnerInput.sessionId,
memoryBriefing: runnerInput.memoryBriefing,
});
runnerInput.prompt = promptIngestion.prompt;
const logsDir = path.join(groupDir, 'logs');
fs.mkdirSync(logsDir, { recursive: true });
@@ -176,10 +193,6 @@ export async function runAgentProcess(
onProcess(proc, processName, env.EJCLAW_IPC_DIR);
const runnerInput: AgentInput = {
...input,
...(group.agentConfig?.codexGoals === true ? { codexGoals: true } : {}),
};
proc.stdin.write(JSON.stringify(runnerInput));
proc.stdin.end();
@@ -191,6 +204,11 @@ export async function runAgentProcess(
logsDir,
startTime,
onOutput,
}).then(resolve);
}).then((result) => {
if (result.status === 'success') {
recordPromptIngestion(promptIngestion);
}
resolve(result);
});
});
}