Repository navigation
Description
Summary
Two id world CLI commands turn an unchecked u64 seconds argument into a deadline by adding it to an Instant, and a huge value panics the process with overflow when adding duration to instant instead of being refused or clamped:
id world logs --seconds <huge>—pkgs/id/src/commands/world.rs:563-564:let deadline = tokio::time::Instant::now() + std::time::Duration::from_secs(seconds.max(1));
secondsis a plain clapu64(pkgs/id/src/cli.rs:1820-1828,--seconds, default 5, no range). The deadline is computed after connect + join, so the command connects successfully and then crashes with a panic.id world mirror --timeout-secs <huge>—pkgs/id/src/commands/world.rs:152buildsDuration::from_secs(timeout_secs.max(1))(--timeout-secs, plainu64,pkgs/id/src/cli.rs:1490-1491) and passes it tocrate::world_records::replicate, which atpkgs/id/src/world_records.rs:218computes:The earlierlet deadline = std::time::Instant::now() + timeout;
tokio::time::timeout(timeout, …)atworld_records.rs:205survives huge durations (tokio caps its internal deadline — verified), so the panic lands on the stdInstantaddition at :218, after the initial sync has already run.
Evidence (verified this run, main 5a34fa70)
Laptop probe crate ~/git/fleet/probe-2026-10-29-logsinstant/ (verbatim deadline expressions):
std::time::Instant::now() + Duration::from_secs(u64::MAX)→ panicsoverflow when adding duration to instant, exit 101.tokio::time::Instant::now() + Duration::from_secs(u64::MAX)→ same panic, tokio 1.54.1 attokio/src/time/instant.rs:161(id'sCargo.lockpins tokio 1.53.2, same documented panic-on-overflow semantics).- Control:
Duration::from_secs(86400)deadline computes normally, exit 0. tokio::time::timeout(Duration::from_secs(u64::MAX), …)does not panic (completes normally) — confirming Mirror's crash site is the std addition atworld_records.rs:218, not the timeout at :205.
Other Instant::now() + … sites in the crate use constants or internal durations (world_compile.rs:296 uses the COMPILE_TIMEOUT constant; event_store/sync.rs:314, store.rs:124 fixed values) and are not user-reachable with arbitrary values — only these two CLI paths are.
Why it matters
A typo'd or script-generated --seconds 99999999999999999999-class value crashes the CLI with a Rust panic (exit 101, backtrace hint) instead of a clean "value too large" error, in one case after a successful connect/join and in the other after the initial sync. It is the same unchecked-seconds shape the fleet has been filing in mcpx (#2231/#2351/#2368), here in the id CLI's own argument surface.
Acceptance criteria
-
id world logs --seconds 18446744073709551615no longer panics: it is either refused at parse time with a message naming--seconds, or clamped to a documented maximum deadline. -
id world mirror --timeout-secs 18446744073709551615no longer panics atworld_records.rs:218(same rule: refuse or clamp, naming--timeout-secs). - The chosen rule is applied consistently at both sites (one shared helper or identical clap
value_parserrange), and the maximum is documented in the--helptext or the error message. - Regression tests: a unit test for the clamp/refusal at the boundary value, and existing
world logs/world mirrorargument-parsing tests still pass. - Normal values are unchanged:
--seconds 5(default) and--timeout-secs 30(default) behave exactly as before.
Dedup
Searched open + closed issues for "world logs", "logs seconds", "Instant overflow": no covering issue. #2125 (peers --depth=-1) is a different argument/mechanism; #2231/#2351/#2368 are mcpx (TypeScript) duration ceilings in other code paths.
Activity
developing-today commentedon Oct 29, 2026
CODE-1220
dezren39 commentedon Oct 29, 2026
🤖 Agent note · filed
id world logs --seconds(commands/world.rs:563-564) andid world mirror --timeout-secs(world_records.rs:218); pin refuse-vs-clamp and route a small_fix packet.3 remaining items
dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
--secondsand--timeout-secsoptions, with boundary coverage. Fresh issue state is OPEN and no matching open PR was found; no branch/worktree exists yet (to be inspected before creation).dezren39 commentedon Nov 2, 2026
🤖 Agent note · done
d95c80d76c7d238caf0f92c5fdb732c999888f5eMerge pull request #4178 from developing-today/queue/5271-2396-world-…