Skip to content

Limit skills telemetry auth wait to 500 ms - #8332

Merged
simonfaltum merged 2 commits into
mainfrom
simon-faltum_data/stack/telewait-skills-telemetry-wait
Dec 3, 2026
Merged

simonfaltum merged 2 commits into
mainfrom
simon-faltum_data/stack/telewait-skills-telemetry-wait

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

🥞 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. TelemetryAuth gets an optional per-command Budget; cmd/skills sets it to 500 ms. The shared root.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 read often, so any wait at exit adds up. I measured the wait on skills read (25 runs per scenario after 2 warm-ups, built from main, local stub servers, CLAUDECODE=1):

Scenario Median (ms) p95 (ms) Added median vs telemetry off (ms) Added p95 (ms)
Telemetry off 9 10 0 0
On, PAT auth 9 11 0 +1
On, no auth 8 9 -1 -2
On, auth slower than 3 s 3011 3011 +3002 +3001
On, auth 5 s 3012 3015 +3003 +3004

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

  • The 500 ms cap prioritizes skills latency over telemetry from auth that takes 0.5–3 s. A cold host-metadata lookup canceled before it returns does not populate its one-hour cache, so repeated skills calls can each pay 500 ms and lose their event until another command warms that cache. Slow credential helpers and token requests can also lose every event. The earlier 3 s limit allowed those events to finish.
  • The upload timeout is unchanged; this PR does not cap the whole process exit at 500 ms.

Tests

  • cmd/root: a command's own Budget bounds 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/aitools and the cmd/skills and cmd/aitools acceptance areas pass.

This pull request and its description were written by Isaac.

@simonfaltum
simonfaltum marked this pull request as ready for review December 2, 2026 22:18
@simonfaltum
simonfaltum requested review from a team as code owners December 2, 2026 22:18
@simonfaltum
simonfaltum requested review from denik, parthban-db and rclarey and removed request for parthban-db December 2, 2026 22:18
@simonfaltum

Copy link
Copy Markdown
Member Author

🤖 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)

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. The 500 ms cap only covers the auth wait. Once auth resolves, telemetry.Upload (cmd/root/root.go:289) still runs under defaultUploadTimeout (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, like hintOnlyUploadTimeout, or should the title and description say only the auth phase is capped? (non-blocking)

Comment thread cmd/root/telemetry_auth.go Resolved
Comment thread cmd/skills/telemetry_test.go Resolved
Comment thread cmd/skills/telemetry.go Resolved
Comment thread cmd/root/telemetry_auth.go Resolved
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 1d67a16

Run: 47093852226

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 61 6 1:31
✅​ aws-windows-latest-4core-16gb 61 6 3:03
✅​ azure linux-2core-8gb 61 6 1:21
✅​ azure-windows-latest-4core-16gb 61 6 2:44
✅​ gcp linux-2core-8gb 61 6 1:28
✅​ gcp-windows-latest-4core-16gb 61 6 2:14
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:02 aws-windows-latest-4core-16gb TestAccept
2:42 azure-windows-latest-4core-16gb TestAccept
2:13 gcp-windows-latest-4core-16gb TestAccept

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum force-pushed the simon-faltum_data/stack/telewait-skills-telemetry-wait branch from 9e1fff6 to d7557b2 Compare December 3, 2026 05:55

@denik denik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 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-ext handler that never answers. RunE returned in 0.35 ms, but the run took 3.01 s and ended with uploading telemetry logs timed out. So with a slow or unreachable workspace, every skills read still blocks for defaultUploadTimeout (3 s, libs/telemetry/logger.go:168) after auth resolves. uploadTimeout already 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)

  1. Nit, cmd/root/telemetry_auth_test.go:101: the stopwatch starts after PreRunE has set the deadline, so the 90 ms lower bound leaves 10 ms for whatever runs in between. A pause on a loaded -race runner can fail a correct implementation. Taking start before PreRunE makes elapsed >= Budget hold exactly. The same applies to cmd/skills/telemetry_test.go:144, which has a 100 ms margin.

Comment thread cmd/skills/telemetry.go Resolved
@denik
denik requested review from a team and denik December 3, 2026 09:25
Comment thread cmd/skills/telemetry.go Resolved
@simonfaltum simonfaltum changed the title [DECO-29941] Cut the skills telemetry exit wait from 3 s to 500 ms Limit skills telemetry auth wait to 500 ms Dec 3, 2026
@simonfaltum
simonfaltum enabled auto-merge December 3, 2026 11:22
@simonfaltum
simonfaltum added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 5a25fb7 Dec 3, 2026
25 checks passed
@simonfaltum
simonfaltum deleted the simon-faltum_data/stack/telewait-skills-telemetry-wait branch December 3, 2026 11:45
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.

4 participants