Skip to content

node: pull-through outer deadline equals the per-candidate stream timeout — multi-provider fallback is dead under timeout-shaped failures #859

Closed

Description

@thiras

Severity: MEDIUM — from the 2026-06-10 full-repository review (#831/#834 surface).

Location

  • crates/node/src/runtime/mod.rs:925-927 — attach_pull_through(Duration::from_secs(cfg.cache.node_pull_timeout_sec)) (outer deadline)
  • crates/node/src/runtime/mod.rs:1293 — NodeOriginConfig.pull_timeout = the same value (per-candidate)
  • crates/node/src/handlers/client.rs:297-320 — try_pull_through wraps the whole fetch in the outer timeout
  • crates/node/src/node_origin.rs:334-339 — sequential MAX_PROVIDER_ATTEMPTS loop

Scenario

Candidate #1 stalls. Its per-candidate stream_fetch timeout and the handler's outer timeout fire at the same instant; the outer one cancels the whole NodeOrigin::fetch future — candidates #2..N are never tried and the partial work is dropped (cache not filled either). The advertised N-provider fallback only functions for fast failures (connect refused, immediate error).

Not a duplicate

Not on any open issue; wiring introduced with #831/#834.

Fix direction

Make the per-candidate timeout a fraction of the outer deadline (or budget the outer deadline across attempts); optionally let the pull continue in the background to fill the cache after the delivery path gives up.

Activity

  1. added
    kind:bug
    prio:medium
    rust
    on Jun 10, 2026
  2. github-actions commented on Jun 10, 2026

    @github-actions

    🎯 Triage report

    The outer try_pull_through deadline in client.rs and the per-candidate pull_timeout in NodeOriginConfig are sourced from the same config value (node_pull_timeout_sec), so they always expire simultaneously. When candidate #1 hits a slow-stall failure, the outer deadline cancels the entire NodeOrigin::fetch future before the sequential MAX_PROVIDER_ATTEMPTS loop can reach candidates #2..N. The N-provider fallback is therefore only effective for fast failures (connect refused, immediate protocol error). Introduced in #831/#834.

    📊 Assessment

    Dimension Value Reasoning
    Type Bug Correct behavior (N-provider fallback) is silently broken under a specific failure shape
    Labels bug, medium, rust (already set) Appropriate — no additions needed
    Coding agent Suitable Root cause pinpointed, file + line locations given, fix direction is stated; the only open choice is which timeout-budget strategy to adopt
    💡 Notes and suggestions

    Root cause recap

    attach_pull_through is called with Duration::from_secs(cfg.cache.node_pull_timeout_sec) as the outer deadline, and NodeOriginConfig.pull_timeout is set to the same value. Inside NodeOrigin::fetch, the sequential loop calls stream_fetch with pull_timeout per candidate. When both clocks start at the same moment, they expire together, and tokio::time::timeout on the outer future wins the race and drops the in-progress fetch.

    Fix options (ascending complexity)

    1. Fractional per-candidate timeout — set NodeOriginConfig.pull_timeout = outer_deadline / MAX_PROVIDER_ATTEMPTS. Simple; works when attempts are uniform.
    2. Elapsed-budget per-candidate timeout — before each stream_fetch call, compute remaining = outer_deadline − elapsed and use that as the candidate's deadline. More accurate but requires threading a deadline instant into NodeOrigin::fetch.
    3. Background cache-fill — after the delivery path gives up, spawn a detached task to continue the fetch and fill the cache for future requests. Orthogonal to options 1/2; adds resilience but more complexity.

    Suggested sub-tasks

    Key files

    • crates/node/src/runtime/mod.rs lines 925–927, 1293
    • crates/node/src/handlers/client.rs lines 297–320
    • crates/node/src/node_origin.rs lines 334–339

    Generated by Agentic Triage for issue #859 · sonnet46 525.9K · ◷

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. self-assigned this
    on Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:bugprio:mediumrust

Type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions