fix: make sessionExists() async with SDK verification on SQLite

sessionExists() previously returned unconditional true on SQLite,
preventing ralph-loop orphaned-session cleanup from triggering.
Now uses sdkClient.session.messages() to verify session actually
exists. Callers updated to await the async result.

Addresses Cubic review feedback on PR #1837.
This commit is contained in:
YeonGyu-Kim
2026-02-15 19:23:05 +09:00
parent 3bbe0cbb1d
commit 11586445cf
4 changed files with 16 additions and 8 deletions

View File

@@ -122,7 +122,7 @@ export function createSessionHooks(args: {
? safeHook("ralph-loop", () =>
createRalphLoopHook(ctx, {
config: pluginConfig.ralph_loop,
checkSessionExists: async (sessionId) => sessionExists(sessionId),
checkSessionExists: async (sessionId) => await sessionExists(sessionId),
}))
: null