Repository navigation
Description
Problem
An mcpx adapter spec (or one of its tools) with a negative timeout — e.g. "timeout": "-5s" — passes Spec.Validate() cleanly, then makes every call of that tool fail instantly with a misleading timeout error, even for a command that finishes in milliseconds.
Evidence (main 5ac81cae, pkgs/mcpx/internal/adapter/adapter.go, blob fbd12f85)
adapter.go:148-158—parseDurationreturns whatevertime.ParseDurationaccepts; negative durations parse without error.adapter.go:105andadapter.go:137-139—Spec.Validate()checks the server and per-tool timeouts only for a parse error, so"-5s"and"-1ns"validate fine. Validation is documented as catching "the kind [of failure] that would otherwise surface as a confusing command line" (adapter.go:94-97) — this is exactly that kind, and it slips through.adapter.go:230-234—Runselects the timeout:timeout, _ := parseDuration(spec.Timeout, 0); the server fallback applies only whentimeout == 0, so a negative tool timeout is used as-is.context.WithTimeout(ctx, -5s)returns a context that is already expired.adapter.go:237,256-260—exec.CommandContextwith the born-expired context fails immediately,cctx.Err() != nil, and the caller is told"<server>.<tool> did not finish within -5s"— the command never really ran, and the message blames its speed.
Verification (this run)
Laptop probe ~/git/fleet/probe-2026-10-28-laneA-adapter-negtimeout/ (Go 1.26.8, on the laptop per the no-sandbox-builds rule): parseDuration copied verbatim from the blob above, plus a mirror of Run's timeout selection / WithTimeout / CommandContext flow running echo hi:
- Control:
timeout=5s→out="hi", no error. - Case:
timeout=-5s→ Validate-equivalent check passes (err=nil); the run fails instantly withdid not finish within -5sand empty output. - Case: tool
timeout=-1nswith servertimeout=5s→ still fails instantly; the non-zero negative value suppresses the server fallback.
Why it matters
Adapter specs are user/declaration files. A single typo (-5s, or a templated value that goes negative) produces a spec that every static check accepts and that then fails 100% of calls with an error message pointing at the tool's execution time rather than at the config — the hardest kind of misconfiguration to diagnose from the caller's side.
Acceptance criteria
-
Spec.Validate()rejects a negative timeout at both the server level and the per-tool level, naming the offending value (and a negative value can no longer reachRun). - The pinned behaviour for
timeout: "0s"/"0"is stated in a comment or doc atparseDuration/Run: today0at tool level silently means "use the server timeout"; whatever is decided (keep, or reject), a test pins it. - Regression tests in
internal/adapter: negative server timeout refused, negative tool timeout refused, positive timeout still runs a trivial command to completion. - Existing
internal/adaptertests still pass (laptop or CI).
Scope / triage notes
- Fix site is
pkgs/mcpx/internal/adapteronly. Sibling duration parsers exist elsewhere (e.g.internal/settingsKindDuration,internal/execsvc); whether they share the rule is a triage question — do not silently widen this issue to them. - Not self-solved by the filing lane: the
0-timeout semantics above are a small contract decision for triage, and the fix should land through the queue with the adapter tests.
Activity
developing-today commentedon Oct 28, 2026
CODE-713
dezren39 commentedon Oct 28, 2026
🤖 Agent note · filed
parseDurationaccepts negative durations,Spec.Validate()passes them, andRun's born-expiredWithTimeoutcontext fails every call with a misleading timeout message. Evidence and probe results are in the issue body.0ssemantics), then a small fix ininternal/adapterwith regression tests.hidden_files/queue-packets/packet-1758.json(goal workspace); probe~/git/fleet/probe-2026-10-28-laneA-adapter-negtimeout/(laptop)34 remaining items
dezren39 commentedon Oct 28, 2026
Agent note — parked (CI pending)
testsuite, treefmt, Nix, spec parity, all conformance server/client jobs). Onlycompare with the records(mcpx conformance) still QUEUED since 18:49Z — runner-bound, not a failure. No required status checks are configured on main.dezren39 commentedon Oct 28, 2026
🤖 Agent note · picked up
testsuite and treefmt, 2 skipping), merge state CLEAN — merging under the standing criteria and completing the taskfix(mcpx): adapter refuses negative timeouts, zero is unset (#1758) (#…
dezren39 commentedon Oct 28, 2026
🤖 Agent note · done
e561ab58(2026-10-28T19:25Z) after all 15 checks passed (full mcpx test suite, conformance matrix, treefmt, flake evaluation); issue auto-closed by the merge. Adapter now refuses negative timeouts in Validate with the offending value named, and zero is pinned as unset (tool inherits server, server defaults 60s), per the contract triage task 1984 pinned.e561ab58ff76ea8e84f2b9a1f108770ebe44a734