Skip to content

Fix AIR live log polling correctness - #6694

Merged
stevenchen-db merged 7 commits into
mainfrom
air-log-tail-correctness
Sep 16, 2026
Merged

stevenchen-db merged 7 commits into
mainfrom
air-log-tail-correctness

Conversation

@stevenchen-db

Copy link
Copy Markdown
Contributor

Summary

  • poll Bricklens at a fixed one-second rate without adding another sleep after slow requests
  • retain a bounded lookback and deduplicate records so late and out-of-order logs are not dropped or repeated
  • wait for consecutive empty terminal polls so recently emitted records can become searchable
  • bound existing logs when attaching to an active run while preserving explicit --minutes behavior

This matches the AIR Python CLI behavior in databricks-eng/universe#2611686.

Validation

  • ./task lint-q
  • focused AIR command tests with -count=1
  • AIR logs and run-watch caller tests with -count=1
  • GOFLAGS=-buildvcs=false ./task build

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 838f580

Run: 35145772100

Env ✅​pass 🙈​skip Time
✅​ aws linux 276 17 4:22
✅​ aws windows 278 15 3:33
✅​ azure linux 275 17 4:02
✅​ azure windows 277 15 3:43
✅​ gcp linux 276 17 4:25
✅​ gcp windows 278 15 3:37
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:39 azure windows TestAccept
3:35 gcp windows TestAccept
3:30 aws windows TestAccept

}
}
if remember && st.lastNano != 0 {
st.fromSec = max(st.streamStartSec, st.lastNano/1_000_000_000-int64(bricklensLogLookback/time.Second))

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.

Initial tail may leak omitted history:

After printing the newest N records, the code moves fromSec back by 30 seconds but remembers only those N records. The next poll fetches the overlap and prints older, omitted records as if they were new.

Example: an active run has lines 1, 2, 3; --tail 2 can print 2, 3, then 1 on the next poll.

This defeats both the line limit and chronological ordering. The Python implementation has the same bug, so the Go port matches it but is not independently correct.

(not from this PR but may be relevant) Go’s --tail 0 diverges from Python: Go accepts it and later prints the backlog, while Python rejects zero.

@caroline-db caroline-db 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.

implementation looks good but some tests still need to be updated to reflect the new help text and to fail for --tail 0.

@stevenchen-db
stevenchen-db added this pull request to the merge queue Sep 16, 2026
Merged via the queue into main with commit d256263 Sep 16, 2026
34 checks passed
@stevenchen-db
stevenchen-db deleted the air-log-tail-correctness branch September 16, 2026 21:46
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.

3 participants