Repository navigation
Limit skills telemetry auth wait to 500 ms - #8332
Conversation
|
🤖 Hi @denik, this PR is part of our skills-telemetry work. We talked it through with Russell Clarey from eng-deco-cli here: #8158 (review) |
There was a problem hiding this comment.
Automated review at 9e1fff6. Each finding was verified against the code.
No blocking issues found. 4 non-blocking comment(s) and 1 question(s) below.
This PR adds an optional per-command Budget to root.TelemetryAuth and sets it to 500 ms for the skills commands, so they stop waiting up to 3 s for background auth at exit. The other commands still use the shared 3 s default. The mechanism looks correct: the budget is read in PreRunE after recordRuns sets it, and the new root test does show a per-command budget bounding the wait. What remains is stale doc comments, a skills test that doesn't exercise the wiring, and a debug line that no longer logs the budget. There's also an open question about the 3 s upload timeout that still runs after auth.
Questions
- The 500 ms cap only covers the auth wait. Once auth resolves,
telemetry.Upload(cmd/root/root.go:289) still runs underdefaultUploadTimeout(3 s,libs/telemetry/logger.go:168). So a skills run whose auth resolves at 450 ms against a slow workspace can still block for about 3.5 s at exit. Should the skills event also get a shorter upload timeout, likehintOnlyUploadTimeout, or should the title and description say only the auth phase is capped? (non-blocking)
✅ Integration test reportCommit: 1d67a16
Top 3 slowest tests (at least 2 minutes):
|
Co-authored-by: Isaac <no-reply@databricks.com>
9e1fff6 to
d7557b2
Compare
denik
left a comment
There was a problem hiding this comment.
🤖 Automated review of d7557b2 by Opus 5.5, Fable 5.2 and GPT-6.2 Astra; each finding verified against the code.
The Budget field is a small change in the right place, and the new skills test does check the wiring: without auth.Budget = telemetryAuthBudget it fails after 60 s. One should-fix, posted inline, is about what the 500 ms cap costs when auth is cold or slow.
Review points
- +1 to review-oss-bot's open question about the upload timeout, with a measurement. A scratch test used an instant resolver and a
/telemetry-exthandler that never answers.RunEreturned in 0.35 ms, but the run took 3.01 s and ended withuploading telemetry logs timed out. So with a slow or unreachable workspace, everyskills readstill blocks fordefaultUploadTimeout(3 s,libs/telemetry/logger.go:168) after auth resolves.uploadTimeoutalready gives batches of install-hint events alone 1 s (hintOnlyUploadTimeout). Batches of skills events alone could get the same treatment, or the title could say that only the auth wait is capped.
Other findings (not inline)
- Nit,
cmd/root/telemetry_auth_test.go:101: the stopwatch starts afterPreRunEhas set the deadline, so the 90 ms lower bound leaves 10 ms for whatever runs in between. A pause on a loaded-racerunner can fail a correct implementation. TakingstartbeforePreRunEmakeselapsed >= Budgethold exactly. The same applies tocmd/skills/telemetry_test.go:144, which has a 100 ms margin.
🥞 Stacked PR
Use this link to review incremental changes.
Changes
The skills commands now wait at most 500 ms from the start of the run for the background auth their telemetry upload needs, down from 3 s.
TelemetryAuthgets an optional per-commandBudget;cmd/skillssets it to 500 ms. The sharedroot.TelemetryAuthBudget(3 s) is unchanged, so the aitools commands behave as before. A resolution that is still unfinished at the cap drops the event. The cap covers auth only; the subsequent upload still has its existing 3 s timeout.Why
An agent calls
databricks skills readoften, so any wait at exit adds up. I measured the wait onskills read(25 runs per scenario after 2 warm-ups, built from main, local stub servers,CLAUDECODE=1):Fast auth added nothing and every event uploaded. The wait only costs time when auth is unfinished at exit, and then it is the full budget on every call, with the event lost anyway. Decision (Simon): cap it at about 500 ms and keep dropping slow-auth events. Not measured: a real OAuth or credential-helper profile, and a real workspace round trip.
Decisions to review
Tests
cmd/root: a command's ownBudgetbounds the wait and a slow resolution is dropped; the existing tests cover a finished resolution still uploading.cmd/skills: the cap is 500 ms and below the shared budget.go test ./cmd/root ./cmd/skills ./cmd/aitoolsand thecmd/skillsandcmd/aitoolsacceptance areas pass.This pull request and its description were written by Isaac.