发布

  • Backport six post-cut fixes onto release/v0.9.0 (#4596)

    frostbyte_neo 发布于 2026-08-11 18:31:13 +00:00

    • revert(sessions): unwind the #2150 approval/attribution stack (#3446, #3422, #3416) (#4318)

    • revert(sessions): remove delegated approval authority (#3446)

    Reverts the delegated approval feature from #3446, returning to
    owner-only approval (the deny-by-default behavior from #3416). Owners
    can no longer delegate a "can_approve" capability to shared editors;
    approvals are again restricted to the session owner, while editors keep
    reject/cancel.

    The change is a faithful inverse of #3446 rebased on current main:
    files untouched since #3446 revert byte-identical to their pre-feature
    state; files later commits also modified keep those newer changes and
    drop only the approval lines.

    Migration handled non-destructively for deployed databases:

    • The original additive migration (c4d5e6f7a8b9) is kept intact so
      already-migrated databases still resolve their history.
    • A new forward migration (f7a8b9c0d1e2) drops the session_permissions
      .can_approve column; its downgrade re-adds it.

    Also removes a dangling import of _approval_access_from_grants in
    sessions/__init__.py left by the later wildcard-import refactor (#3934),
    which otherwise broke server import after the helper was reverted.

    Signed-off-by: Serena Ruan serena.rxy@gmail.com

    • revert(sessions): remove shared-message attribution (#3422)

    Reverts the model-visible shared-message authorship feature from #3422.
    Messages no longer gain [author]: prefixes in the model prompt, the
    SHARED_SESSION_AUTHORSHIP_INSTRUCTION framework instruction is removed,
    and the OMNIGENT_SHARED_MESSAGE_ATTRIBUTION_ENABLED switch is gone.
    Persisted created_by authorship (a store-level column predating #3422)
    is unaffected.

    Rebased on current main, keeping later independent work in the same
    regions:

    • Smart Routing's conditional model_override on the native-terminal
      forward path is preserved.
    • The host_store parameter added to the event-forward path is kept.
    • The two test_external_interrupt_* tests from #4160 (which overlap
      #3422's added block in test_sessions_endpoints.py) are kept; only
      #3422's test_external_user_message_strips_model_author_prefix is
      removed.

    Also removes dangling imports of _strip_pending_author_prefix in
    orchestration.py and sessions/__init__.py left after the helper's
    definition was reverted.

    Signed-off-by: Serena Ruan serena.rxy@gmail.com

    • revert(sessions): restore editor approval authority (#3416)

    Reverts the owner-only approval restriction from #3416. Approval events
    and URL-based elicitation resolution are gated at LEVEL_EDIT again, so
    shared editors — not only the owner — can resolve approvals.

    SECURITY REGRESSION (intentional, per request): #3416 was a security
    fix. Shared-session tools execute with the session owner's runner
    identity and ambient credentials, so a shared editor can once more
    authorize owner-credentialed tool calls. This, together with the #3422
    and #3446 reverts, fully unwinds the #2150 stack and re-opens #2150.

    Signed-off-by: Serena Ruan serena.rxy@gmail.com


    Signed-off-by: Serena Ruan serena.rxy@gmail.com
    (cherry picked from commit 7efe05623b)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • feat(web): make the header Chat/Terminal switcher a segmented toggle (#4385)

    The header switcher hid both destinations behind a dropdown: a
    MessagesSquare + chevron trigger you had to open before you could see
    which view you were in or switch to the other one. Reading the current
    view took a hover (the tooltip), and switching took two clicks.

    Replace it with a two-segment icon toggle in a shared track. Both
    destinations are always on screen, the active one is filled, and
    switching is a single click. Sits in the same header slot, immediately
    left of Share, at the same 32px scale as the neighbouring controls
    (size-6 segments in a p-0.5 track).

    Behavior is unchanged: the same TerminalFirstContext drives it, it
    self-gates for non-terminal-first sessions, the iOS shell (native
    Liquid Glass bar), and rail-opened shell views, and Terminal stays
    disabled — with a spinner while a PTY is coming up — until one is
    reachable. Each segment carries aria-pressed and a tooltip naming it,
    so the icon-only control stays legible to pointer and AT users alike;
    the Terminal tooltip doubles as the "starting up" explanation.

    Collapsing the menu drops the machinery it needed: the controlled
    tooltip (two merged Slots on one node dropped its listeners), the
    pointer-vs-keyboard close-refocus ref, and the e2e open-retry loop
    that existed because a toggle-trigger click could net back to closed.

    Co-authored-by: Isaac

    Signed-off-by: Dhruv Gupta dhruv.gupta@databricks.com
    (cherry picked from commit 95186250cb)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(claude-native): keep MCP tool search on for gateway-backed native Claude (#4533)

    The native-claude launch config unconditionally set
    CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 on the ucode and bedrock provider
    paths. That flag disables all experimental betas, including MCP tool
    search (which rides on the advanced-tool-use beta). With tool search off,
    Claude Code loads every MCP tool schema eagerly, inflating the context
    window — for an isaac-omni session with ~187 MCP tools that is ~88k tokens
    spent up front instead of on demand.

    The disable flag existed to avoid the gateway 400ing on invalid beta flag.
    But in gateway-aware mode (CLAUDE_CODE_USE_GATEWAY=1) Claude Code negotiates
    the anthropic-beta set with the gateway rather than sending every flag
    blindly, and the Databricks AI Gateway now accepts the flags it sends
    (verified end-to-end against a live gateway: a CLAUDE_CODE_USE_GATEWAY=1
    turn sends advanced-tool-use-2025-11-20 / prompt-caching-scope-2026-01-05 /
    advisor-tool-2026-03-01 and completes with no 400). So the workaround is no
    longer needed when USE_GATEWAY=1.

    • _provider_config_for_native_claude (generic gateway path): already
      guarded on CLAUDE_CODE_USE_GATEWAY (unchanged).
    • _ucode_config_for_profile: this path always launches in gateway mode
      (it sets CLAUDE_CODE_USE_GATEWAY=1 itself), so drop the disable flag
      outright rather than guard it. Restores the pre-#4074 behavior.
    • _bedrock_config_for_native_claude: add the same USE_GATEWAY guard the
      generic gateway path uses, so a bedrock-style corporate gateway running
      in gateway-aware mode keeps tool search on. Real AWS Bedrock (no
      USE_GATEWAY) is unchanged — the flag still gets set.

    Tests: update the ucode assertion, add positive coverage for the gateway
    and bedrock paths under USE_GATEWAY=1, and make the env-sensitive tests
    deterministic by clearing CLAUDE_CODE_USE_GATEWAY.

    Co-authored-by: harry-yao_data harry.yao@databricks.com
    (cherry picked from commit 55a270a2d8)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(codex): speak codex's model vocabulary on a CLI login (#4558)

    Codex's own backend (ChatGPT account or API key) names models with a
    dotted version, gpt-5.6-sol. Databricks serving names the same model
    with hyphens only, databricks-gpt-5-6-sol. Two places sent the wrong
    one, so every codex dispatch on a CLI login failed at launch with a 400.

    The curated codex catalog carried the Databricks spelling, so selecting
    any offered model was rejected. It now carries codex's own slugs, which
    still fold to the same comparable spelling, leaving routed-arm matching
    unchanged.

    The launch default resolved through the generic OpenAI catalog, whose
    newest row is the bare family alias gpt-5.6 that codex rejects as a
    family name. Only the Databricks-gateway branch consults that catalog
    now; a codex CLI login defaults to a concrete variant from codex's own
    catalog. The Databricks branch keeps its hyphenated ids.

    Co-authored-by: Isaac

    Signed-off-by: Dhruv Gupta dhruv0811@gmail.com
    (cherry picked from commit 5857a2c3d6)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(host): keep CLAUDE_CODE_USE_GATEWAY / ENABLE_TOOL_SEARCH in the runner env allowlist (#4553)

    A launcher (e.g. Databricks' isaac) sets CLAUDE_CODE_USE_GATEWAY=1 and
    ENABLE_TOOL_SEARCH=true in its process env so the native-claude harness keeps
    MCP tool search on (schemas load on demand). But the host daemon env
    (_build_host_daemon_env) and the runner env (_build_runner_env) are both
    built from _RUNNER_ENV_ALLOWLIST, and neither var was on it — so they were
    stripped at daemon spawn and never reached the runner process.

    The native-claude provider path (_provider_config_for_native_claude,
    _ucode_config_for_profile, _bedrock_config_for_native_claude) reads
    CLAUDE_CODE_USE_GATEWAY from os.environ to decide whether to set
    CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1. With it stripped, the runner saw it
    absent, re-added the disable flag, and Claude Code turned tool search off —
    loading every MCP tool schema eagerly (~88k tokens for ~190 MCP tools at
    startup instead of on demand).

    Add both non-secret boolean flags to _RUNNER_ENV_ALLOWLIST, beside the
    existing CLAUDE_CODE_USE_BEDROCK / CLAUDE_CODE_SKIP_BEDROCK_AUTH flags (same
    category). The single allowlist is consulted by both gates, so the vars now
    survive daemon spawn and runner spawn and reach the guard.

    Tests: assert both vars survive _build_host_daemon_env (local + remote) and
    _build_runner_env. They fail before this change and pass after.

    Co-authored-by: harry-yao_data harry.yao@databricks.com
    (cherry picked from commit a2de2b44ac)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(routing): count managed-settings AIGW backing for claude-native (#4491)

    • fix(routing): count managed-settings AIGW backing for claude-native

    claude_gateway_inference_backed() returned False whenever
    resolve_native_claude_config yielded no config — the case for a
    subscription (Claude Code login) provider. But Claude Code itself still
    routes all inference through an AI Gateway when an enterprise managed
    settings file pins ANTHROPIC_BASE_URL, so Smart Routing was being gated
    off for a genuinely gateway-backed launch. Codex already reads its own
    config.toml base_url; this brings Claude to parity.

    Add a fallback: read Claude Code managed settings and treat the launch as
    gateway-backed when env.ANTHROPIC_BASE_URL is a Databricks AI Gateway URL
    (validated with is_databricks_ai_gateway_url) and a credential is
    delivered via top-level apiKeyHelper or a truthy env.CLAUDE_CODE_USE_GATEWAY.
    Managed settings win at the real launch, so this signal can flip the
    answer to True even when the omnigent provider is subscription.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(routing): validate the resolve-path base URL as a Databricks AIGW

    The resolve-based branch of claude_gateway_inference_backed() returned
    True on just ANTHROPIC_BASE_URL + api_key_helper being present, without
    checking the URL is actually a Databricks AI Gateway. A bare
    api.anthropic.com (or any non-Databricks Anthropic-compatible endpoint)
    would qualify — but the external task_v1 router's picks are Databricks
    catalog ids that endpoint cannot serve. Require
    is_databricks_ai_gateway_url() on the resolved base URL too, matching the
    managed-settings fallback and the Codex check.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(routing): resolve cli-config codex base URL from the shared config.toml

    native_codex_launch_base_url() returned None for a cli-config launch,
    because such a launch pins only a model_provider name — the provider
    table (with base_url) lives in the user's shared ~/.codex/config.toml,
    which the launch never inlines. So codex_gateway_inference_backed()
    reported a genuinely AIGW-routed cli-config provider as not backed,
    gating Smart Routing off. This is the Codex analogue of the Claude
    managed-settings gap.

    Read the shared config.toml in the final branch: extract the pinned
    provider name (codex_session_meta_model_provider), locate the user's
    CODEX_HOME config via codex_home_config_source_from_env, and return
    model_providers..base_url with tomllib. openai (Codex's own login)
    and omnigent_databricks (the profile branch's generated id) have no
    user-config table, so they stay None. Any read/parse failure returns
    None — an unreadable config is unknown, not backed. codex_gateway

    inference_backed() is unchanged; it validates the URL as before.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(routing): resolve codex config-default base URL for the empty-override launch

    The prior commit covered a cli-config launch that pins a model_provider
    name, but the user's Databricks-wide setup hits a different path: when no
    omnigent provider resolves and the config default is not dismissed,
    resolve_native_codex_launch leaves config_overrides empty on purpose so
    Codex uses its own config.toml top-level model_provider default. On such
    a machine that default is a Databricks AIGW provider, yet the probe saw
    empty overrides and reported not-backed.

    Extend native_codex_launch_base_url: when a launch pins no model_provider
    override and no profile, resolve the config.toml top-level model_provider
    default's base_url (unless the user dismissed the default, which pins
    Codex's built-in openai). An explicit model_provider="openai" override
    (subscription / dismissed paths) still returns None — only a truly
    unpinned launch reads the config default. Factor the shared table lookup
    into _config_toml_provider_base_url, used by both the cli-config and
    config-default paths.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • fix(routing): count a resolvable launch base URL as codex readiness

    _codex_auth_unavailable_reason() detected a provider-routed launch only
    via a profile or a non-openai model_provider override. On a Databricks-
    wide machine the launch pins neither — omnigent defers to Codex's own
    config.toml top-level model_provider default — so readiness fell through
    to the auth.json check, found no openai credential, and falsely reported
    needs-auth even though bare codex works. That gated the Smart Routing
    harness row off in New Chat (it needs both claude-native and codex-native
    ready).

    Broaden the predicate to also count a resolvable launch base URL
    (native_codex_launch_base_url(launch) is not None), which now resolves
    the config.toml provider default. This only adds a ready case: an
    explicit model_provider="openai" pin still returns None from that helper,
    so a genuinely logged-out openai user still reports needs-auth. Readiness
    now agrees with the launch resolver and the gateway-inference check.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com

    • test: wrap the codex config.toml fixture under the line limit

    Split the three identical model_providers config-toml f-strings across two
    adjacent literals so each line stays under 99 chars, clearing the ruff E501
    that failed pre-commit.

    Co-authored-by: Isaac
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com


    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com
    (cherry picked from commit ff20407a2d)
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com


    Signed-off-by: Serena Ruan serena.rxy@gmail.com
    Signed-off-by: Bryan Qiu bryan.qiu@databricks.com
    Signed-off-by: Dhruv Gupta dhruv.gupta@databricks.com
    Signed-off-by: Dhruv Gupta dhruv0811@gmail.com
    Co-authored-by: Serena Ruan 82044803+serena-ruan@users.noreply.github.com
    Co-authored-by: Dhruv Gupta dhruv0811@gmail.com
    Co-authored-by: Harry Yao harryyao13@gmail.com
    Co-authored-by: harry-yao_data harry.yao@databricks.com

    下载附件