Repository navigation
ci(bots): onboard databricks-bot-engine (engineer + reviewer + retrospective) - #179
Conversation
…pective)
Wire the three autonomous bots from databricks/databricks-bot-engine into this
repo, following the engine's "Onboarding a consumer repo" guide and the working
databricks-sql-python consumer, adapted for Rust/cargo.
Composites (.github/actions/):
- install-bot-engine — pip-installs the pinned engine + Claude SDK/CLI, PAT-free
via an engine-scoped App token. Reuses this repo's existing setup-jfrog for the
pip proxy (setup-jfrog covers cargo+pip but not npm, so this points npm at the
JFrog npm proxy using setup-jfrog's minted token).
- bot-prelude — mints the bot + engine-scoped tokens, sets up Node, calls
install-bot-engine. Single source of truth for the engine pin (5368de77).
Workflows (.github/workflows/):
- reviewer-bot / reviewer-bot-followup — review PRs + follow up on replies.
- engineer-bot / engineer-bot-followup — label an issue → reproduce + fix + PR;
follow up on review comments. bug-fix flow; Type=Bug ⇒ --flow bug-fix.
- engineer-bot-learning — on merge of a PR labelled extract-learning, distill a
durable learning and open a PR appending it to the learning log (retrospective
flow). Self-contained (can't `uses:` the internal engine cross-repo).
All gate on fork==false, run in environment: azure-prod on the protected runner.
.bot/ (engineer config + prompts; reviewer is zero-config):
- config.yaml — bug-fix flow, cargo bash_allowlist, retrospective block.
- prompts/engineer{,-followup}, review, retrospective — Rust testing discipline;
the bug-fix prompt REQUIRES a live E2E repro (cargo test --test <s> -- --ignored).
- .claude/knowledge/learning-log.md — seeded log the retrospective appends to.
Live-E2E auth past the engine's env scrub:
- tests/common/mod.rs — shared env_var/live_session with a DATABRICKS_TEST_CONFIG_FILE
fallback (the engine strips *TOKEN* from the agent's cargo-test subprocess, so the
token rides a config file whose path survives the scrub; env var still wins ⇒
rust-e2e.yml + local runs unchanged). engineer-bot.yml writes that file.
- tests/bot_e2e_helper.rs — offline test that compiles tests/common in CI and proves
the fallback. Verified locally: cargo check --tests, cargo test, fmt, clippy all clean.
Additive only — no existing file changed. Inert until the bot App secrets exist +
this merges (triggers register only from the default branch).
Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
Co-authored-by: Isaac
There was a problem hiding this comment.
Verdict: 3 Low
Additive-only CI onboarding of the bot workflows plus two offline Rust test helpers. The executable code is sound — common::live_session matches the existing per-file e2e builders exactly, edition 2021 makes the set_var/remove_var usage safe as commented, and the dev-deps (tempfile/serde_json/tokio) are all declared. A few low-severity nits around the env-var fallback, the duplicated engine-ref pin, and the MODEL_ENDPOINT host-scheme assumption — none blocking.
…rd callout Review findings on #179: - F1 (real): env_var's config-file branch now filters empty values symmetrically with the env branch, so a blank/misprovisioned secret (jq-written "access_token": "") resolves to None → the clear `… required` panic, not a silent AuthConfig::Pat { token: "" } and a confusing server-side auth failure. Add tests/bot_e2e_helper_empty.rs (own binary for a fresh OnceLock) proving it. - F2 (design-inherent): strengthened the engine-ref duplication comment in engineer-bot-learning.yml into an explicit DRIFT HAZARD callout naming both sites to bump together. A CI lint would be over-engineering for a single duplicated literal. - F3 (verified non-issue): MODEL_ENDPOINT concatenation assumes a bare-host DATABRICKS_HOST; confirmed correct — the same pattern works in databricks-sql-python and the same azure-prod secret feeds rust-e2e.yml. No change. Verified: cargo test (both helper binaries), fmt, clippy -D warnings all clean. Signed-off-by: eric-wang-1990 <e.wang@databricks.com> Co-authored-by: Isaac
Security Scan failure is pre-existing and unrelated to this PRThe failing Security Scan check is not caused by this PR and shouldn't block it on the merits of the change:
This is a dependency-hygiene call for the team, best handled in a separate PR against Also addressed the review in 4b37bb2: symmetric empty-value filtering in the config-file fallback (+ a dedicated test), and a stronger drift-hazard callout on the duplicated engine pin. The |
There was a problem hiding this comment.
Verdict: 1 Medium
Additive, well-documented bot onboarding — no existing files touched, and the new common:: E2E helpers faithfully mirror the existing per-file live_session/env_var. One medium concern: tests/bot_e2e_helper_empty.rs doesn't clear DATABRICKS_HOST before asserting on it, so it's non-hermetic for local cargo test runs where that var is configured (as CLAUDE.md documents).
Review (Medium): bot_e2e_helper_empty.rs cleared DATABRICKS_TOKEN but not
DATABRICKS_HOST before asserting env_var("DATABRICKS_HOST") == Some("h.example").
Since env_var prefers a non-empty env value over the config file, a developer
with DATABRICKS_HOST in .cargo/config.toml [env] (per CLAUDE.md) would get their
real host and the assertion would fail on the documented `cargo test` pre-commit
run. It only passed in the Unit + doc tests CI job because that job sets no
connection env.
Clear DATABRICKS_HOST + DATABRICKS_HTTP_PATH up front too, mirroring the sibling
bot_e2e_helper.rs. Verified: the test now passes even with DATABRICKS_HOST set in
the environment.
Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
Co-authored-by: Isaac
An earlier rewrite left a stale half-sentence above the new one: line 1 trailed off at "...named by" and line 2 restated it in full, rendering as two overlapping sentences in rustdoc. Collapse to a single coherent sentence. Doc-only. Signed-off-by: eric-wang-1990 <e.wang@databricks.com> Co-authored-by: Isaac
There was a problem hiding this comment.
Verdict: 2 Medium
Additive-only onboarding of the bot workflows; the Rust helper (tests/common) and its offline tests are sound and well-covered. One consistency/robustness gap: the two engineer workflows (author + followup) call bot-prelude, which pip-installs and runs the engine via python, but omit the Setup Python step that the three sibling workflows and bot-prelude's own documented precondition require — so they rely on an ambient, unpinned python on the protected-runner image.
Addresses: - #3612879461 at .github/workflows/engineer-bot.yml:103 - #3612879465 at .github/workflows/engineer-bot-followup.yml:115 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
The final block's comment said "set the token explicitly" but the code sets DATABRICKS_HOST (asserting env wins over the config file). Say "host". Comment-only. Signed-off-by: eric-wang-1990 <e.wang@databricks.com> Co-authored-by: Isaac
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — an additive, well-commented bots-onboarding PR (workflows, composites, .bot/ prompts, and a config-file-fallback test helper). One low defensive-hardening note on token masking in install-bot-engine. Nit (not inline): the PR description cites the engine pin as 5368de77, but bot-prelude's authoritative engine-ref default is 92b3857996b2fbac5d0573ea89db6be9f0c48b9a — worth reconciling the description so reviewers know which pin is canonical. The tests/common helper and its three offline binaries are cleanly structured (one test per binary to keep the OnceLock fresh, symmetric empty-value filtering, hermetic env teardown).
Addresses: - #3615726645 at .github/actions/install-bot-engine/action.yml:79 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — additive bot onboarding (CI composites/workflows + .bot/ config/prompts + an offline-tested E2E connection helper). The new tests/common/mod.rs helper matches the real kernel API (Session::builder().http_path().auth(AuthConfig::Pat{..}), per src/session.rs) and the existing per-file e2e live_session(); each helper test is its own integration binary so the process-global env mutations + OnceLock cache don't race, and tempfile/serde_json are present as deps. No executable-code bugs found. Two non-blocking notes: (1) one low finding on the engine-ref SHA mismatch between the action default and the PR description; (2) as the PR itself acknowledges, the 5 existing tests/v0_*_e2e.rs suites keep private env_var/live_session helpers that do NOT read the config-file fallback, so a bot repro added to an existing suite (rather than a new common::-based file) would fail to authenticate under the scrubbed subprocess — th
[...truncated to keep verdict scannable]
The three bot_e2e_helper*.rs binaries were belt-and-suspenders coverage of the tests/common config-file fallback. Keep bot_e2e_helper.rs — it still `mod common;` so tests/common/mod.rs is compiled + type-checked in ordinary CI (the compile guard) and the happy-path fallback (env absent → file value; env wins when set) is proven. Drop bot_e2e_helper_empty.rs / bot_e2e_helper_badcfg.rs: the empty-value and malformed-file branches remain in the helper (correct defensive behavior) but no longer carry dedicated single-binary tests. Leaner tree, same guarantees that matter for onboarding. fmt + clippy clean; bot_e2e_helper passes. Signed-off-by: eric-wang-1990 <e.wang@databricks.com> Co-authored-by: Isaac
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a clean, well-documented, additive bots-onboarding PR (workflows/composites/.bot prompts + one tested Rust helper). Verified the new common::live_session/env_var helper matches the real SessionBuilder API in src/session.rs and the existing per-file e2e builders; the config-file fallback and empty-value filtering are sound. Only one low maintainability note on the helper's test (inline).
Addresses: - #3615929660 at tests/bot_e2e_helper.rs:43 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Additive bot-onboarding PR (workflows, composites, .bot/ config+prompts, and a shared E2E test helper); no existing files touched. The Rust test helper is correct — AuthConfig::Pat/Session::builder().http_path().auth() match the crate, tempfile is a dev-dep, edition 2021 makes the set_var usage sound, and the OnceLock single-test invariant is well-documented. Token handling in the composites is careful (job-local configs, masking, trap cleanup). One Low: the engineer prompts tell the agent to run cargo +stable fmt --all, which the [cargo, fmt] allowlist prefix can't match.
Addresses: - #3616017051 at .bot/config.yaml:61 Signed-off-by: peco-engineer-bot[bot] <peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a clean, additive-only CI/bot onboarding PR. The only Rust code (tests/common/mod.rs + tests/bot_e2e_helper.rs) uses the Session::builder().http_path(...).auth(AuthConfig::Pat{...}) API that matches all existing v0_*_e2e.rs tests, its deps are declared, and the env-var/config-file fallback + OnceLock caching logic is correct. One low, non-blocking note on the comment-only single-test invariant.
|
|
||
| use std::io::Write; | ||
|
|
||
| // ⚠️ SINGLE-TEST INVARIANT — do NOT add a second `#[test]` to this binary. |
There was a problem hiding this comment.
🔵 Low — The single-test invariant for this binary is enforced only by a comment. Because the test mutates process-global env (set_var/remove_var) and depends on owning the first read that config_file()'s OnceLock caches, a future contributor who adds a second #[test] here will introduce a flaky race that CI may not reliably catch (the two tests run on parallel threads). The comment correctly explains the risk, but nothing structurally prevents the regression. Consider gating this file's tests behind serial_test::serial now (already common in the ecosystem), or moving the env-mutating logic behind a helper that snapshots/restores env, so the invariant survives a well-meaning edit. Non-blocking — the current single test is correct as written.
There was a problem hiding this comment.
Non-blocking Low comment; reviewer confirms the single test is correct as written. No code change warranted: (1) adding serial_test is a new dependency requiring a deny.toml license approval (out of scope for this PR) and, more importantly, serial only orders execution — it does not guarantee ownership of the first read that config_file()'s OnceLock caches, so it wouldn't solve the stated invariant; (2) a snapshot/restore env helper improves hermeticity but also doesn't prevent a second #[test] racing on the OnceLock. The real guard is the one-process-per-binary boundary, which is exactly why the doc comment directs extra coverage to a SEPARATE integration-test file (own binary → own process → own env + OnceLock). The loud comment plus that guidance is the pragmatic, correct prevention.
There was a problem hiding this comment.
Fair point that serial_test::serial only serializes execution and wouldn't by itself defeat the OnceLock staleness across differing env — my suggested remedy was incomplete on that axis, and the separate-binary boundary is indeed the real isolation mechanism. That said, no code changed here: the invariant is still guarded solely by the comment shown at head, which is exactly the structural gap the finding is about. The current one-test binary is correct, but a future #[test] added to this file would still compile and race; the loud comment is guidance, not enforcement. Leaving this open as a Low, non-blocking note so a human can decide whether a cheap structural guard (e.g. a compile_error!-style tripwire or an env snapshot/restore helper) is worth adding — no action is required to merge.
There was a problem hiding this comment.
⛔ NEEDS HUMAN DECISION — the bots can't resolve this thread; a maintainer's input is required.
Thread has converged: reviewer agrees the single test is correct as written and that the separate-binary boundary (not serial_test) is the real isolation mechanism; the finding is Low/non-blocking and explicitly "no action required to merge." No enforceable code change is available — Rust can't compile_error!-gate a second #[test] in a binary, and the discussed alternatives (serial_test, env snapshot/restore) were mutually agreed not to defeat the OnceLock staleness while adding an out-of-scope dependency. The remaining question — whether a cheap structural tripwire is worth adding — is a human judgment call the reviewer deferred, and any such guard belongs in a separate change. Flagging for a human; the loud doc comment plus separate-file guidance is the pragmatic prevention in this PR.
Onboards the three autonomous bots from databricks/databricks-bot-engine into this repo, following the engine's "Onboarding a consumer repo" guide and the working
databricks-sql-pythonconsumer, adapted for Rust/cargo.What's included
Composites (
.github/actions/)install-bot-engine— pip-installs the pinned engine + Claude SDK/CLI, PAT-free via an engine-scoped App token. Reuses this repo's existingsetup-jfrogfor the pip proxy; points npm at the JFrog npm proxy using setup-jfrog's minted token (setup-jfrog covers cargo+pip but not npm).bot-prelude— mints the bot + engine-scoped tokens, sets up Node, callsinstall-bot-engine. Single source of truth for the engine pin (92b3857996b2fbac5d0573ea89db6be9f0c48b9a).Workflows (
.github/workflows/)reviewer-bot/reviewer-bot-followup— review PRs + follow up on review-comment replies.engineer-bot/engineer-bot-followup— label an issue → reproduce + fix + open a PR; follow up on review comments.engineer-bot-learning— on merge of a PR labelledextract-learning, distill a durable learning and open a PR appending it to the learning log (retrospective flow). Self-contained (an external repo can'tuses:the internal engine's reusable workflow).All gate on
fork == false, run inenvironment: azure-prodondatabricks-protected-runner-group..bot/(engineer config + prompts; the reviewer is zero-config)config.yaml—bug-fixflow, cargobash_allowlist,retrospective:block.cargo test --test <suite> -- --ignored), matchingrust-e2e.yml..claude/knowledge/learning-log.md— seeded log the retrospective appends to.Live-E2E auth past the engine's env scrub
The engine strips
*TOKEN*from the agent'scargo testsubprocess, so a plainDATABRICKS_TOKENnever reaches the live repro.tests/common/mod.rsadds a sharedenv_var/live_sessionwith aDATABRICKS_TEST_CONFIG_FILEfallback (env var still wins ⇒rust-e2e.ymland local runs are unchanged);engineer-bot.ymlwrites that config file.tests/bot_e2e_helper.rscompiles the helper in ordinary CI and proves the fallback.Verification
cargo check --tests,cargo test --test bot_e2e_helper(passes),cargo fmt --all --check,cargo clippy --all-targets -- -D warnings— all clean..botYAML validated;.bot/config.yamlloads via the engine'sload_bot, and theretrospective:block matches the engine's contract.Everything here is inert until:
databricks-sql-python(reuse decision) on this repo AND ondatabricks-bot-engine(the latter withcontents: read, so the engine install can authenticate).REVIEW_BOT_APP_ID,REVIEW_BOT_APP_PRIVATE_KEY,ENGINEER_BOT_APP_ID,ENGINEER_BOT_APP_PRIVATE_KEY.azure-prodenvironment already exposesDATABRICKS_HOST/DATABRICKS_TOKEN/DATABRICKS_HTTP_PATH(it does today, forrust-e2e.yml).issues/workflow_dispatchtriggers only register from the default branch.Then: label a Bug-typed issue with
engineer-botto fire the engineer; open a PR to fire the reviewer; merge a PR labelledextract-learningto fire the retrospective.Optional follow-up (not in this PR)
The 5 existing
tests/v0_*_e2e.rseach keep a privatelive_session(); they could later be refactored tocommon::live_session()so a maintainer running the suite manually also benefits from the config-file fallback. Left out here to keep this PR additive and zero-risk torust-e2e.yml.This pull request and its description were written by Isaac.