fix: use dynamic message lookup for model/agent context in prompts

Instead of using stale parentModel/parentAgent from task state, now
dynamically looks up the current message to get fresh model/agent values.
Applied across all prompt injection points:
- background-agent notifyParentSession
- ralph-loop continuation
- sisyphus-orchestrator boulder continuation
- sisyphus-task resume

🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) assistance
This commit is contained in:
justsisyphus
2026-01-14 18:55:46 +09:00
parent acdb0d8f2b
commit d86917de04
5 changed files with 170 additions and 77 deletions
+7
View File
@@ -407,10 +407,17 @@ export function createSisyphusOrchestratorHook(
try {
log(`[${HOOK_NAME}] Injecting boulder continuation`, { sessionID, planName, remaining })
const messageDir = getMessageDir(sessionID)
const currentMessage = messageDir ? findNearestMessageWithFields(messageDir) : null
const model = currentMessage?.model?.providerID && currentMessage?.model?.modelID
? { providerID: currentMessage.model.providerID, modelID: currentMessage.model.modelID }
: undefined
await ctx.client.session.prompt({
path: { id: sessionID },
body: {
agent: "orchestrator-sisyphus",
...(model !== undefined ? { model } : {}),
parts: [{ type: "text", text: prompt }],
},
query: { directory: ctx.directory },