feat(worker-mcp): raise wait_for_task_change timeout, expose queue slot state

MaxTimeoutSeconds was 170s against runs that take tens of minutes, forcing
a dozen full-context wait rounds per long-running batch. Raise it to 900s
and raise MCP_TOOL_TIMEOUT in lockstep (ClaudeProcess + every
InteractiveLaunchSpecService launch spec) to 930000ms so the client
connection actually stays open that long instead of aborting first.

Add get_queue_state (QueueStateMcpTools): configured vs. effective
parallel-slot count (via QueueService.GetSlotCountsAsync, extracted from
the former GetEffectiveMaxParallelAsync), active slots with taskId +
startedAt including the run_task_now override slot, and queued tasks in
pick order -- so a caller can observe queue occupancy instead of inferring
it from maxParallelExecutions.
This commit is contained in:
mika kuns
2026-08-05 20:47:57 +02:00
parent bdee731376
commit d43b5fcefc
10 changed files with 299 additions and 36 deletions
@@ -241,7 +241,7 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
Assert.Equal(_worktreeDir, spec.Cwd);
Assert.Equal(_claudeStubPath, spec.Exe);
Assert.Equal(new[] { "--resume", "sess-123" }, ArgsAfterEffort(spec));
Assert.Equal("200000", spec.Env["MCP_TOOL_TIMEOUT"]);
Assert.Equal("930000", spec.Env["MCP_TOOL_TIMEOUT"]);
}
[Fact]
@@ -400,7 +400,7 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
Assert.Equal(_tempDir, spec.Cwd);
Assert.Equal(_claudeStubPath, spec.Exe);
Assert.Empty(ArgsAfterEffort(spec));
Assert.Equal("200000", spec.Env["MCP_TOOL_TIMEOUT"]);
Assert.Equal("930000", spec.Env["MCP_TOOL_TIMEOUT"]);
Assert.Empty(_seeder.Calls);
}
@@ -534,7 +534,7 @@ public sealed class InteractiveLaunchSpecServiceTests : IDisposable
Assert.Contains(briefPath, kickoff);
Assert.DoesNotContain('\n', kickoff);
Assert.Equal("200000", spec.Env["MCP_TOOL_TIMEOUT"]);
Assert.Equal("930000", spec.Env["MCP_TOOL_TIMEOUT"]);
}
[Fact]