fix(ralph-loop): guard delayed start snapshots
Prevent delayed loop-start message counts from overwriting active Ralph Loop state after the loop has already advanced, so ULW completion can still enter Oracle verification instead of iterating forever. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -73,6 +73,11 @@ export function createRalphLoopHook(
|
||||
return startSuccess
|
||||
}
|
||||
|
||||
const startedState = loopState.getState()
|
||||
const expectedStartedAt = startedState?.session_id === sessionID
|
||||
? startedState.started_at
|
||||
: undefined
|
||||
|
||||
ctx.client.session
|
||||
.messages({
|
||||
path: { id: sessionID },
|
||||
@@ -80,7 +85,7 @@ export function createRalphLoopHook(
|
||||
})
|
||||
.then((messagesResponse: unknown) => {
|
||||
const messageCountAtStart = getMessageCountFromResponse(messagesResponse)
|
||||
loopState.setMessageCountAtStart(sessionID, messageCountAtStart)
|
||||
loopState.setMessageCountAtStart(sessionID, messageCountAtStart, expectedStartedAt)
|
||||
})
|
||||
.catch(() => {})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user