fix(DIS-106): fix timeout test — wrong YAML key + overly strict schema
Some checks failed
CI / build-and-test (ubuntu-latest) (pull_request) Has been cancelled
CI / build-and-test (windows-latest) (pull_request) Has been cancelled
CI / lint (pull_request) Has been cancelled

Two root causes for the failing timeout test:

1. Test config used `workspace_root` instead of `workspaces_root`, causing
   Zod validation to fail silently, so resolveTimeoutMs() fell back to the
   default 120s — the mock's 200ms close event always beat it.

2. Schema enforced `.int()` on claude_timeout_seconds, rejecting the test's
   0.05s fractional value. Removed the integer constraint since sub-second
   timeouts are valid (and useful for testing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Tabeling 2026-04-10 10:22:03 +02:00
parent 661cf12549
commit a1a0c80acc
2 changed files with 3 additions and 3 deletions

View file

@ -4,7 +4,7 @@ export const DisclawConfigSchema = z.object({
workspaces_root: z.string().min(1), workspaces_root: z.string().min(1),
management_channel: z.string().min(1).default("disclaw"), management_channel: z.string().min(1).default("disclaw"),
claude_command: z.string().min(1).default("claude"), claude_command: z.string().min(1).default("claude"),
claude_timeout_seconds: z.number().int().positive().default(120), claude_timeout_seconds: z.number().positive().default(120),
max_concurrent_agents: z.number().int().positive().default(4), max_concurrent_agents: z.number().int().positive().default(4),
env_blocklist: z.array(z.string()).default([]), env_blocklist: z.array(z.string()).default([]),
}); });

View file

@ -207,7 +207,7 @@ describe("RunResult discriminated union", () => {
const configPath = path.join(workspaceDir, "disclaw.yaml"); const configPath = path.join(workspaceDir, "disclaw.yaml");
fs.writeFileSync( fs.writeFileSync(
configPath, configPath,
`workspace_root: /tmp\nmanagement_channel: disclaw\nclaude_command: claude\nclaude_timeout_seconds: 0.05\nmax_concurrent_agents: 4\nenv_blocklist: []\n`, `workspaces_root: /tmp\nmanagement_channel: disclaw\nclaude_command: claude\nclaude_timeout_seconds: 0.05\nmax_concurrent_agents: 4\nenv_blocklist: []\n`,
"utf-8" "utf-8"
); );
@ -253,7 +253,7 @@ describe("RunResult discriminated union", () => {
try { try {
fs.writeFileSync( fs.writeFileSync(
projectConfig, projectConfig,
`workspace_root: /tmp\nmanagement_channel: disclaw\nclaude_command: claude\nclaude_timeout_seconds: 0.05\nmax_concurrent_agents: 4\nenv_blocklist: []\n`, `workspaces_root: /tmp\nmanagement_channel: disclaw\nclaude_command: claude\nclaude_timeout_seconds: 0.05\nmax_concurrent_agents: 4\nenv_blocklist: []\n`,
"utf-8" "utf-8"
); );