Skip to content

feat(share): make the upload timeout settable, and raise the default - #248

Merged
bdelanghe merged 2 commits into
bdelanghe/wipfrom
feat/share-timeout
Aug 28, 2026
Merged

feat(share): make the upload timeout settable, and raise the default#248
bdelanghe merged 2 commits into
bdelanghe/wipfrom
feat/share-timeout

Conversation

@bdelanghe

@bdelanghe bdelanghe commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

One flat 30s covered every pathbase call. That is a fine ceiling for the small ones — auth, listing repos, deleting a graph — and the wrong one for an upload: a long agent session derives to several MB and the whole document goes up in a single request.

Hit for real against a loopback server, which is the case that should never time out. The message it produces is the tell:

request timed out after 30s — try again, or shrink the upload

You cannot shrink a conversation that already happened, so the advice has nowhere to go and the session is quietly dropped — in a tool whose whole job is not dropping sessions. The autoload sweep hit the same wall every ten minutes with the same result.

What changed

  • Default 30s → 300s.
  • --timeout <SECS> on share.
  • PATH_HTTP_TIMEOUT_SECS for every command, including those with no flag of their own — which is what a launchd agent or a cron sweep can reach.

Set via the environment in run() rather than threaded as a Duration: the eight pathbase_client call sites are all small requests that never needed a knob, and giving each one a parameter to pass along would be noise at every site. It is applied before any client is constructed.

Scope

This raises a ceiling; it does not make an upload fast. A 4MB document taking more than 30s against loopback is its own question, answered separately in empathic/pathbase#414 — the API runs a debug build under the hot-reload service, and unoptimised serde_json is roughly an order of magnitude slower. That PR optimises dependencies; this one stops the client giving up while it works.

Verified

cargo check -p path-cli passes. Not exercised end-to-end against a real slow upload yet — the pathbase half has to land first for that to be a meaningful test.

Checklist

  1. Independent PR — no bundled or speculative changes
    • Verified: the timeout constant, one flag, one env var
  2. Changed codepaths verified — targeted unit and full integration tests
    • Verified: cargo check -p path-cli
  3. Root cause identified — every failure traced to source
    • A single hardcoded Duration::from_secs(30) in pathbase_client, applied uniformly to calls with very different payload sizes
  4. No duplication — refactoring preferred over copy/paste
    • One http_timeout() helper, one call site for it
  5. No unrelated changes — housekeeping isolated to its own branch
    • N/A

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

One flat 30s covered every pathbase call. That is a fine ceiling for the
small ones — auth, listing repos, deleting a graph — and the wrong one
for an upload: a long agent session derives to several MB and the whole
document goes up in a single request.

Hit for real against a LOOPBACK server, which is the case that should
never time out. The message it produces is the tell:

    request timed out after 30s — try again, or shrink the upload

You cannot shrink a conversation that already happened, so the advice has
nowhere to go, and a session gets quietly dropped rather than stored —
in a tool whose whole job is not dropping sessions. The autoload sweep
hit the same wall every ten minutes with the same result.

Default is now 300s, and `--timeout <SECS>` on `share` overrides it.
`PATH_HTTP_TIMEOUT_SECS` does the same for every command, including the
ones with no flag of their own — which is what a launchd agent or a cron
sweep can reach.

Set via the environment rather than threaded as a Duration: the eight
`pathbase_client` call sites are all small requests that never needed a
knob, and giving them one to pass along would be noise at each of them.
`run` sets it before any client is constructed.

Note this raises a ceiling; it does not make an upload fast. A 4 MB
document taking more than 30s against loopback is its own question — the
API is a debug build under the hot-reload service, which is the first
thing to check.
@bdelanghe
bdelanghe marked this pull request as draft August 28, 2026 18:12
`ShareArgs` gained `timeout`, and the test helper that builds one was not
updated, so the test target failed to compile:

    error[E0063]: missing field `timeout` in initializer of
                  `cmd_share::ShareArgs`

CI reported it as `FAIL: test` with 7/8 gates passing — the library and
binary built fine, only the test build broke, which is why it was easy to
miss locally.

None rather than a value: `run` applies this to the environment before any
client is constructed, so it is never read on the path these tests take.
Asserting against a knob they do not exercise would be theatre.
@github-actions

Copy link
Copy Markdown

🔍 Preview deployed: https://2b8cbe32.toolpath.pages.dev

@bdelanghe
bdelanghe marked this pull request as ready for review August 28, 2026 18:34
@bdelanghe
bdelanghe merged commit 5b5238a into bdelanghe/wip Aug 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant