mirror of
https://github.com/block/buzz.git
synced 2026-10-27 20:41:57 +00:00
Posted by Brain, Wes Billman’s AI assistant, on behalf of `wesbillman`. ## Summary Add an opt-in `databricks::DatabricksConnection` over the existing PKCE/coordinator and v2 catalog machinery. It accepts an explicit HTTPS workspace origin, absolute caller-owned cache root, and browser opener; it does not start an agent or infer credentials/host from the environment. - Validate both OAuth endpoints on the actual discovery response used for grants; native HTTP redirects are disabled and requests have a 30-second timeout. - Keep strict cache/single-flight state in a separate namespace. Connect is explicit/user-initiated; catalog lookup and its one 401 refresh stay headless. Tokens are not exposed by the connection API. - Preserve existing legacy constructors, endpoint/redirect policy, cache layout, intents, and catalog filtering/pagination/partial/default semantics. No internal host default, credential migration, app integration or release configuration changes. ### Intentional shared changes OAuth success/discovery JSON is capped at 1 MiB; error JSON at 16 KiB. Oversized/malformed responses are infrastructure failures, while bounded client-error `invalid_grant` retains its existing classification. OAuth diagnostics omit raw bodies/URLs/opener/callback details. Overflowing token expiry returns an infrastructure failure. These changes affect legacy callers too and have synthetic regression coverage. See [the reuse contract](crates/buzz-agent/DATABRICKS_REUSE.md) for API, compatibility and caller obligations. Total operation deadlines, stale-result fencing, private root ownership, nonlogging opener behavior and credential-removal UX remain the caller’s responsibility. ### Related issue Related discovery work: #6918. Searched existing Databricks PRs and OAuth issues; no duplicate of this strict opt-in API was found among those results. This is a new reuse boundary, not a claim of a live credential leak. ### Testing Published head: `cf33eb2f4f267d5808e068e35127d5504f0bc674`, based on main `78618804ec86a014524ad7d1fb55928e8f5c3edf`. Two implementation/doc commits were transplanted from a release-derived local base to exclude unrelated release files. `git range-diff` reports both patches unchanged; independent source review of the transplant found no blocker. **At the published head:** normal pre-push hooks passed: branch skew, push-head scope, file-size checks, Rust test lane and desktop Tauri Clippy/tests. The fallback Rust lane actually ran `buzz-agent --lib`: 542 passed / 1 ignored, NOT the full package integration suite. Hosted full package/repository CI remains pending. The first push attempt was interrupted by the command runner’s 300-second limit; the second completed normally with all hooks enabled. **At reviewed implementation checkpoint `8cb3b72d4`:** 16 strict, 27 auth, 32 catalog and 63 coordinator/OAuth/CLI tests passed, independently rerun; 18 author-selected mutations and four independent reviewer mutations failed tests with passing restored controls. The subsequent `539319411` delta changed only two doc-comment blocks. These earlier test/mutation results are not silently attributed to the rebased head. Synthetic coverage includes HTTPS grants/catalog, off-origin endpoint and redirect rejection, cancellation/socket/listener cleanup, host/root/legacy namespace isolation, bounded declared/chunked bodies and exact-limit controls, redaction with positive log capture, malformed expiry, legacy endpoint/redirect controls, and real CLI cached-auth aliases. Desktop native checks used fail-closed sidecar stubs: compile/test evidence, **not** a runnable or packaged app. No real provider credentials, browser sign-in, app launch, or agent cutover was performed. Cross-platform execution and real-provider acceptance remain separate gates. No merge or downstream adoption is requested by this PR. --------- Signed-off-by: Brain <1a02c72794dcd0f07058a353bc3a81f4028b8c77c92c87fce6d5c8b85970a20b@buzz.block.builderlab.xyz> Co-authored-by: Brain <1a02c72794dcd0f07058a353bc3a81f4028b8c77c92c87fce6d5c8b85970a20b@buzz.block.builderlab.xyz>
86 lines
3.3 KiB
TOML
86 lines
3.3 KiB
TOML
[package]
|
|
name = "buzz-agent"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
description = "Minimal, unbreakable ACP-compliant agent. Non-streaming. Tool-calls-as-output."
|
|
readme = "README.md"
|
|
keywords = ["acp", "agent", "llm", "mcp", "minimal"]
|
|
categories = ["command-line-utilities", "web-programming"]
|
|
|
|
[lib]
|
|
name = "buzz_agent"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "buzz-agent"
|
|
path = "src/main.rs"
|
|
|
|
# Test-only fake MCP server. Built unconditionally because cargo can't gate
|
|
# bins on `cfg(test)`, but it's tiny and only used by integration tests.
|
|
[[bin]]
|
|
name = "fake-mcp"
|
|
path = "tests/bin/fake_mcp.rs"
|
|
|
|
# Test-only lock holder: a real second process that takes the coordinator's
|
|
# cross-process advisory lock, so the auth tests can prove genuine
|
|
# inter-process single-flight and crash-release rather than same-process
|
|
# handles. Tiny; only used by the databricks auth integration tests.
|
|
[[bin]]
|
|
name = "lock-holder"
|
|
path = "tests/bin/lock_holder.rs"
|
|
|
|
# Test-only auth worker: a real second process that runs the PUBLIC auth
|
|
# coordinator API (`acquire_with_intent`) with a scripted browser opener and a
|
|
# shared temp cache, so the auth tests can prove the cross-process single-flight
|
|
# contract end-to-end — durable cooldown sharing and one-grant/one-cache races
|
|
# across a genuine process boundary, not two in-process handles. Only used by
|
|
# the databricks auth integration tests.
|
|
[[bin]]
|
|
name = "auth-worker"
|
|
path = "tests/bin/auth_worker.rs"
|
|
|
|
[dependencies]
|
|
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "io-std", "io-util", "sync", "process", "time", "net"] }
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
serde_yaml = { workspace = true }
|
|
reqwest = { workspace = true, features = ["json", "rustls", "form"] }
|
|
rmcp = { version = "1", default-features = false, features = ["client", "transport-child-process"] }
|
|
arc-swap = "1"
|
|
getrandom = "0.4"
|
|
tracing = { workspace = true }
|
|
tracing-subscriber = { workspace = true }
|
|
# OAuth 2.0 PKCE for Databricks (and future browser-auth providers).
|
|
async-trait = "0.1"
|
|
axum = { workspace = true }
|
|
base64 = "0.22"
|
|
hex = { workspace = true }
|
|
sha2 = { workspace = true }
|
|
url = { workspace = true }
|
|
urlencoding = "2"
|
|
webbrowser = "1"
|
|
dirs = "6"
|
|
# Cross-process advisory file lock (flock on Unix, LockFileEx on Windows) for
|
|
# the auth coordinator's single-flight. Kept off std's `File::try_lock` so the
|
|
# crate stays buildable on the repo's declared 1.88 MSRV (those std APIs are
|
|
# 1.89+).
|
|
fs2 = "0.4"
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
nix = { version = "0.31", default-features = false, features = ["signal", "process"] }
|
|
|
|
[dev-dependencies]
|
|
# Synthetic TLS OAuth/catalog servers exercise the strict HTTPS production path.
|
|
rcgen = { version = "0.14", default-features = false, features = ["crypto", "ring"] }
|
|
tokio-rustls = { version = "0.26", default-features = false, features = ["ring", "tls12"] }
|
|
tokio = { workspace = true, features = ["test-util", "rt-multi-thread", "macros", "io-std", "io-util", "sync", "process", "time", "net"] }
|
|
nix = { version = "0.31", default-features = false, features = ["signal", "process"] }
|
|
axum = { workspace = true }
|
|
hex = { workspace = true }
|
|
serde = { workspace = true }
|
|
sha2 = { workspace = true }
|
|
tempfile = "3"
|