fix: resolve CI test timeouts with configurable timing

- Add timing.ts module for test-only timing configuration
- Replace hardcoded wait times with getTimingConfig()
- Enable all previously skipped tests (ralph-loop, session-state, delegate-task)
- Tests now complete in ~2s instead of timing out
This commit is contained in:
justsisyphus
2026-01-28 14:17:56 +09:00
parent 1da0adcbe8
commit 6f348a8a5c
5 changed files with 87 additions and 32 deletions
+18 -5
View File
@@ -1,17 +1,30 @@
import { describe, test, expect, beforeEach } from "bun:test"
import { describe, test, expect, beforeEach, afterEach } from "bun:test"
import { DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS, CATEGORY_DESCRIPTIONS, isPlanAgent, PLAN_AGENT_NAMES } from "./constants"
import { resolveCategoryConfig } from "./tools"
import type { CategoryConfig } from "../../config/schema"
import { __resetModelCache } from "../../shared/model-availability"
import { clearSkillCache } from "../../features/opencode-skill-loader/skill-content"
import { __setTimingConfig, __resetTimingConfig } from "./timing"
// Test constants - systemDefaultModel is required by resolveCategoryConfig
const SYSTEM_DEFAULT_MODEL = "anthropic/claude-sonnet-4-5"
describe("sisyphus-task", () => {
beforeEach(() => {
__resetModelCache()
clearSkillCache()
__setTimingConfig({
POLL_INTERVAL_MS: 10,
MIN_STABILITY_TIME_MS: 50,
STABILITY_POLLS_REQUIRED: 1,
WAIT_FOR_SESSION_INTERVAL_MS: 10,
WAIT_FOR_SESSION_TIMEOUT_MS: 1000,
MAX_POLL_TIME_MS: 2000,
SESSION_CONTINUATION_STABILITY_MS: 50,
})
})
afterEach(() => {
__resetTimingConfig()
})
describe("DEFAULT_CATEGORIES", () => {
@@ -533,7 +546,7 @@ describe("sisyphus-task", () => {
})
})
test.skip("DEFAULT_CATEGORIES variant passes to sync session.prompt WITHOUT userCategories", async () => {
test("DEFAULT_CATEGORIES variant passes to sync session.prompt WITHOUT userCategories", async () => {
// #given - NO userCategories, testing DEFAULT_CATEGORIES for sync mode
const { createDelegateTask } = require("./tools")
let promptBody: any
@@ -583,12 +596,12 @@ describe("sisyphus-task", () => {
toolContext
)
// #then - variant MUST be "max" from DEFAULT_CATEGORIES
// #then - variant MUST be "max" from DEFAULT_CATEGORIES (passed as separate field)
expect(promptBody.model).toEqual({
providerID: "anthropic",
modelID: "claude-opus-4-5",
variant: "max",
})
expect(promptBody.variant).toBe("max")
}, { timeout: 20000 })
})