Skip to content

id(cli): module_trust_keys test stack-overflows on host runs (unbounded recursion), aborts full-lib suite #5216

Closed

Description

@dezren39

Observed 2026-11-03 on the laptop (amd-6) while reproducing #5195 — unrelated subsystem, filed so it exists as a tracked problem:

cli::tests::module_trust_keys_are_repeatable_and_require_world_mode stack-overflows and aborts the whole lib test binary on host runs:

thread 'cli::tests::module_trust_keys_are_repeatable_and_require_world_mode' has overflowed its stack
fatal runtime error: stack overflow, aborting

Evidence:

  • Reproduces in isolation (--exact) on the current-main lib binary and on several pre-existing primary-built lib binaries under ~/git/code/pkgs/id/target/debug/deps/ (id-6ef43893fd006436, id-b87063fabef9c143, id-ba32ff1f3cf2d9e3, id-cf7e07685103fdc8, id-d3684de534d38795, id-d6065620e2eebd91).
  • Still overflows with RUST_TEST_THREAD_STACK_SIZE=67108864 (64 MiB test-thread stack) — the recursion reads as unbounded, not merely deep.
  • Independent of working directory and of test-thread count.
  • Per the id(world_net): inbound_refusal_backpressures test is flaky — intermittent "a pre-auth refusal sheds the stream" #5195 record, the nix build .#id-web sandbox check phase the same day ran 3294 tests / 0 failed, so the trigger is host-environment-specific (something about the host filesystem/HOME the test walks, that the sandbox does not present).

Impact: any full cargo test -p id --lib run on the host aborts mid-suite, so host full-suite verification of the id package is currently impossible without skipping this test.

Acceptance: the test passes on host runs (or terminates with an ordinary failure, never a process abort), with the recursion source named in the closing comment; the nix check phase stays green.

Acceptance criteria

  • cli::tests::module_trust_keys_are_repeatable_and_require_world_mode completes without stack overflow on a host (laptop) run, in isolation (--exact) and inside the full cargo test -p id --lib suite, which runs to completion instead of aborting.
  • The unbounded recursion is identified and bounded at its source (named in the closing comment) — not masked by a larger test-thread stack.
  • The nix build .#id-web check phase stays green (it currently passes; the fix must not regress the sandbox run).

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    on Nov 4, 2026
  2. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    Broader than first filed: the overflow is a family across the whole cli module, not one test. Skipping tests one at a time surfaced, in order:

    • cli::tests::source_only_mode_is_opt_in_and_requires_world_mode — same stack overflow / abort.
    • cli::tests::test_cli_parse_cat_aliases — same (a plain CLI parse test).
    • cli::world_limits_args_tests::flag_defaults_match_the_built_in_limits and cli::world_limits_args_tests::flags_override_each_bound — same.

    Every crasher builds the clap command/args tree, which points at shared CLI-construction code recursing on something host-specific (the sandbox check phase passes these same tests). Full-lib host runs currently need --skip cli:: to complete at all.

  3. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    One more data point, same session: with the whole cli:: prefix skipped, the next crasher is commands::serve::tests::serve_server_config_flag_defaults_to_none — also a clap-tree-building test. The family is "every test that builds the CLI command tree", across cli::tests, cli::world_limits_args_tests, and commands::serve::tests so far. Root cause should be looked for in shared command construction (something it scans or expands on this host that the sandbox does not present).

  4. added
    priority/highImportant and time-sensitive
    effort/sSmall: expected under 2 hours of work
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Nov 4, 2026
  5. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    Intake review

    Related: Found while reproducing #5195 (different subsystem — flaky world_net test).

    Notes: Host-only failure with strong evidence: reproduces in isolation on current-main and on several pre-existing lib binaries, persists at a 64 MiB test-thread stack, while the nix sandbox check phase passed 3294 tests the same day — so the trigger is host-environment-specific (something in the host environment feeds the recursion: config, keyring, or filesystem state the sandbox lacks). No merged PR resolves this (filed 2026-11-04T00:19Z from the #5195 reproduction session; merged-PR search this run: none). Risks: a stack-size bump would mask it — the acceptance bars that. Suggested approach: get a backtrace under gdb/lldb or add a recursion-depth probe, and diff host vs sandbox inputs to the trust-key walk.

    — fleet monitor intake (protocol §5), 2026-11-03 18:12 CST run. Verified still live this run per the notes above.

  6. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 4, 2026
  7. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    Agent note — task 9468 triaged

  8. 6 remaining items

  9. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  10. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · triaged → fixed and verified on the host; closing as done

    Evidence (measured on the laptop host, 2026-11-08)

    Root cause, as recorded by the fix. #5216 and its duplicate #4751 are the same bug: clap's derive-generated augment_subcommands chain (Cli -> Command -> WorldCommand) summed the argument-construction frames of the largest struct-style variants, exceeding the 2 MiB debug test-thread stack. Finite, not infinite recursion — which is why the earlier "unbounded recursion" reading (and the 64 MiB RUST_TEST_THREAD_STACK_SIZE observation) was a symptom, not the mechanism.

    Fix. PR #5329 (fix(id): bound clap derive stack use in CLI parse path) extracted the largest variants into their own Args structs — Command::Serve → Serve(ServeArgs), and 24 WorldCommand variants with ≥4 flags → World<Name>Args tuple variants. Production source change, not a bigger test stack.

    Verification this shift, on the host (not the sandbox):

    • Every crasher named in this issue's comments now passes in isolation (--exact) on current-main lib binaries:
      • cli::tests::module_trust_keys_are_repeatable_and_require_world_mode — ok (0.03 s)
      • cli::tests::source_only_mode_is_opt_in_and_requires_world_mode — ok
      • cli::tests::test_cli_parse_cat_aliases — ok
      • cli::world_limits_args_tests::flag_defaults_match_the_built_in_limits — ok
      • cli::world_limits_args_tests::flags_override_each_bound — ok
      • commands::serve::tests::serve_server_config_flag_defaults_to_none — ok
    • Full cargo test -p id --lib suite on the host now runs to completion — the exact thing this issue said was impossible without --skip cli:::
      test result: FAILED. 2403 passed; 2 failed; 6 ignored; 0 measured; 0 filtered out; finished in 108.63s
    • No stack overflow, no abort, no SIGABRT anywhere in the run (the only "overflow" matches in the log are unrelated test names, e.g. test_print_peek_chars_huge_n_no_overflow, all passing).
    • The 2 remaining failures are pre-existing and unrelated — world::tests::schedule_tests::a_fire_the_program_refuses_stays_pending_in_the_journal and …::replay_reproduces_the_pending_and_fired_sets, both failing at src/world/tests.rs:7140/7232 with journal event at sequence 1 uses participant 1 before it was issued. Confirmed failing identically on three independently built lib binaries (id-760dacb082a3999a, id-b0320cda7123d9d3, id-07f2b3ab9a075be7), so they belong to the world-journal subsystem, not to this issue. They are not caused by this fix and are not in this issue's scope.

    Disposition

    Acceptance met: the test passes on host runs, isolation and inside the full suite; the recursion source is named (clap derive augment_subcommands frame growth, bounded by the Args-struct extraction in #5329); the nix check phase was green at the fix's merge and nothing here changes it. Closing #5216 as fixed. Pre-existing world-journal failures above should be filed separately if not already tracked — they are a different defect.

  11. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  12. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    Agent note - already done. Agent: repo queue worker, lane code-j (repo-worker-code). Task: task 11147 for issue #5216. Fresh revalidation: issue #5216 CLOSED (stateReason COMPLETED, closedAt 2026-11-08T13:03:23Z), no queue/status/work labels present. Completing task 11147 as already_done. agent-note:v1 agent=repo-worker-code lane=code-j state=done task=11147

  13. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor
    Lane code-y picked up task 11147 (small_fix, issue #5216). Fresh check: issue #5216 is CLOSED with no held labels. Execution lane assigned: opencode — handed off to the opencode claimant (checkpoint stage handed_off); the bound session drives task 11147 to its terminal state (prior verified checkpoint: complete as already_done).
  14. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    on Nov 9, 2026
  15. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 agent=repo-worker-code lane=code-f state=done task=11147 at=2026-11-09T14:12Z — Task 11147 (small_fix, issue #5216) completed as already_done by lane code-f. Fresh evidence: issue #5216 is CLOSED with stateReason COMPLETED, closed 2026-11-08T13:03:23Z by developing-today[bot] (no closing commit). No PR was opened or needed for this task; the opencode lane assignment (row 5594) is moot on a closed issue. Completing the queue task with outcome already_done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)meta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/highImportant and time-sensitivequeue/claimedQueue worker lifecycle statequeue/parkedQueue task is parked (waiting on CI, time, or an event)status/in-progressQueue worker lifecycle statestatus/parkedDeliberately paused with a recorded resume conditiontask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions