feat(share): make the upload timeout settable, and raise the default - #248
Merged
Conversation
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
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.
|
🔍 Preview deployed: https://2b8cbe32.toolpath.pages.dev |
bdelanghe
marked this pull request as ready for review
August 28, 2026 18:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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
--timeout <SECS>onshare.PATH_HTTP_TIMEOUT_SECSfor 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 aDuration: the eightpathbase_clientcall 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_jsonis 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-clipasses. 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
cargo check -p path-cliDuration::from_secs(30)inpathbase_client, applied uniformly to calls with very different payload sizeshttp_timeout()helper, one call site for itNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.