fix: restore baseline validation (#3142)

This commit is contained in:
Alexandre Reyes Martins
2026-08-26 17:15:49 +03:00
committed by GitHub
parent 27377efaf3
commit 8ea94a119f
8 changed files with 9 additions and 74 deletions
@@ -249,6 +249,7 @@ export const createSessionGoalRuntime = ({
getOpenCodeAuthHeaders,
getSmallModelService,
emitGoalNotification,
isEnabled = isSessionGoalEnabled,
idleQuietMs = IDLE_QUIET_MS,
kickoffQuietMs = KICKOFF_QUIET_MS,
maxAutoTurns = MAX_AUTO_TURNS,
@@ -444,7 +445,7 @@ export const createSessionGoalRuntime = ({
};
const tick = async (sessionId, directory) => {
if (!isSessionGoalEnabled()) return;
if (!isEnabled()) return;
const session = await openCodeFetch(`/session/${encodeURIComponent(sessionId)}`, { directory })
.catch((error) => {
@@ -35,13 +35,14 @@ const startIdleTick = async (fetchImpl) => {
buildOpenCodeUrl: (pathname) => `http://opencode.test${pathname}`,
getOpenCodeAuthHeaders: () => ({}),
getSmallModelService,
isEnabled: () => true,
idleQuietMs: 10,
});
runtime.processPayload({
type: 'session.status',
properties: { sessionID: SESSION_ID, status: { type: 'idle' }, directory: DIRECTORY },
});
await vi.advanceTimersByTimeAsync(10);
await vi.runOnlyPendingTimersAsync();
return { runtime, getSmallModelService };
};
@@ -156,6 +157,7 @@ describe('session goal live activity gate', () => {
buildOpenCodeUrl: (pathname) => `http://opencode.test${pathname}`,
getOpenCodeAuthHeaders: () => ({}),
getSmallModelService: async () => service,
isEnabled: () => true,
idleQuietMs: 10,
});
@@ -163,7 +165,7 @@ describe('session goal live activity gate', () => {
type: 'session.status',
properties: { sessionID: SESSION_ID, status: { type: 'idle' }, directory: DIRECTORY },
});
await vi.advanceTimersByTimeAsync(10);
await vi.runOnlyPendingTimersAsync();
expect(service.generateSmallModelText).toHaveBeenCalledOnce();
const patch = requests.find((request) => request.pathname === `/session/${SESSION_ID}` && request.method === 'PATCH');