- Define a root pnpm-workspace.yaml with web/ and web/electron/ packages.
- Move npm overrides from web/package.json into workspace overrides, using a
shared catalog: for react, react-dom, and shiki.
- Preserve 7-day dependency cooldown via settings.minimumReleaseAge: 10080.
- Delete web/package-lock.json and web/electron/package-lock.json; add the
generated root pnpm-lock.yaml.
- Update web/electron/package.json scripts to use pnpm --filter web run build:overlay.
- Remove web/.npmrc and web/electron/.npmrc; no committed .npmrc (CI forces the
public registry via env var).
- Add .github/actions/setup-pnpm so all workflows can share a pinned pnpm
11.15.1 + Node setup.
- Convert lint.yml and web-tests.yml to pnpm; update ui-snapshot and e2e-ui
workflows.
- Update the web-prettier pre-commit hook to run web/node_modules/.bin/prettier
directly when present.
- Update justfile to prefer pnpm for Electron recipes and lockfile normalization.
- Ensure remaining npm-based workflows (editors/vscode/, .github/ci-deps/,
deploy/cloudflare/) are untouched and continue to work.
- Add pdfjs-dist worker URL import so Vite emits the worker asset under pnpm's
hoisted node_modules layout.
- Force shiki and its first-party packages into a single build chunk to avoid a
Cyclic top-level import that produced a 'flatMap' runtime error in Monaco.
- Pin build-tool versions to the legacy npm lockfile (vite 8.1.0, tailwindcss
4.3.1, jiti 2.7.0, lightningcss 1.32.0, postcss 8.5.15) so bundler behavior
stays consistent with the pre-migration builds.
- Update tests/e2e_ui/test_pwa_build.py to omit the now-incorrect -- separator
when forwarding --outDir to pnpm run build:embed.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Claude Opus 5 (released 2026-07-24) was missing from the curated
_SUBSCRIPTION_STATIC_MODELS["claude"] list. Verified empirically against
Claude Code 2.1.220: 'claude-opus-5' -> is_error:false; the dated form
'claude-opus-5-20260724' and a 'claude-opus-5-fast' variant both return
is_error:true, so neither is added.
Placement follows the existing convention: tiers descend
fable -> opus -> sonnet -> haiku, newest version first within a family
(matching claude-sonnet-5 ahead of claude-sonnet-4-6), so opus-5 slots
between fable-5 and opus-4-8.
The web mirror (web/src/lib/claudeNativeModels.ts) needs no change: it
lists version-agnostic aliases ('opus' resolves to the latest Opus) by
design, not pinned ids.
Signed-off-by: Abdullah Said <abdullahsaid89@gmail.com>
Co-authored-by: omnigent <noreply@omnigent.ai>
* ci(ui-snapshot): make the visual-baseline gate merge-blocking
The UI Snapshot visual-regression check was advisory ([non-blocking]) and
not in the required-checks set, so a UI change could land without
regenerating the committed baselines — which is how the baselines drifted
stale on main (every PR since #3311 fails the gate identically).
Register it as a required merge gate:
- Drop the "[non-blocking]" suffix from the job name.
- Add "UI Snapshot (visual baselines)" to REQUIRED and ALLOW_SKIP in
merge-ready/required.sh, plus a workflow_for mapping. It's safe as a
required check: a PR touching no render input skips the render via the
`detect` job's `if` gate, and an if-skipped job reports success — so
non-UI PRs satisfy the check instead of sitting pending. ALLOW_SKIP +
workflow_for let the gate tell that genuine skip from a still-pending run.
- Add "UI Snapshot" to merge-ready.yml's workflow_run triggers so the gate
re-evaluates when the snapshot workflow completes.
- Update the visual README's merge-blocking section.
This PR edits ui-snapshot.yml (a render input), so the gate runs here and
fails on the stale baselines; the `update-ui-snapshot` label regenerates
them onto this branch to turn it green.
Co-authored-by: Isaac
* test(e2e-ui): regenerate visual baselines
---------
Co-authored-by: omnigent-ci[bot] <294685417+omnigent-ci[bot]@users.noreply.github.com>
* fix(sessions): fall back to localStorage when pinning against an old server
A pin created in the new UI while the server is still pre-upgrade was lost
on the server upgrade. The pin toggle PATCHes `omnigent.pinned`; an old
server (no per-user pin concept) stores it as a bare label, but the
upgraded server's read path (`_labels_for_viewer`) drops every bare/
`omnigent.pinned.*` key and only surfaces the caller's own
`omnigent.pinned.<user>` key — so the bare-key pin silently vanishes. The
localStorage→server migration couldn't recover it either, since that pin
was never in localStorage.
This complements the earlier migration-gate fix (which protected pins made
*before* the UI upgrade). Now the toggle also checks `filterHonored`: when
the server can't store pins, it writes the pin to localStorage (the same
store the pre-upgrade UI used) instead of PATCHing a doomed bare key. The
pin renders immediately (sidebar unions localStorage pins) and later
migrates through `useMigrateLocalPinsToServer` like any pre-upgrade pin.
Once the server can store pins, the toggle uses the server as before.
- Move the legacy-pin localStorage helpers from Sidebar.tsx to the leaf
sidebarNav module (+ a single-id `setLegacyPinnedConversationId`) so the
toggle hook can use them without an import cycle.
- Tests: unit coverage for the toggle's old-server fallback (pin/unpin to
localStorage, no PATCH; normal PATCH path once honored), and an
end-to-end case in the backwards-compat suite that pins DURING the
UI-before-server window and asserts it survives the server upgrade.
Co-authored-by: Isaac
* fix(sessions): surface local-write failures in the old-server pin fallback
Addresses a review note: the old-server pin toggle's localStorage write is
the pin's only persistence, but it went through the best-effort
`writeLegacyPinnedConversationIds`, which swallows write errors (e.g.
storage quota exceeded). So a failed write let the mutation report success
and the optimistic patch show the pin, while it silently vanished on reload
— with no rollback.
Split out a throwing `...OrThrow` raw write. The old-server fallback
(`setLegacyPinnedConversationId`) now uses it, so a failed write rejects the
mutation → `onError` rolls back the optimistic patch and the UI honestly
shows the pin didn't take, matching the server PATCH path. The migration's
best-effort write is unchanged (a failed write there just retries next load).
Test: the fallback rolls back the optimistic pin when the local write throws.
Co-authored-by: Isaac
## Related issue
N/A
## Summary
- Add `omnigent/onboarding/sandboxes/types.py` with shared dataclasses
(`SandboxCapabilities`, `SandboxSpec`, `SandboxInfo`, `HostContext`) and the
new `SandboxError` exception hierarchy.
- Add `omnigent/onboarding/sandboxes/registry.py` with a contribution-based
provider registry that mirrors `omnigent/harness_plugins.py`: built-in
providers are declared as a `SandboxProviderContribution`, community
packages register via the `omnigent.sandbox_providers` entrypoint group, and
broken plugins are recorded in `load_errors` without breaking core startup.
- Add `omnigent/community/sandbox/__init__.py` as a namespace package so
third-party providers can ship code under `omnigent.community.sandbox.*`.
- Validation enforces that community provider code lives under the community
namespace, rejects name collisions, and checks metadata consistency.
- Add a `capabilities` property to `SandboxLauncher` that derives feature flags
from existing class variables and overridden transport methods.
- Migrate CLI and managed-host call sites from direct class-var reads
(`supports_cli_bootstrap`, `can_resume`, `supports_local_port_forward`) to
the new `capabilities` object.
- Add unit tests for types, registry behavior, validation, and entrypoint
discovery.
No provider implementations were changed; this is purely a surface-layer
refactor toward a pluggable sandbox provider interface.
## Test Plan
```bash
uv run pytest tests/onboarding/sandboxes tests/sandbox tests/cli/test_cli.py tests/server -k managed -q
pre-commit run --files omnigent/onboarding/sandboxes/types.py omnigent/onboarding/sandboxes/registry.py omnigent/onboarding/sandboxes/base.py omnigent/onboarding/sandboxes/__init__.py omnigent/onboarding/sandboxes/bootstrap.py omnigent/community/sandbox/__init__.py omnigent/cli_sandbox.py omnigent/server/managed_hosts.py tests/onboarding/sandboxes/test_types.py tests/onboarding/sandboxes/test_registry.py
```
All 779 selected tests pass and the targeted pre-commit hooks pass.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [ ] Manual verification completed
- [x] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
New unit tests in `tests/onboarding/sandboxes/test_types.py` and
`tests/onboarding/sandboxes/test_registry.py` exercise the registry,
contribution validation, types, and capabilities derivation. Existing
provider and CLI tests pass unchanged, confirming backward compatibility.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* feat(scheduled): add Model + Reasoning-effort pickers to the task dialog
The scheduled-task create/edit dialog previously omitted model and effort,
sending only agent_id so tasks always ran with the agent's configured
defaults. Add lightweight Model + Reasoning-effort controls, gated by the
selected agent's capability exactly like the interactive New Chat dialog:
they render only for native coding agents that carry the model/effort
surface (Claude Code) and are hidden for agents without it (Codex, plain
SDK agents, etc.).
- New scheduled-local ModelEffortFields component reuses the shared option
lists (CLAUDE_NATIVE_MODELS + the version-agnostic aliases, and
CLAUDE_NATIVE_EFFORTS) rather than importing the 26-prop
HarnessConfigModal, which is bound to smart-routing / cost-control /
per-turn model loading and disproportionate for a saved task. When a host
is pinned it uses that host's live model options; with none pinned (the
common case) it falls back to the static Claude aliases.
- Hoist CLAUDE_NATIVE_EFFORTS into the shared HarnessConfigControls module
so both dialogs share one source of truth.
- Wire modelOverride + reasoningEffort through create and update (both
already round-tripped by scheduledTasksApi.ts — no client/API change).
Unselected ("Default") omits the field on create so the fire path uses
the agent's defaults; on edit, Default sends null to clear a prior
override. Edit mode prefills both controls from the loaded task.
No permission/approval/cursor mode picker and no new API field: this is a
pure frontend change.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* test(automations): e2e for model + effort selectors
Extend tests/e2e_ui/scheduled/test_scheduled_tasks_page.py with UI journeys
for the model + reasoning-effort selectors added to the scheduled-task
create/edit dialog:
- controls visible + default to "Default" for a capability-gated agent
(Claude Code)
- controls hidden (with the "uses defaults" hint) for a non-capable agent
(seeded Codex task, asserted via the edit dialog)
- create persists a concrete Model + Effort pick (asserted via the REST API)
- create with both controls left on Default persists null overrides
- edit prefills the controls from a seeded task's stored overrides
LLM-free like the sibling tests: exercises only the dialog, REST, and the
rendered row. Uses Playwright expect() auto-waiting, no sleeps.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
## Related issue
N/A
## Summary
- Remove the dedicated Settings → Appearance → Sidebar → Font size card and the `lib/sidebarFontPreferences` module, since users should use the global Interface font size control instead.
- Clear the legacy `omnigent:sidebar-font-size` localStorage key on app boot so anyone who previously changed the sidebar font size falls back to the default 13px.
- Add a "Reset to defaults" button at the bottom of the Appearance section that opens a confirmation dialog and resets all appearance choices: mode, terminal theme, color palette/custom theme, workspace panel default, hide-unconfigured-harnesses toggle, and interface/code font size and family.
## Test Plan
- Updated unit tests in `web/src/pages/SettingsPage.test.tsx` covering the reset flow and the absence of the sidebar font size control.
- Added a Playwright E2E test in `tests/e2e_ui/sessions/test_appearance_reset.py` to verify the sidebar card is gone and the reset dialog restores defaults.
- To verify locally after installing web dependencies:
- `cd web && npm run type-check`
- `npx vitest run src/pages/SettingsPage.test.tsx`
- `pytest tests/e2e_ui/sessions/test_appearance_reset.py`
## Demo
N/A — UI change; a screen recording of the reset confirmation dialog is recommended before merge.
## Type of change
- [ ] Bug fix
- [ ] Feature
- [x] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [x] E2E tests added / updated
- [ ] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
local web dependencies are not installed in this environment, so the local type-check and vitest runs could not be executed. CI will run the web test suite on the PR branch.
## Changelog
Settings → Appearance no longer has a separate Sidebar font size control, and a new "Reset to defaults" button restores every appearance preference after confirmation.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* feat(projects): name the project in the new-session hero, drop the tray chip
When starting a session from within a project (a `?project=` landing), the
composer used to show the project as a pill in the footer tray while the hero
kept its generic "What should we do?" prompt. Move that context into the hero
instead: the heading shows the project name and Otto's eyes are swapped for the
same folder icon the sidebar uses for a project. The footer project chip
(`LandingProjectPicker`) is removed — filing on create still uses the same
`selectedProject` state, just without the redundant chip.
The folder icon renders in a fixed-height (`h-18`) box matching Otto so the
vertically-centered composer doesn't shift when toggling between the plain and
in-project landings.
Co-authored-by: Isaac
* fix(projects): clamp long project name in the new-session hero
A 100-char project name (the server-side cap) rendered at text-3xl overflowed
the centered container: the icon+heading flex row sized to its content with no
width bound, so the h1's min-w-0/line-clamp had nothing to act against. Give the
row w-full and keep the heading min-w-0 + line-clamp-2 + break-words so a long
name wraps to two lines and ellipsizes instead of overflowing. Add a test
asserting the clamp class contract on a 100-char name.
Co-authored-by: Isaac
The same-second filename collision was disambiguated by pid alone. A pid is
only unique across processes — a process that crashed more than twice within
one second reused its own pid, so every report after the first collision was
written to the same path and silently destroyed its predecessor. Saving five
reports in one second left two files on disk with three crash reports lost,
with rotation held wide enough that nothing should have been pruned.
Keep counting past the pid-suffixed name until the path is free.
test_save_report_writes_and_rotates encoded the bug: it asserted all five
returned paths still existed while rotation kept only two, which could only
hold when the collision collapsed them onto two names. It now asserts the
newest report survives its own rotation pass, and a new test pins the
no-overwrite guarantee with rotation held wide.
Signed-off-by: apeltekci <andrew@peltekci.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Swap the Files right-rail tab glyph from FilePenLineIcon (pen-on-page) to
FilesIcon (stacked pages) to better convey the panel's contents.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(sessions): don't wipe local pins when UI upgrades before server
The one-time localStorage→server pin migration (#3189) trusted an
ambiguous success signal. A pre-upgrade server silently ignores the
unknown `?pinned=true` param and returns the normal (unfiltered) session
page, so the UI saw ~100 "server pins", computed an empty to-migrate set,
and cleared localStorage without ever writing a pin. After the server was
upgraded, its per-user key filter found nothing and every pin read as
unpinned — the reported data loss for UI-before-server upgrades.
Fix, entirely client-side:
- `fetchPinnedConversations` now returns `{ conversations, filterHonored }`.
It keeps only rows actually carrying the `omnigent.pinned` label and
reports `filterHonored: false` when the server returned unpinned rows —
the tell-tale of an old server that ignored the filter.
- The migration is gated on `filterHonored`: it stays inert (localStorage
untouched) against an old server and re-runs after the eventual upgrade.
A legacy id is dropped only after its write is confirmed.
- Pinned membership is the union of the server's pins and any leftover
localStorage pins, so a not-yet-migrated pin keeps rendering instead of
vanishing during the UI-before-server window.
Tests: new filter-honored detection cases, a migration-gate suite, and an
end-to-end backwards-compat test that drives the real hooks across an
old→new server upgrade and asserts the pin is never lost.
Co-authored-by: Isaac
* docs(sessions): address Polly review notes on pin migration
- Document the empty-page ambiguity in `filterHonored` and why it's safe
(an old empty page means a zero-session account; the migration PATCH to a
deleted session 404s and the pin is retained, not lost).
- Note the window-scoped caveat that a legacy-only pin outside the loaded
paginated window may not render a row until loaded.
- Add a regression test: a failed (404) migration write keeps the legacy
pin in localStorage for retry.
Co-authored-by: Isaac
* feat(automations): absolute next-run time + card rows
Change 1: the Automations list now shows the next run as an absolute
wall-clock time ("Next run Tomorrow at 8:00 AM" / "Today at 2:30 PM" /
"Jul 26, 8:00 AM") instead of a relative delta ("in 15h"). Adds
formatNextRunAtAbsolute() in scheduleText.ts, which only FORMATS the
server-authoritative next_run_at (rendered in the task timezone,
Today/Tomorrow bucketed in that same zone) and never recomputes which
instant is next on the client. The old relative formatNextRunAt() is
kept intact.
Change 2: each ScheduledTaskRow now renders as a card (rounded-xl
border bg-card, internal padding), and TasksPage stacks them with a
gap. All existing behavior and data-testids preserved; paused rows are
not dimmed.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(automations): relative full-word next-run label
Reverses the earlier absolute-time next-run display back to a
server-sourced relative delta in full words ("Next run in 3 hours",
"Next run in 8 mins", "Next run in 2 days") per user feedback.
formatNextRunAt now emits full-word, pluralized buckets ('soon' /
'in N min(s)' / 'in N hour(s)' / 'in N day(s)'); the delta is still
computed only from the server's authoritative next_run_at, so the
"no client countdown" rule is unaffected. Removes the now-dead
formatNextRunAtAbsolute and its private helpers (safeFormat,
civilDayInZone). Card-row styling is unchanged.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(automations): live-tick the relative next-run label
The relative next-run label was frozen at its first-render `now` and
only refreshed on remount. A shared 30s useNow() clock (a module-level
singleton via useSyncExternalStore) now drives live re-renders, so the
delta counts down while the page stays open. TasksPage owns the one
ticker and passes `now` to each row, keeping the row a pure function of
props.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(automations): round next-run label to nearest unit
Flooring understated the relative next-run label near a unit boundary:
a task 1h49m away read "in 1 hour". formatNextRunAt now rounds to the
nearest minute/hour/day and promotes on carry (each threshold tests the
already-rounded value), so 1h49m reads "in 2 hours" and a delta that
rounds up to a full unit shows "in 1 hour"/"in 1 day" rather than
"in 60 mins"/"in 24 hours".
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* test(automations): e2e for live-ticking next-run countdown
Adds a Playwright test to the scheduled-tasks page suite proving the
relative next-run label re-renders on its own as time passes (the shared
useNow() ticker), with no navigation. Uses clock mocking for determinism:
pins the browser clock 40 min before the server's next_run_at, asserts
"Next run in 40 mins", fast-forwards 35 min past many 30s ticks, then
asserts the same row updated to "Next run in 5 mins". LLM-free.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
## Related issue
N/A
## Summary
- When `omnigent server` binds a non-loopback interface, it auto-enables accounts (login) mode and prints a warning.
- The warning now explicitly names `OMNIGENT_AUTH_ENABLED=0` as the override to keep single-user mode.
- Kept the warning to the canonical env var; removed any mention of the deprecated alias.
- Improved the rendered indentation so the override sentence starts on its own line.
## Test Plan
- `uv run ruff check omnigent/cli.py`
- `uv run pytest tests/cli/test_bind_auth_defaults.py -q`
Both pass.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [x] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [ ] Manual verification completed
- [x] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
The existing `tests/cli/test_bind_auth_defaults.py` already exercises the non-loopback auto-enable path and the explicit `OMNIGENT_AUTH_ENABLED=0` override. This change only updates the warning copy.
## Changelog
`omnigent server` now tells users they can set `OMNIGENT_AUTH_ENABLED=0` to override automatic multi-user mode when binding to a non-loopback interface.
## Related issue
N/A
## Summary
- Remove the long-deprecated `OMNIGENT_ACCOUNTS_ENABLED` environment-variable alias for the multi-user auth enable switch. The canonical name `OMNIGENT_AUTH_ENABLED` has existed since the repository was open-sourced.
- Strip the alias logic from `omnigent/server/auth.py::_auth_enabled()`, the explicit-auth check in `omnigent/cli.py::_apply_bind_auth_defaults()`, and the runner env-propagation allowlist in `omnigent/host/connect.py`.
- Delete the tests that exercised the alias and the obsolete comment in `tests/conftest.py`.
## Test Plan
- `uv run ruff check omnigent/server/auth.py omnigent/cli.py omnigent/host/connect.py tests/conftest.py tests/cli/test_bind_auth_defaults.py tests/server/test_accounts.py tests/e2e/test_local_server_lifecycle_e2e.py` passed.
- `uv run pytest tests/cli/test_bind_auth_defaults.py tests/server/test_accounts.py -q --no-header` passed (95 items).
- `uv run pytest tests/server/test_accounts.py::test_resolve_auth_source_defaults_to_header tests/server/test_accounts.py::test_resolve_auth_source_opt_in_selects_accounts tests/server/test_accounts.py::test_factory_defaults_to_header_when_env_unset tests/cli/test_bind_auth_defaults.py -q --no-header` passed (15 items).
- Verified no remaining references with `grep -R "OMNIGENT_ACCOUNTS_ENABLED" . --exclude-dir=.git --exclude-dir=.venv`.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [x] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [x] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Removed the tests that specifically covered the deprecated alias; remaining tests continue to validate `OMNIGENT_AUTH_ENABLED` behavior. The refactor does not change the `OMNIGENT_AUTH_ENABLED=1 | =0` semantics.
## Changelog
[Breaking] The deprecated `OMNIGENT_ACCOUNTS_ENABLED` environment variable has been removed; use `OMNIGENT_AUTH_ENABLED` instead.
BREAKING CHANGE: Users and deploys still setting `OMNIGENT_ACCOUNTS_ENABLED` must rename the variable to `OMNIGENT_AUTH_ENABLED` before upgrading; the old name is no longer read or propagated.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Bring the Projects PRD implementation-status section in line with what has
shipped and what remains:
- Mark backend `config` hardening (size bound + non-dict coercion) as done —
both already landed in the project store.
- Move the completed Benchmark (#3094) and Phase 2 (project defaults) items out
of TODO into their own "Done" sections.
- Correct a stale claim that the new-session prefill machine still reads the
`omni_project` label — it was collapsed to config-only in Phase 2. The one
remaining UI label reader (the Settings archived-project picker) is folded
into the Phase 4 retire-label-path step instead.
- Postpone Phase 3 (memory & context) and Phase 4 (label consolidation) with
distinct triggers: Phase 3 waits for customer demand; Phase 4 waits until
telemetry shows most clients have migrated to a version that writes
`project_id`.
Co-authored-by: Isaac
## Related issue
N/A
## Summary
- Updated `inject_user_message()` in `omnigent/claude_native_bridge.py` so user messages that start with a Claude Code UI-only/unsupported slash command (`/help`, `/exit`, `/quit`, `/doctor`, `/cost`, etc.) are escaped before being pasted into the TUI.
- Escaping inserts an invisible zero-width no-break space before the leading `/`, causing Claude Code to treat the input as regular user text while the user still sees their slash.
- Supported slash commands (`/clear`, `/compact`, `/effort`, `/model`, `/ultrareview`, `/branch`, `/fork`) and unknown skill commands pass through unchanged.
## Test Plan
- Added parametrized unit test for `_escape_unsupported_slash_command`.
- Added payload test verifying `/help` gets the escape prefix and `/clear` does not.
- Ran targeted injection tests and pre-commit:
- `uv run pytest tests/test_claude_native_bridge.py::test_escape_unsupported_slash_command tests/test_claude_native_bridge.py::test_inject_user_message_escapes_unsupported_slash_command_payload -q`
- `uv run pytest tests/test_claude_native_bridge.py -k "inject_user_message" -q`
- `uv run ruff check omnigent/claude_native_bridge.py tests/test_claude_native_bridge.py`
- `uv run ruff format omnigent/claude_native_bridge.py tests/test_claude_native_bridge.py --check`
- `uv run pre-commit run --files omnigent/claude_native_bridge.py tests/test_claude_native_bridge.py`
## Demo
N/A
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [ ] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
N/A — new unit tests directly cover the escaping decision and the payload path.
## Changelog
Unsupported Claude Code slash commands are now escaped and sent as regular user messages instead of leaving the native terminal in an undriveable state.
* fix(projects): disable settings inputs during config load; correct worktree doc
Two non-blocking follow-ups from the PR #3221 review:
- Gate the worktree toggle, workspace Browse trigger, and path input on
`isLoading`, matching the host Select. Previously an edit made in the load
window would be clobbered by the seeding effect once the fetch settled.
- Rewrite the `use_worktree` docstring to match the opt-in implementation
(only `true` is written; `false` is never stored and treated as unset).
Co-authored-by: Isaac
* docs(projects): mark backend config hardening as done in PRD
The two #3108 config-hardening follow-ups (size bound + non-dict coercion)
already landed in the project store; move them from "deferred" to a ✅ bullet
so the PRD status matches the code.
Co-authored-by: Isaac
* feat(projects): project settings editor + config-driven composer prefill (Phase 2)
Add a "Project settings" dialog to set a project's stored session defaults
(host, working directory, agent, opt-in random worktree) and wire the new-chat
composer to prefill from that stored config, retiring the newest-session
inference so stored config is the single source of truth.
- ProjectSettingsDialog: edit + persist config {host_id, workspace, agent_id,
use_worktree}; worktrees opt-in (default OFF, store true when on). Reuses the
composer's host/agent pickers and filesystem browser.
- projectPrefill: collapse to config-only seeding; unset fields fall through to
the composer's generic defaults. Honor a stored sandbox default via
selectSandbox (gated on managed sandboxes). Remove useNewestProjectSession.
- Extract the nested-dropdown dismiss guard into a dependency-free module shared
by the settings and scheduled-task dialogs.
Co-authored-by: Isaac
* fix(projects): repair CI — Sidebar test mocks, e2e rewrites, retire inference e2e
- Add useProjectConfig/useUpdateProjectConfig to all 10 Sidebar test mocks
(Sidebar now mounts ProjectSettingsDialog, which calls them).
- Rewrite the settings-dialog e2e to create the project via POST /v1/projects
instead of the flaky row-kebab move-to-project flow.
- Fix the composer-prefill e2e to stub GET /v1/sessions/projects (bare array),
the real endpoint useProjects hits.
- Remove test_start_session_project_prefill — it exercised the newest-session
inference path this PR retired; config-driven prefill replaces its coverage.
Co-authored-by: Isaac
* fix(projects): address review — no data-loss on failed config load; fresh prefill after save
Blocking issues from the PR review:
1. Data loss: saving the settings dialog after a failed config GET sent `{}`,
which the server reads as "clear stored defaults". Now `useProjectConfig`'s
isError is surfaced; a first-class project whose config failed to load blocks
Save (with a notice), the seed effect skips a blank draft, and onSubmit bails.
2. Stale prefill after save: useUpdateProjectConfig only invalidated, so the
composer's one-shot prefill could latch onto a stale cached config (30s
staleTime) and drop just-saved defaults. It now setQueryData's the fresh
config and upserts the projects list (so a promoted label-only folder
resolves to its new id immediately).
Tests: dialog load-error blocks Save; hook seeds config + upserts list on
success; useProjectConfig disabled on null id and surfaces isError.
Co-authored-by: Isaac
* fix(web): center sidebar header buttons and soften session row hover
## Related issue
N/A
## Summary
- Vertically center section header action buttons (Projects `+`, Sessions kebab, etc.) with their titles by using `top-1/2 -translate-y-1/2` instead of `top-0.5`.
- Remove the 1 px lift on session row hover (`motion-safe:hover:-translate-y-px`) so rows stay visually anchored.
- Calm the hover flash by dropping the bouncy Otto-token transition on rows and reducing the global `--sidebar-hover` tint from 5% to 3%. Rows now use the same plain `transition-colors` pattern as the rest of the sidebar hover surfaces.
- Make `SIDEBAR_ACTIVE_HIGHLIGHT` also specify `:hover` styles so active items (current page, selected session, drop target) keep their active background on hover instead of switching to the hover tint.
## Test Plan
- `cd web && npm install && npm run dev`
- Hover over Projects/Sessions headers and confirm action buttons are vertically centered with the title text.
- Hover over active items (e.g., current page in the top nav, selected session row, current Inbox) and confirm the background stays in the active state and does not flash.
- Hover over inactive session rows and confirm the row no longer shifts up and the background highlight is subtler.
## Demo
Subtle hover/positioning polish. Verify by hovering items in the sidebar — buttons align with title baselines, rows stay still on hover, and active items don't flash.
## Type of change
- [x] Bug fix
- [x] UI / frontend change
- [ ] Feature
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Visually verified by inspecting the relevant Tailwind classes and CSS variables. No test coverage changes; the existing `Sidebar.projectHeaderChevron.test.tsx` covers header layout, and the hover behavior is primarily CSS.
## Changelog
Sidebar header action buttons are now vertically centered with section titles. Session row hover is smoother, and active items no longer flash when hovered.
* test(e2e-ui): regenerate visual baselines
---------
Co-authored-by: omnigent-ci[bot] <294685417+omnigent-ci[bot]@users.noreply.github.com>
## Related issue
N/A
## Summary
- Replace the web-resolved-theme bridge with a single cross-shell contract, `setThemeSource(theme)`, so the web app only reports the user's chosen theme source and each shell drives its own OS-level dark mode.
- Android: `MainActivity` now extends `AppCompatActivity`; `OmnigentBridgeListener` maps `setColorScheme` to `AppCompatDelegate.setDefaultNightMode`; system-bar icon contrast is derived from `resources.configuration.uiMode`. Removes `ResolvedColorScheme.kt`, the root-class MutationObserver, and the top-level navigation reset on init.
- iOS: Add a `ThemeSource` enum and `ThemeController` singleton inside the existing `OmnigentWebView.swift` target file to avoid `.pbxproj` edits; wire `setColorScheme` through the JS bridge and apply it via `.preferredColorScheme(...)` and `window.overrideUserInterfaceStyle`.
- Web: Update `nativeBridge.setThemeSource`, remove the `omnigent-native-ready` queue, and update `ThemeProvider`/`nativeBridge` unit tests.
- Android and web unit tests are updated to match the new contract.
## Test Plan
- iOS: `cd web/ios && xcodebuild -project Omnigent.xcodeproj -scheme Omnigent -destination 'platform=iOS Simulator,name=iPhone 17 Pro' -configuration Debug -only-testing:OmnigentTests test`
- Android: `cd web/android && ./gradlew :app:testDebugUnitTest`
- Web: `cd web && npm install && npm run type-check && npm run test -- ThemeProvider.test.tsx nativeBridge.test.ts`
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Manual verification completed for iOS: the app builds and `OmnigentTests` passes in the iPhone 17 Pro simulator. Android and web test suites were not run end-to-end in this session, but the affected unit tests were updated in the same change.
## Related issue
N/A
## Summary
- Add a top-level `justfile` that groups common local dev tasks (`run-ios`, `run-android`, `dev`, `electron-dev`, `lint`, `normalize-locks`, etc.) with hidden `_ensure-*` / `_check-*` prerequisites.
- Add an iOS `simulator` Fastlane lane that builds the Debug .app, installs it on an already-created iOS Simulator, and launches it.
- Add Android Gradle tasks (`runDebug`, `reverseProxy`) for launching the debug APK and running `adb reverse`.
- Fix the Fastlane `xcodebuild` invocation to use camel-case `derivedDataPath` so the built `.app` is written where the lane expects it.
- Export `FASTLANE_SKIP_UPDATE_CHECK=1` in the justfile.
- Document the new `justfile` recipes concisely in `AGENTS.md`.
## Test Plan
- `just --list` shows grouped recipes.
- `just run-ios` built/launched the iOS app in the iPhone 17 Pro Simulator.
- `pre-commit` passes on the touched files.
## Demo
N/A
## Type of change
- [x] Feature
- [ ] Bug fix
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Verified manually by running `just run-ios` and watching the Omnigent app launch in the iOS Simulator.
## Changelog
Add a top-level `justfile` with recipes for launching the iOS Simulator, running the Android debug build, starting the omnigent dev pod, and running pre-commit/lockfile normalization.
* feat(web): 3D model preview for STL / 3MF / OBJ files
Selecting an .stl / .3mf / .obj file in the Files browser now renders an
interactive WebGL preview (orbit/zoom/pan) instead of the "Preview not
available for binary files" placeholder.
- Add `isModelFile()` to codeViewerHelpers (MIME-first, extension fallback),
scoped to exactly STL/3MF/OBJ.
- New lazy-loaded `ModelViewer` component (three.js STLLoader/3MFLoader/
OBJLoader) with camera + OrbitControls, lighting, auto-fit, loading/error
states, and full scene teardown on unmount.
- Dispatch models before the binary-rejection branch in CodeViewer; treat
them like images in FileViewer (diff/source-mode suppressed).
- three.js pinned at 0.185.1 and code-split into its own chunk so it stays
out of the main bundle.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(web): address model-viewer review — unified resolver, recovery, teardown
Resolve the four blocking issues from cross-vendor review of the 3D model
preview:
1. Unified format interface: add one shared `getModelFormat(path, contentType)`
resolver (MIME-first, extension fallback) used by BOTH `isModelFile`
dispatch and `ModelViewer`'s loader selection, so a MIME-matched file with
an unknown extension parses via the correct loader instead of erroring.
`isModelFile` is now `getModelFormat(...) !== null`.
2. Error state no longer unmounts the canvas: the container is always mounted
and the error is an overlay on top, keeping the ref alive so an
invalid→valid prop change recovers.
3. Single idempotent `teardownScene()` called from both the init failure path
and the effect cleanup, so a partial init (renderer/controls/context/RAF)
can't leak on failure.
4. Empty/degenerate models (e.g. comment-only OBJ) are validated for a
non-empty, finite bounding box before fitting; invalid bounds route to the
error UI instead of a blank canvas.
Adds ModelViewer.test.tsx (MIME-only loader selection, malformed/empty/NaN →
error, invalid→valid recovery, failure-path + unmount teardown) and
getModelFormat unit tests.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* feat(web): theme-aware 3D model preview (light/dark)
ModelViewer previously hardcoded a neutral STL material, fixed light
intensities, and a transparent canvas, so the 3D preview ignored the app
theme. Make it theme-aware off the SAME next-themes source Monaco and the
terminal use (`useTheme().resolvedTheme`), so it tracks light/dark and
updates live when the user toggles the theme with a model open.
- Add a pure `modelViewerTheme(resolved)` map in codeViewerHelpers (mirrors
`resolvedThemeToMonaco`): background clear color, STL default material, and
ambient/key light intensities per mode — brighter lights in dark so the
mesh stays legible. Shared across STL/3MF/OBJ in the one unified pipeline.
- ModelViewer seeds the scene from the active mode and keeps light/material
handles on its resource bag so a theme toggle recolors the live scene in
place (clear color + intensities + STL color) with no reload/reparse.
- Drop the transparent (alpha) canvas in favor of a theme-derived opaque
background so the preview sits flush with the panel in both themes.
- Tests: three theme-awareness cases (light build, dark build, live toggle
without rebuild) mirroring the next-themes mock pattern in
MonacoCodeEditor.test.tsx, plus modelViewerTheme unit tests.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(web): 3MF MIME-only dispatch + prune package-lock churn
Add MIME-only 3MF coverage mirroring the existing STL/OBJ tests: a file
with an absent/unrecognized extension but a `model/3mf` content type must
resolve to the 3MF loader in ModelViewer and route to <ModelViewer> in
CodeViewer, exercising the shared getModelFormat() resolver.
Regenerate web/package-lock.json so the diff vs origin/main is limited to
the `three` dependency subtree — dropping unrelated resolved-URL
normalization churn from an earlier regen.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(web): dispose material textures in ModelViewer teardown
disposeObject() freed each mesh's geometry and material but not the
textures the material references (map, normalMap, roughnessMap, …), so a
textured 3MF leaked its GPU textures every time the viewer unmounted.
three.js frees neither the material nor its textures automatically.
Add disposeMaterial(), which disposes every texture slot on a material
(detected via the three.js `isTexture` flag, robust to multiple three
copies) before disposing the material itself. Extend the ModelViewer
teardown unit test with a textured-material mesh and assert its textures
are released on unmount.
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(e2e): cover 3D model preview in the Files browser
Add a Playwright e2e test that seeds an ASCII STL and an OBJ file, opens
each in the Files browser, and asserts the ModelViewer mounts: the
`3D preview of …` canvas host renders a <canvas>, the "Unable to render
3D model" overlay never shows (so parsing and WebGL both succeeded), and
the flow does NOT fall through to the binary placeholder or a source
view. STL exercises MIME-based routing (application/vnd.ms-pki.stl); OBJ
exercises the extension fallback. Seeded via the filesystem PUT endpoint
(no agent run), mirroring the existing image/pdf rendering e2e tests.
This satisfies the E2E UI Required gate for the model-preview feature.
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(web): resolve the 3D-viewer deps from the public npm registry
The three.js stack this PR added (three, @types/three,
@dimforge/rapier3d-compat, @tweenjs/tween.js, @types/stats.js,
@types/webxr, fflate, meshoptimizer) was locked with `resolved` URLs
pointing at an internal mirror (npm-proxy.dev.databricks.com), while the
rest of package-lock.json resolves from registry.npmjs.org. Public CI
can't reach that mirror, so `npm ci` timed out fetching
three-0.185.1.tgz (ETIMEDOUT) and failed the install-dependent checks.
Repoint just those eight `resolved` URLs to the canonical
registry.npmjs.org form. Integrity hashes are unchanged (the mirror
served identical tarballs), so this only changes where the tarballs are
fetched from, not what is installed. `npm ci --legacy-peer-deps` now
succeeds from a clean node_modules, and `npm install --package-lock-only
--legacy-peer-deps` produces no further diff, so the lockfile-up-to-date
gate stays green.
Signed-off-by: Bryan Li <bryan.li@gmail.com>
---------
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): honor system dark mode
Signed-off-by: Bryan Li <15131870+btli@users.noreply.github.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): sync system bar contrast
Signed-off-by: Bryan Li <15131870+btli@users.noreply.github.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): harden resolved theme sync
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* refactor(android): decode theme at bridge boundary
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(android): tighten theme bridge coverage
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): drop WebView algorithmic darkening
Algorithmic darkening inverts the SPA when the user forces light mode
while the OS is dark: the page's root color-scheme is then 'light', so
WebView treats it as dark-unaware and darkens it algorithmically,
leaving dark status-bar icons over a darkened page. With targetSdk >= 33
the DayNight host theme alone makes prefers-color-scheme track the OS,
so the darkening flag added nothing for the system-mode path and only
broke the forced-light path. Verified on an API 34 emulator across the
OS-light/dark x app-System/Light/Dark matrix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(web): keep Electron on the selected theme, not the resolved one
Reporting only resolvedTheme regressed Electron system mode: an explicit
Light selection under a light OS changes no resolved value, so no report
fired and themeSource stayed 'system' — the shell chrome then flipped
dark with the OS while the app was forced light. Report the resolved
scheme first (Android system-bar contrast) and follow with 'system'
while that is the selection: Electron keeps the last report, so it
tracks the OS in system mode and pins to explicit selections, including
ones that leave resolvedTheme unchanged. Android drops 'system' at the
bridge, so its behavior is unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix: route native themes by consumer
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): harden system bar theme sync
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(android): clean up theme bridge state
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): install theme bridge at document start
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(android): resync system bars on live theme changes
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* style(android): format theme test
Signed-off-by: Bryan Li <bryan.li@gmail.com>
---------
Signed-off-by: Bryan Li <15131870+btli@users.noreply.github.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
Co-authored-by: Bryan Li <15131870+btli@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
github-release.yml fired on every v[0-9]* tag push and created an
unpublished DRAFT release for rc/dev/alpha/beta tags. Nothing downstream
depended on those drafts — draft-release-notes.yml already skips rc,
finalize-release.yml refuses rc, and the Docker/homebrew/changelog
workflows fire on the tag push / release:published directly. The drafts
just accumulated (and rehearsal rcs had to be gh-release-deleted during
cleanup).
Add a guard that skips the draft-release job for rcN/devN/preN tags
(trailing digit required so a substring like 'dev' in a mistyped tag can't
trip it). Drop the now-dead alpha/beta arms — this repo only cuts rc
pre-releases — and align the same rc/dev/pre pattern + comments across
the other release-adjacent workflows for consistency. Update release.yml's
Next-steps text and RELEASING.md accordingly.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
## Related issue
Closes #[F-CR-7]
## Summary
- After a user consents to an unknown server (deep link) or types a server URL, `WorkspaceURLExpander.expandIfNeeded` issued a HEAD probe via `URLSession.shared` with no redirect policy, so the consented host could 3xx-redirect the probe to a different origin — including a local-network service — breaking the consent alert's promise that the app only talks to the host the user approved.
- The probe now defaults to a dedicated `URLSession` backed by `SameOriginRedirectHandler`, a `URLSessionTaskDelegate` that follows only same-origin redirects (scheme + host + port match) and blocks any cross-origin redirect by returning `nil` from `willPerformHTTPRedirection`.
- As defense in depth, `expandIfNeeded` additionally verifies `response.url`'s origin matches the approved origin, so a cross-origin response is never trusted even if a caller supplies a bare session without the redirect delegate.
- Rebased onto #3179 (F-CR-6) and deduped: removed my `--omnigent-deep-link` test hook (subsumed by #3179's `--omnigent-open-url` / `--omnigent-reset-state` seam), and consolidated the two `MockHTTPServer` copies into one shared file compiled into both test targets.
## Test Plan
- Unit: `WorkspaceURLExpanderTests.testRejectsResponseFromDifferentOrigin` returns a `server: databricks` 200 whose `url` is a different origin and asserts the URL is left unchanged.
- Integration (simulator, real local HTTP network): `WorkspaceURLExpanderRedirectTests.testBlocksCrossOriginRedirect` / `testFollowsSameOriginRedirect` assert a cross-origin redirect is blocked (response stays 302 on the approved port) and a same-origin redirect is followed. Confirmed meaningful: the cross-origin test fails when the delegate is reverted to follow-all-redirects (the vulnerable behavior).
- UI (simulator): `RedirectConsentUITests.testDeepLinkConsentOpensApprovedServer` drives the deep-link consent flow via #3179's `--omnigent-open-url` + `--omnigent-reset-state` seam and asserts the alert appears, "Open" loads the approved server's WebView.
- Ran on iPhone 17 simulator: all 8 expander/redirect tests + the UI smoke test + all 26 F-CR-6 deep-link tests pass; full project builds.
- Note: the UI test cannot exercise the redirect itself — a localhost deep link infers `http`, and the probe is https-only, so the probe never fires for loopback. The redirect policy is verified over a real local network by the integration test instead.
## Demo
N/A
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [x] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [x] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Manual verification: built and ran the new unit, integration, and UI tests on the iPhone 17 simulator; confirmed all pass and that the integration test fails against the vulnerable (follow-all-redirects) baseline, proving it is a meaningful regression test. Also ran all F-CR-6 tests after the dedup to confirm no regression from #3179's shared seam.
## Changelog
The iOS app no longer follows cross-origin redirects when probing a newly approved server for the Databricks workspace mount, so a consented host can't redirect the probe to a different origin.
* test: stabilize two known flakes (dictation close, agent-info popover)
Two load-timing flakes that recur across PRs:
- Pytest (server-rest) test_dictation.py::test_stream_closes_take_on_
abrupt_disconnect: on an abrupt disconnect the route offloads
handle.close() to a thread. During teardown the loop's thread-pool
executor may already be shutting down, so the offload raises and the
old contextlib.suppress swallowed it — the take (and, for the remote
engine, a worker slot) leaks. Fall back to a direct close() on the
loop; it's a quick non-blocking free for every engine.
- E2E UI test_agent_info_popover.py: _open_popover single-clicked the
trigger, but the button hover-opens on the click's own pointer arrival
and the click's Radix toggle can flip it back shut past the
HOVER_CLICK_GRACE_MS window under load, so the panel never mounts.
Confirm the panel opened and retry the click from a closed state.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* test: stabilize scheduled-tasks time-picker flake
test_scheduled_task_create_edit_modal_and_time_picker had two coupled
races in the time-picker step (6/10 failures reproduced, no artificial
load needed):
- The picker is a Radix popover nested in the create-task dialog. The
dialog's focus management can fire an interaction-outside that closes
it the instant it mounts, so the minute cells unmount between the
visibility check and the click (element-not-found / click timeout).
- Selecting a minute leaves the popover open, and an open floating-ui
popover keeps recomputing its position — so the submit button (and,
later, the edit-phase time input) stays perpetually "not stable" and
detaches mid-click.
Extract a _pick_minute() helper that opens from a known-closed state and
retries until the cell is present, then dismisses the picker via a
click-outside (not Escape, which would bubble to the Radix Dialog and
close it) and waits for it to unmount so the layout settles before
submit. 0/12 clean + 0/8 under load after the fix.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
The in-session "Configure" model dropdown offered a "Smart Routing" option on
native terminal sessions (Claude Code, Codex, Pi, …). It's meaningless there:
a native CLI bakes its model into the launch argv once and can't per-turn
route, so picking it did nothing useful.
Add isNativeTerminalSession() (mirrors the server's
_native_coding_agent_for_session: native by omnigent.wrapper label OR resolved
harness) and exclude such sessions from costRoutingEligible in ChatPage, so the
Smart Routing option no longer appears in their Model dropdown. Brain-harness
sessions (claude-sdk / codex / pi, and the polly orchestrator) keep it.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(scheduled tasks): add windowed latest-run-status store query
Add ScheduledTaskStore.list_latest_run_status_for_tasks(ids) -> {id: status},
a single row_number()-windowed query (scheduled_at DESC, id DESC — same order
as list_runs) returning each task's most-recent run status. Powers the Tasks
list completion badge in one query instead of N per-row /runs fetches, and is
correct under overlapping run-now runs (unlike a denormalized last_run_status
column). Tasks with no runs are absent from the map.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled tasks): run-now endpoint + status/next-run serializer fields
Backend for three Tasks-list run controls:
- last_run_status: _to_response now carries the task's most-recent run status
(from the windowed store query), populated on list/get/patch. Force-fail of
stale orphans runs BEFORE the status read so a dead run reports failed, not a
stuck running.
- next_run_at: _to_response carries the live scheduler's authoritative next-fire
ISO timestamp (scheduler.next_run_at) on list/get/create/patch — server-
sourced, never client-recomputed (paused/unarmed → null).
- POST /v1/scheduled-tasks/{id}/run: an immediate manual fire that REUSES the
shared fire path via build_run_now (same _run_fire_for_task body, dispatch/
preflight seams, and in-flight overlap guard as the scheduler). Paused tasks
are runnable (manual override); fire-and-forget → 202 Accepted. 409 when a
fire is already in flight, 404 for a non-owned task, 503 when the scheduler
subsystem is not running. Wired via app.state.scheduled_task_run_now.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled tasks): status pill, run-now menu, next-run on rows
Wire the three run controls into the Tasks list UI:
- last_run_status → a completion pill on each row (Failed/Skipped/Running/
Queued). Succeeded and never-run render NO pill (success is not noise);
Failed is destructive, Skipped muted — matching the Paused pill styling.
- next_run_at → "Next: <time>" on the schedule subline, formatted in the
task timezone via a new formatNextRunAt() that only FORMATS the server's
ISO value (never client-recomputes; paused/unarmed → nothing).
- Run now → a "⋯ menu" item + useRunScheduledTaskNow mutation (POST
/{id}/run) that invalidates the list + that task's runs so the pill
updates. Runnable for paused tasks; row busy-disables while in flight.
scheduledTasksApi gains lastRunStatus + nextRunAt (interface + wire map)
and runScheduledTaskNow(). Unit tests: pill per status, no-pill cases,
next-run formatting (tz + calendar-day boundary), run-now mutation wiring.
e2e: new run-controls journey (Run now → recorded run + pill flips);
existing schedule-line assertions relaxed to to_contain_text now that the
server next-run renders on the same line.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): bump task title size/weight on rows
Make the scheduled-task row title slightly larger and bolder: text-sm →
text-base and font-semibold → font-bold. Subline, pills, and spacing are
unchanged. Updates the one TasksPage sort-order test that located the title
by its .font-semibold class to .font-bold.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Revert "style(scheduled tasks): bump task title size/weight on rows"
This reverts commit e0195ce3c4977abdaeba5316426029f808edeef6.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): title 15px, metadata 13px on rows
Trim the row title to exactly 15px and the metadata subline to exactly 13px
using arbitrary-px classes (text-[15px] / text-[13px]) — the app root scales
rem ~1.125×, so the standard text-sm/text-xs would render 15.75/13.5px and
can't hit the exact target. Weights unchanged: title font-semibold (600),
subline no weight class (inherits 400). Pills, spacing, next-run text, and the
⋯ menu are untouched.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): lighten metadata subline on rows
Soften the row metadata subline one notch to a lighter gray via an opacity
step on the same theme token: text-muted-foreground → text-muted-foreground/80.
Theme-aware (works in light + dark), size unchanged (13px), and the next-run
<span> keeps inheriting the same color (no own color class). Title, pills,
spacing, and the ⋯ menu are untouched.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): tighten row spacing 2px, remove run-status pill
- Row vertical padding py-3 → py-[11px]: trims each side 1px so the gap
between adjacent rows drops from 24px to 22px (the list is flex-col with no
gap, so the row padding is the whole inter-row spacing).
- Remove the last-run status pill (Failed/Skipped/Running/Queued) entirely per
design: drop the render block, the RUN_STATUS_PILL map, the statusPill local,
and the now-unused ScheduledTaskRunStatus import. The Paused pill is kept
as-is. The lastRunStatus API/store field is left in place (harmless data;
only the visual is removed). Subline, next-run text, and the ⋯ menu unchanged.
Drops the per-status pill test cases in ScheduledTaskRow.test.tsx (that UI is
gone); keeps the paused-pill, next-run, and run-now tests.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): relative "Next run in Xh" on rows
Switch the row next-run display from an absolute label ("Next: Today 9:00 AM")
to a compact relative delta ("Next run in 15h" / "in 6d" / "soon"):
- formatNextRunAt now returns a delta (nextRunAt − now): <60m → "in Xm" (min
"in 1m"), <24h → "in Xh", else "in Xd", all floored; a delta below 1 min
(imminent / clock skew) → "soon"; null/unparseable iso → null. The `timezone`
param is dropped (a pure delta needs no zone) — call site + useMemo deps
updated. This only formats HOW FAR AWAY the server's authoritative next_run_at
is; it never recomputes WHICH instant is next on the client, so the old
"no client-recomputed countdown" rule still holds.
- Row prefix "Next: " → "Next run " so it reads "Next run in 15h".
Tests: rewrote the formatNextRunAt unit tests for the relative buckets +
boundaries + "soon" + null; updated the row test to the "Next run in …" prefix;
reconciled the e2e (the old count==0 "Next run" guard flips to positively
asserting the server-derived relative label — its real intent, no client
recompute, is unchanged).
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled tasks): darken row hover background
Bump the full-row hover tint one notch: hover:bg-muted/50 → hover:bg-muted/70
(same theme-aware `muted` token, higher opacity). The color-mix stays
`var(--muted) N% transparent`, so in light the effective tint goes ~2.9% → 4.1%
black and in dark the alpha goes 0.5 → 0.7 — visibly stronger but still subtle.
Comment updated to match. Nothing else changes.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
Adds a 'databricks_cli' credential_proxy type so sandboxed tools can use
the Databricks CLI without the real OAuth/PAT token ever entering the
sandbox. The operator lists which ~/.databrickscfg profiles to proxy;
each is materialized into the sandbox as a placeholder-only .databrickscfg
(oa_cred_* token), and the L7 egress proxy swaps the placeholder for the
real token on the way out.
- Refreshing token provider (DatabricksProfileTokenProvider) re-mints
short-lived OAuth tokens via the databricks SDK for long sessions;
CredentialRewriteRule gains an optional secret_provider and the proxy
resolves secrets per-swap (offloaded via run_in_executor).
- Placeholder-only files are materialized into the sandbox scratch dir
and pointed at via DATABRICKS_CONFIG_FILE / DATABRICKS_CONFIG_PROFILE.
- Requires the 'databricks' extra and linux_bwrap (the Go CLI ignores
SSL_CERT_FILE on macOS, so darwin_seatbelt is rejected at parse time).
- Egress stays operator-listed: the workspace host must be named in
egress_rules, consistent with the other credential_proxy types.
Signed-off-by: mxatone <mxatone@gmail.com>
## Related issue
N/A
## Summary
- Bring `omnigent-slack` into the lockstep release cycle (now four packages, not three): its `[project].version` was stuck at `0.1.0` while the rest of the repo moved to `0.7.0.dev0`, so the extra pin and lockfile drifted.
- Pin `omnigent-slack==0.7.0.dev0` in the root `slack` optional-dependency extra, mirroring the existing `omnigent-client==` / `omnigent-ui-sdk==` sibling pins so a published `omnigent[slack]` always pairs with the matching `omnigent-slack` release.
- Teach `scripts/update_versions.py` (the engine behind `.github/workflows/bump-version.yml`) about the 4th package: rewrite the slack `[project].version` and the extra `==` pin on every bump, and scan `[project.optional-dependencies]` (not just `[project.dependencies]`) when verifying sibling pins. Regenerate `uv.lock`.
## Test Plan
- `uv run --no-project --python 3.12 --with packaging python scripts/update_versions.py check` → prints `0.7.0.dev0` (all four packages agree, all sibling `==` pins present).
- `uv lock` → "Updated omnigent-slack v0.1.0 -> v0.7.0.dev0".
- `uv run ... python -m pytest tests/scripts/test_update_versions.py` → 13 passed (updated the test fixture + assertions for the 4th package).
- `tests/test_version.py::test_version_matches_pyproject` still passes (root pyproject == `omnigent/version.py` at `0.7.0.dev0`).
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [ ] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Updated `tests/scripts/test_update_versions.py` to include `integrations/slack/pyproject.toml` in the `repo_copy` fixture and adjusted the lockstep assertions (5 changed files, 4 `9.9.9` occurrences in root pyproject, 1 in slack). Verified the full suite (13 tests) passes. Also ran `update_versions.py check` and `uv lock` manually to confirm lockstep + lockfile consistency.
* feat(onboarding): report the installed-but-unconfigured harness state
Add the credential axis to the picker-facing readiness map so Claude, Codex,
and Pi report the yellow "installed but no credential" state — the signal the
web setup dialog needs to know when to offer an "Add credential" action
(the M2 keystone of Setup-From-the-UI). Purely additive: the values
("needs-auth" / "binary-missing") already exist in HarnessAvailability, and
the launch gate (harness_is_configured) stays binary-only, so a not-yet-authed
harness is never blocked from launching.
- New _family_provider_configured(): whether an omnigent-managed provider
(API key / gateway) serves the harness's family, reading the same config
omni setup's overview does. Subscription-kind is excluded (that lives in the
CLI's own login, judged by harness_cli_logged_in). Local, side-effect free,
never raises (fails to "no credential").
- Claude: ready when a provider is configured OR the CLI subscription login is
present (was CLI-login only — an API-key-only user wrongly showed yellow).
Checks config first to avoid the status subprocess on the common path.
- Pi: gains the axis it lacked entirely (was binary-only → always green once
installed). No CLI login, so binary + provider: installed-but-no-provider is
now "needs-auth".
Codex already had this (unchanged, the template). Qwen/OpenCode env-auth
unchanged.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(onboarding): write a harness provider credential from the UI
Second PR of Setup-From-the-UI (M3, security-sensitive). Adds the path that
turns a yellow "installed but not configured" harness green from the browser
for Claude / Codex / Pi, host-agnostic (local or remote), reusing the
credential-write logic omni setup already uses.
Design: the server is an authz'd pass-through. It validates ownership + the
UI-auth allowlist and forwards the secret over the (TLS) tunnel; the host DAEMON
does the write on the runner. The server never persists the secret, and the
frame's secret_value field is redaction-named so it never lands on a telemetry
span. Gated behind OMNIGENT_HARNESS_INSTALL_ENABLED (default off) exactly like
the install route (404 when disabled).
- New non-interactive core omnigent/onboarding/harness_auth.py: store a key /
gateway (secret → keychain, else ~/.omnigent/secrets.json; a providers: entry
referencing keychain:<name>, never the raw key), adopt an existing host env
var by reference (env:<VAR>, value never read), and detect adoptable env
credentials (non-secret descriptors only). First provider on a family becomes
the default; unsupported families/kinds are refused.
- New host.store_secret / _result frame pair; host daemon handler resolves the
harness→family, calls the core, and re-reports readiness so the badge flips
without a reconnect. Pi maps to its preferred anthropic family.
- New route POST /v1/hosts/{id}/harnesses/{harness}/credential (owner-scoped,
allowlisted, flag-gated) + registry pending_secret_writes plumbing + tunnel
result resolution.
- Regenerated openapi.json.
Tests: core unit tests (incl. the no-raw-secret-in-config invariant), frame
round-trip + telemetry-redaction, host-handler unit tests, and a full route
integration test over a fake tunnel (ownership, flag-off, allowlist, failure
mapping). 243 pass across the affected suites.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(onboarding): detect adoptable credentials on the host (adopt flow)
Adds the read side of the adopt flow: a host.detect_credentials frame pair +
GET /v1/hosts/{id}/credentials/detected that reports the credentials already
present on the host as NON-secret descriptors (family + source label + env var
name), so the UI can offer a one-click "adopt" instead of asking the user to
paste a key they already have. The value is never read or sent — adopt writes
an env:<VAR> reference via the existing store_secret path.
Owner-scoped + flag-gated like the credential-write route. Decode drops
malformed entries so a garbled payload can't inject a non-string field the UI
would trust. Adds frame round-trip (+ malformed-drop), host-handler, and route
integration (+ flag-off) tests; regenerated openapi.json.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(onboarding): tighten the credential route + adopt guard (Polly review)
Two review fixes on the credential-write path:
- The route gated on ui_installable_harnesses(), which includes the env-auth
opencode/qwen — the host handler then rejected them, turning a client/allowlist
problem into a confusing 502. Add ui_credential_configurable_harnesses() (the
Claude/Codex/Pi families the host can actually write) and gate on it, so
opencode/qwen get a clean 400 with no frame forwarded.
- adopt_env_credential now refuses an env var that isn't set on the host —
adopting an unset var would persist a provider entry that resolves to nothing
at the first turn. (Runs on the runner, so os.environ is the host's env.)
Tests: opencode/qwen added to the 400-rejection parametrize; an unset-env-var
adopt rejection case.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(server): serialize concurrent credential writes to one host (Polly review)
Polly non-blocking note: unlike the install route (which coalesces via
inflight_installs), the credential route had no guard against overlapping
writes. The daemon's write is a non-atomic load→merge→save of config.yaml
(twice — entry, then default), so two writes to one host in quick succession
(a double-click, or key + gateway) could interleave and clobber a sibling
providers: entry.
Add a per-connection credential_write_lock held around the store-secret
round-trip so writes to one host serialize. A gateway/local host still
processes different hosts concurrently (the lock is per HostConnection).
Adds an integration test that holds the first reply and asserts the second
frame only reaches the host after the first completes.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(onboarding): make Pi's auth step UI-authable and trackable
Pi's setup_steps auth descriptor was still the M1 shape (action="setup",
command="omnigent setup", status_key=None). Two consequences surfaced in
manual testing: (1) status_key=None made the step "unknown", so the setup
dialog dropped it and wrongly showed "Pi is ready" with no action even though
readiness reported needs-auth; (2) even rendered it was a CLI signpost, not
the credential form.
Pi is UI-authable now (PR A gave it the needs-auth readiness axis; the UI has
the credential form), so its auth step becomes action="auth" (opens the inline
form, keyed on kind=="auth"), command=None (Pi has no subscription CLI login),
status_key="authed" (trackable, so it's not dropped and the dialog reflects
the real state). Qwen stays the untracked env-auth signpost (not UI-authable).
Updates the pi test and adds a qwen-stays-signpost test.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* chore: use the `omni` CLI alias (omni setup) in setup guidance
Rename user-facing "omnigent setup" → "omni setup" in the harness setup-step
descriptors, the setup hint, and their doc-comments. `omni` is the installed
console entry point (pyproject: omni = omnigent.cli:main) and is already used
elsewhere in the codebase, so the shorter alias is correct and consistent.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: fix CI drift on the M3 backend branch (omni setup + auth action)
Two "Pytest (misc)" failures on this branch were stale test expectations, not
product bugs:
- tests/host/test_connect.py asserted the unconfigured-launch error names
"omnigent setup", but the earlier `omni` CLI-alias rename made the runtime
message say "omni setup". Update the positive assertion and the cursor
test's negative assertion (which guards that Cursor points at its own
installer, not the generic setup command) to the new spelling.
- tests/test_harness_capabilities.py restricted setup-step actions to
("install", "command", "setup"), but Pi's UI-authable step uses action
"auth" (added when Pi's credential step became a form). Add "auth" to the
allowed set; codex's own two-step assertion is unchanged.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: harden the install-flow e2e against a slow picker render
test_install_button_installs_missing_harness opened the agent picker and
immediately clicked the Codex row, but the picker mounts its rows only after
the /v1/agents fetch resolves. Under CI load that render lags, and a menu
opened before the data lands can render empty or re-close on the update — so
the bare open-then-click flaked with a 30s click timeout, the Codex row never
becoming actionable (seen across two different shards). Open the picker, wait
for the Codex row and re-open if the menu flapped, then click. No product
change; passes locally unchanged (the retry is a no-op on the fast path).
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: settle agent data before opening the picker in the install e2e
The install-flow e2e flaked (30s click timeout on the Codex row, then on the
picker trigger via an overlay pointer-interception when reopened). Root cause:
the picker opened before the /v1/agents fetch settled, racing the menu-open
against a re-render. Wait for the composer's "Set up Codex" notice (rendered
only once the Codex agent + its unconfigured host state load) BEFORE opening the
picker, then open once and click. Passes locally repeatedly.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: stop driving the agent picker in the install e2e (kill the flake)
The picker interaction was redundant — the single seeded Codex agent is already
auto-selected, so the composer's "Set up Codex" notice is present without
opening the dropdown. Driving the picker only added a menu-open-vs-async-render
race that flaked under CI load. Wait for the notice directly (generous 60s) and
click it to open the setup dialog.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: wait for network idle before asserting the setup notice (install e2e)
The "Set up Codex" notice depends on two async fetches re-rendering the
composer (/v1/agents auto-selecting the agent, /v1/hosts marking its harness
unconfigured). On loaded CI runners that chain lagged past the timeout and the
assertion raced the still-loading landing screen. Wait for network idle and the
host chip (readiness present) before asserting the notice.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* test: drop networkidle wait in install e2e (WS keeps network busy)
wait_for_load_state("networkidle") never fires in this app — the shell holds a
long-lived sessions/updates WebSocket, so the network is never idle. That wait
just burned its timeout and then raced the still-loading landing screen (the
"Set up Codex" notice was intermittently absent on CI). Replace it with plain
element waits (host chip, then the notice) at a generous 60s, matching every
other e2e_ui test. Passes locally repeatedly.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(host): adopt an env credential under its own family, not the harness's
Review (isaac, MAJOR): pi consumes both the anthropic and openai families, so
the UI can offer an OpenAI env var (e.g. $OPENAI_API_KEY) as adoptable for pi.
`_handle_store_secret` derived the family solely from the harness (pi→anthropic)
and passed that to `adopt_env_credential`, so adopting that var wrote an
anthropic-family provider whose api_key_ref is env:OPENAI_API_KEY — mis-routed
to the anthropic endpoint, failing at run time. For the adopt kind, look the env
var up in the host's detected credentials and use its OWN detected family
(falling back to the harness family if absent). Adds a pi-adopts-OpenAI
regression test.
Also carry the install-flow e2e fix onto this branch: explicitly select Codex
in the picker and stub the /v1/sessions?kind=any agent scan so the seeded-DB
agents don't leak in and leave Claude Code selected (a CI-only flake).
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(host): harden the UI credential-write path (review feedback)
Addresses Polly's blocking finding + hardening notes and Pat's nits on the
store_secret/adopt path:
- BLOCKING (adopt boundary): the daemon's adopt handler fell back to the
harness-derived family when an env var wasn't detected, and adopt_env_credential
only checked the var was *set*. An owner hitting the raw API could name any set
env var (a DB password, an unrelated secret) and have it persisted as a provider
credential sent to the vendor endpoint. Now the handler refuses an env_var that
isn't in detect_adoptable_credentials() (no fallback) — enforcing server-side the
same "only adopt what was detected" restriction the UI presents.
- secrets.py: create the file-backend secrets.json 0600 atomically via
os.open(O_CREAT, 0o600) instead of open()+chmod-after, which briefly left a
freshly-created file group/world-readable. Now network-triggerable, so worth
closing. Fixes the stale "0600 from the start" comment.
- adopt_env_credential: presence-only env check (`in os.environ`, not `.get`) so
the "never reads the value" contract stays literally true.
- gateway base_url: reject a non-http(s) scheme at write time rather than writing
a malformed provider entry that fails opaquely at the first turn.
- connect.py: hoist the harness_auth / provider_config imports to module top
(no circular import) to match the sibling onboarding imports.
Adds regression tests: adopt refuses an undetected env var, gateway rejects a
non-http base_url, and secrets.json is 0600 even under a permissive umask.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
---------
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
The Docker entrypoint's build_app() was constructing RuntimeCaps()
bare, so the llm:, policies:, and routing: blocks in a docker
deployment's config.yaml were silently ignored. This meant:
- Builtin policies that read event["llm_client"] (e.g.
deny_trivial_to_expensive_model) would always see None and abstain.
- default_policies declared under policies: would never fire.
- LLM-based and external routing clients were never built.
Mirror the logic from cli.py: parse_server_llm / parse_default_policies
/ routing client construction are now applied before RuntimeCaps is
passed to init_runtime, putting docker deployments on par with the
CLI-started server.
Fixes#3159
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Follow-up to #3189. Every session serialization path collapses per-user
`omnigent.pinned.<user>` keys via `_labels_for_viewer` except
`_child_session_summary_from_conversation`, which passed `conv.labels` through
raw. Child sessions aren't pinnable today (the pin affordance lives only on
top-level sidebar rows), so this is a latent gap rather than a live leak — but
if a shared child were ever pinned, its summary would expose another viewer's
pin key.
- Strip any `omnigent.pinned.<user>` key from a child summary's labels. No
collapse-to-canonical: there's no pin to surface, just the defensive strip.
- Test: a child carrying two users' pin keys yields a summary with no pin key,
while unrelated labels survive.
- Correct the stale `useMigrateLocalPinsToServer` docstring: the migration
patches the pinned-list cache (like `useTogglePinnedConversation`), it does
not invalidate the pinned query.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(pi-executor): add supportsUsageInStreaming:false to databricks-completions
Gemini, Qwen, inkling, and other non-OpenAI models in the databricks-completions
provider reject stream_options (which Pi sends with include_usage:true by default)
with 400 'unknown field'. Add supportsUsageInStreaming:false to suppress it,
matching what pi_native_credentials.py already does for omnigent-completions.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(pi-executor): use openai-responses for newer GPT models (gpt-5-5, gpt-5-6-*)
Newer GPT models reject function tool calls via /chat/completions with 400.
The Databricks Responses API (/ai-gateway/codex/v1/responses) now supports
tool-result chaining on subsequent turns (previously it did not).
- Add databricks-openai provider using openai-responses at /ai-gateway/codex/v1
for gpt-5-5, gpt-5-6-*, gpt-5-3-codex (matches pi_native_credentials routing)
- Keep databricks provider (openai-completions at /serving-endpoints) for
older GPT models (gpt-5-4, gpt-5-4-mini) that work fine with /chat/completions
- Add _pi_needs_responses_api() helper mirroring pi_native_credentials
- Update _pi_provider_for_model() to route to databricks-openai when needed
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(pi-executor): add kimi to reasoning model fragments
kimi-k2-7-code streams output on reasoning_content channel like GLM/DeepSeek.
Without reasoning:true in the model entry Pi ignores reasoning_content and
sees an empty stream, throwing 'Stream ended without finish_reason'.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(test): update kimi model entry to expect reasoning:true flag
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(pi-native): add reasoning:true to kimi/glm/deepseek model entries
These models stream output on reasoning_content channel. Pi's openai-completions
parser requires reasoning:true on the model entry to consume that channel;
without it the stream has no content and the turn ends with
'Stream ended without finish_reason'.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(pi-native): exclude qwen3 from completions provider
qwen3 models return content as a typed array [{type:'reasoning',...},{type:'text',...}]
when tools are present, causing Pi's streaming handler to produce [object Object].
Same root cause as gpt-oss; same fix.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix: add inkling to reasoning model fragments and LLM detection
Both kimi and inkling stream output on reasoning_content channel with
content=null. Added inkling to _PI_REASONING_MODEL_FRAGMENTS (executor),
reasoning:true model entry condition (pi-native), and LLM name detection
tokens so it appears in the model list.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* refactor: use allowlist for GPT completions-compatible models
Instead of a denylist of specific model ids that need the Responses API,
maintain an allowlist of GPT models known to work with /chat/completions.
Any GPT model not in the allowlist defaults to Responses API — safer
for new models not yet explicitly tested.
The executor's _pi_needs_responses_api now delegates to the same
implementation in pi_native_credentials for a single source of truth.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Smart routing was gated behind an OMNIGENT_SMART_ROUTING=1 opt-in on top of the
routing/llm config. The env is redundant: build the routing client whenever the
config supplies one — a server llm: block (built-in judge) or a
routing.provider=external block (external routes:select service). Remove the env
gate in cli.py and refresh the stale references in app.py, advise_models.py, and
web capabilities.ts. Server smart_routing_enabled already keyed on the resolved
client, so the /v1/info signal is unchanged.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
The modular-registry proposal described the phases as thin numbered lists.
Turn them into a concrete, verified implementation plan reviewers can cost:
- Add a "Current state (verified 2026-07-24)" subsection grounding the plan
in the tree at main (59e6b70e): data model ready but no native_providers
field; run_<x>_native already near-uniform (only claude/codex/antigravity/
opencode carry extra kwargs); coverage uneven across hubs (resume 10,
chat-redirect 6, interrupt 9, stop 7); dead _HARNESS_MODULES literal still
present; harness_catalog() emits no native-agent rows.
- Phase 1 (core-only seam): 8 PRs (1.1–1.8) in a table with scope, key files,
dependencies, risk, and estimates. 1.1 provider model + resolver is the
additive foundation; 1.5 runner launch/terminal-route is the risk center.
- Phase 2 (community + web): 4 PRs (2.1–2.4).
- Add an effort summary: ~26–37 engineer-days across ~12 PRs, critical path
1.1 → 1.2 → 1.5 → 2.2 → 2.3. Refresh the Bottom line to match.
Docs-only; no code paths affected.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* fix(web): remove "Create new project" from the project picker menu
Projects are created via the + icon next to the Projects header in the
sidebar, so the picker's own "Create new project" row was a redundant,
second entry point. Drop it (and the inline new-project input it toggled)
from ProjectPickerMenu, leaving search, the project list, and "Remove
from <project>".
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e_ui): file sessions via the + button after dropping picker create
The project picker no longer offers an inline "Create new project" row, so
the e2e helpers that drove that flow broke. Rewrite `_move_to_new_project`
to create the empty project from the Projects-header + button first, then
file the session via the kebab picker by name.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(sessions): persist pinned sessions server-side as a per-user label
Pins were client-only (localStorage), so they didn't follow a user across
devices. Move them to a server-side per-user session label so a pin persists
and stays per-user even on shared sessions.
- Store: `omnigent.pinned.<user_id>` label (value = epoch-ms pin time);
`pinned_label_key()` hashes over-long user ids to fit the 128-char key
column. `list_conversations(pinned=True, pinned_owner=…)` filters to the
caller's own key.
- Route: `GET /v1/sessions?pinned=true` enumerates the caller's pins
(independent of the loaded window); PATCH rewrites the client's canonical
`omnigent.pinned` to the caller's per-user key, and `_labels_for_viewer`
collapses it back on read so the per-user dimension never crosses the API
and no viewer sees another user's pin key.
- Write-integrity: reject any client-supplied suffixed `omnigent.pinned.<user>`
key so a caller can't pin/unpin for someone else.
- Forks drop per-user pin keys by prefix (a clone must not inherit pins).
- Web: server-authoritative `usePinnedConversations` + optimistic
`useTogglePinnedConversation`; Pinned section ordered by pin timestamp;
one-time localStorage->server migration that retains pins whose write failed.
- Guard `relativeTime`/`absoluteTime` against non-finite input (no more "NaNy").
Co-authored-by: Isaac
* test(e2e-ui): drive visual-snapshot pins via ?pinned=true, not localStorage
The populated-sidebar visual baseline seeded the pinned session in localStorage,
but pins are now server-authoritative (GET /v1/sessions?pinned=true). Under the
new model the localStorage seed is ignored and the bare-list stub answered the
pinned query too, so every row rendered as pinned → baseline mismatch (the
non-blocking UI Snapshot job).
- Split a `?pinned=true` route out from the bare-list regex (which now also
excludes `pinned=`, mirroring the existing `project=` exclusion) and return
just the pinned row, carrying the canonical `omnigent.pinned` label.
- Drop the `omnigent:pinned-conversation-ids` localStorage seed.
- Apply the same fix to the pinned-project flyout baseline (it passed only by
luck — its bare-list stub happened to return exactly the one pinned row) and
give its row the pin label so it's explicit, not incidental.
Co-authored-by: Isaac
* fix(sessions): let read-only collaborators pin a shared session
Pinning moved server-side (per-user `omnigent.pinned.<user>` label) but the
session PATCH gated all label writes at LEVEL_EDIT, so a read-only collaborator
on a shared session could no longer pin it — a regression from the localStorage
model, which had no permission check.
- Gate a pin-only PATCH (labels == {omnigent.pinned}, no other field) at
LEVEL_READ: pinning is a personal per-viewer preference, not an edit to the
session, so anyone who can SEE it may pin it. Any other field keeps the
edit/owner requirement. Unpin ("" value) is still pin-only, so it downgrades
too. The `?pinned=true` list is already scoped `accessible_by`, so a shared
pin surfaces on "Shared with me".
- Tests: a LEVEL_READ grantee can pin AND unpin a shared session; the downgrade
stays narrow (a non-pin label, or a pin bundled with one, still 403s).
- Rework the access-tier comment to match the if/elif/else (READ / OWNER / EDIT).
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Co-authored-by: Isaac
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
PRs #3148 (extract native terminal orchestration) and #3149 (split the
native app-session test monolith) landed the two remaining Phase 0 file
splits. Update the proposal to reflect reality:
- §1 runner hub: app.py is now ~10.1k lines (was ~20.1k) plus the new
omnigent/runner/native/orchestration.py (~6.5k); drop the stale absolute
line-number anchors and clarify that the dispatch arms and interrupt/stop
closures stayed in app.py while the builders/mirrors moved out.
- Phase 0: mark both runner/app.py and the test monolith Done, noting the
single-orchestration.py outcome (vs the proposed three-way split) and the
nine concern-scoped test modules + shared conftest.py.
- Risk section: re-anchor the forwarder registry to _AUTO_FORWARDER_TASKS in
its new home and note the risk now shifts to Phase 1.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* refactor(server): split sessions.py into domain sub-modules
sessions.py (7799 lines) is split into 8 focused route files under
_sessions/:
routes_core.py — CRUD, list, WS updates, fork, switch-agent
routes_hooks.py — /hooks/* and /policies/evaluate
routes_items.py — /items and /child_sessions
routes_resources.py — /resources/* (terminals, files, environments)
routes_browser.py — /browser/*
routes_elicitations.py — /elicitations/*
routes_events.py — /events, /stream, DELETE /sessions/{id}
routes_permissions.py — /permissions/*, /owner
routes_agent.py — /agent, /agent/contents, /mcp
Each file exports a register_X_routes(router, ...) function.
create_sessions_router() becomes a thin delegator (~533 lines).
helpers.py gains proxy wrappers for _same_provider_family,
_agent_is_native, _agent_carries_native_fork_history,
_presentation_labels_for_agent, and _reset_runner_resources_after_switch
so existing test monkeypatches on sessions.<name> continue to work.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* refactor(server): move sessions/ route sub-modules out of _sessions/
Convert sessions.py to a sessions/ package and move the 8 routes_*.py
files from _sessions/ into sessions/, so the public package layout is:
routes/sessions/__init__.py (facade, formerly sessions.py)
routes/sessions/routes_core.py
routes/sessions/routes_hooks.py
routes/sessions/routes_items.py
routes/sessions/routes_resources.py
routes/sessions/routes_browser.py
routes/sessions/routes_elicitations.py
routes/sessions/routes_events.py
routes/sessions/routes_permissions.py
routes/sessions/routes_agent.py
_sessions/ retains only the private internals (common, helpers,
orchestration) that do not need public names.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(server): use facade indirection for session_stream and get_agent_cache consistently
routes_browser, routes_events, and routes_hooks were still calling
session_stream.publish() and get_agent_cache() via the direct module
binding. Apply the same facade-indirection pattern already used in
routes_core so all call sites are consistent and test monkeypatches on
sessions.session_stream / sessions.get_agent_cache are honored.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(server): fix lint, _to_agent_object closure, and pyproject.toml exemptions
- Move _policy_type, _policy_description, _to_agent_object from inside
register_permissions_routes closure to module-level in routes_permissions.py
so routes_agent.py can import them directly. Fixes NameError crash on
GET /sessions/{id}/agent in server-approvals tests and E2E tests.
- Add missing 'return router' at end of register_permissions_routes (was
missing after the closure reorganization).
- Import the three helpers explicitly in routes_agent.py.
- Update pyproject.toml per-file-ignores to cover sessions/*.py and
sessions/__init__.py with the same exemptions the original sessions.py
had (ARG001, ARG002, BLE001, E501, F401, F403, F405) so pre-commit
ruff passes.
- Run ruff format on all sessions/ sub-modules.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(server): fix all proxy/monkeypatch misses and restore noqa directives
Route sub-modules were importing _X_impl directly instead of using the
facade proxy, causing monkeypatch(sessions, '_X', ...) to have no effect.
Fix by removing all '_X_impl as _X' imports from routes_*.py — the star-
imports from _sessions.helpers and _sessions.orchestration already bring
in the correct facade-delegating proxies.
Additional fixes:
- Access _SESSION_UPDATES_MAX_WATCHED, _SESSION_UPDATES_RESCAN_INTERVAL_S,
_SESSION_UPDATES_HEARTBEAT_INTERVAL_S through the facade in routes_core.py
so monkeypatch(sessions_routes, '_SESSION_UPDATES_*', N) works.
- Use _load_agent_spec_for_session proxy (not impl) in routes_resources.py.
- Access get_caps() through facade in routes_hooks.py evaluate_policy so
monkeypatch('omnigent.server.routes.sessions.get_caps', ...) fires.
- Restore noqa: BLE001 and F401 directives in _sessions/helpers.py and
_sessions/orchestration.py that were stripped by the RUF100 auto-fix.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(server): delete old sessions.py, fix remaining facade proxy misses
- Delete omnigent/server/routes/sessions.py (the file was rm'd in a prior
commit but never staged; CI was still linting it and seeing F403/F405).
- Route _HOST_BOUND_RUNNER_CONNECT_GRACE_S through the facade in
routes_events.py (3 call sites) so monkeypatch(sessions_module,
'_HOST_BOUND_RUNNER_CONNECT_GRACE_S', ...) is honored.
- Route _recover_subagent_status_forward_via_parent through facade
in routes_events.py.
- Route _registered_runner_id through facade in routes_core.py.
- Route _BROWSER_ACTION_AWAIT_S through facade in routes_browser.py.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(server): route patchable names in routes_hooks.py through facade
All five hook handlers and evaluate_policy use module-level timeout
constants (_CLAUDE_NATIVE_PERMISSION_HOOK_TIMEOUT_S etc.) and auth
helpers (_get_user_id, get_caps, get_agent_cache) that tests monkeypatch
on the sessions facade module. Access them through _sf (the facade) at
call time so monkeypatch(sessions_route, '_CLAUDE_NATIVE_PERMISSION_HOOK_TIMEOUT_S', 0.1)
and monkeypatch('omnigent.server.routes.sessions.get_caps', ...) are honored.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Re-running CI today means pushing an empty commit or rebasing, which fires a
push event and dismisses existing approvals (branch protection keeps
dismiss-stale-reviews on to block approve-then-swap). A `/rerun` comment
re-runs failed jobs on the existing head SHA instead -- no new commit, so
approvals survive.
Authorized to the PR author or a write-access commenter. Only re-runs the
mock-LLM `pull_request` test suites; the merge gates and Polly AI Review are
left alone. Single file (no privileged relay) because issue_comment gets a
writable base-repo token even for fork PRs.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pat.sukprasert@databricks.com>
--edit-last edits the most recent PR comment regardless of author or
content, so it was overwriting the UI preview comment when both workflows
ran on the same PR. Switch to the same find-by-marker + PATCH approach
used by ui-preview.yml so each workflow manages its own comment.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(web): make session rename optimistic so the new name shows instantly
Renaming a session left the stale name in the sidebar for the duration
of the PATCH round-trip: all cache patching happened in the mutation's
onSuccess, so the row only repainted once the server responded.
Move the cache overlay into onMutate so the new title paints on the next
frame, snapshot the old title for rollback, and restore it in onError.
onSuccess still reconciles with the server-confirmed title + updated_at
and keeps the deliberate no-refetch behavior (an immediate GET races the
search-index reindex). Also patch the ["project-sessions", name] caches
that project folders render from — the flat ["conversations"] overlay
never touched them, so a filed session's row stayed stale until the WS
reconcile.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): cancel in-flight list queries before optimistic rename overlay
Close the in-flight-reconcile clobber race flagged in review: an
already-running GET /v1/sessions reconcile poll (or a WS-triggered
fetch) could resolve after onMutate and overwrite the optimistic title
with the stale search-indexed name. Cancel the ["conversations"] and
["project-sessions"] queries in onMutate before overlaying so no
in-flight fetch can win.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Add an opt-in agent_name field to SessionCreatedEvent. Only polly and
debby are populated — all other agent names are withheld to avoid leaking
user-defined agent names in telemetry.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(sandbox): support OMNIGENT_CONTAINER_RUNTIME env var for container runtime selection
Allow switching the container runtime (e.g. from docker to podman) via the
OMNIGENT_CONTAINER_RUNTIME environment variable instead of requiring per-agent
YAML configuration. The per-agent container_runtime key still takes precedence
over the env var.
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* fix(test): add missing top-level `Any` import in test_local.py
Ruff flagged F821 (undefined name) because `Any` was used in a
runtime dict annotation but only imported inside a nested function.
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* fix(test): read version dynamically in crash handler test
The test hardcoded "0.6.0.dev0" which breaks when the installed
version diverges from the source (e.g. after a version bump).
Read omnigent.version.VERSION at runtime instead.
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* Revert "fix(test): read version dynamically in crash handler test"
This reverts commit 53855f5c10e3573e9d1ddbfd2afb0bd76abbc91e.
* fix: address review comments on container runtime PR
- Make container_runtime field explicitly Optional to avoid misleading
type annotation and unnecessary type-ignore
- Update parser docstring to mention OMNIGENT_CONTAINER_RUNTIME as an
additional default source
- Update shell script header comment to say "container runtime" instead
of "Docker"
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* fix(test): add autouse fixture to clear OMNIGENT_CONTAINER_RUNTIME
Prevents the host environment from leaking into tests that assume
the default runtime is "docker".
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* style: add missing blank line before autouse fixture
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* fix: address additional review comments on container runtime PR
- Rename _ALLOWED_RUNTIMES to ALLOWED_RUNTIMES (public API used
cross-module by the parser)
- Reject container_runtime: null in YAML instead of silently falling
back to the env var default
- Add test for container_runtime: null rejection
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
---------
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
* feat(onboarding): report the installed-but-unconfigured harness state
Add the credential axis to the picker-facing readiness map so Claude, Codex,
and Pi report the yellow "installed but no credential" state — the signal the
web setup dialog needs to know when to offer an "Add credential" action
(the M2 keystone of Setup-From-the-UI). Purely additive: the values
("needs-auth" / "binary-missing") already exist in HarnessAvailability, and
the launch gate (harness_is_configured) stays binary-only, so a not-yet-authed
harness is never blocked from launching.
- New _family_provider_configured(): whether an omnigent-managed provider
(API key / gateway) serves the harness's family, reading the same config
omni setup's overview does. Subscription-kind is excluded (that lives in the
CLI's own login, judged by harness_cli_logged_in). Local, side-effect free,
never raises (fails to "no credential").
- Claude: ready when a provider is configured OR the CLI subscription login is
present (was CLI-login only — an API-key-only user wrongly showed yellow).
Checks config first to avoid the status subprocess on the common path.
- Pi: gains the axis it lacked entirely (was binary-only → always green once
installed). No CLI login, so binary + provider: installed-but-no-provider is
now "needs-auth".
Codex already had this (unchanged, the template). Qwen/OpenCode env-auth
unchanged.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* docs(onboarding): clarify _family_provider_configured checks entry presence
Polly review nit: the helper returns True when a non-subscription default
provider *entry* exists, not when its secret actually resolves — an entry
pointing at an unset env:/keychain ref still reads configured (matching the
secret-blind omnigent setup overview). Reword the docstring from "usable
credential" to "a default provider entry is present" and note the
secret-blind behavior + why it's safe (launch gate is binary-only; signal
only moves toward green). No behavior change.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* refactor(onboarding): address review nits on readiness detection
- Hoist the provider_config import in `_family_provider_configured` to the
module top (no circular import); update the test monkeypatch targets to the
now-module-bound name.
- Drop the internal milestone label from a test docstring.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
---------
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(sandbox): parse and validate sandbox.kubernetes.pvc_mounts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* feat(sandbox): add pvc_mounts volumes to the runner Pod manifest
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* feat(sandbox): thread pvc_mounts through the kubernetes launcher
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* docs(deploy): document sandbox.kubernetes.pvc_mounts
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* feat(sandbox): fail loud on unknown sandbox.kubernetes keys
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(sandbox): lock in pvc_mounts collision-order, null read_only, and claim-reuse semantics
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* test(sandbox): pin the reserved-mount HOME prefix to the launcher's _HOME_DIR
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* refactor(sandbox): reuse shared validators in the pvc_mounts parser
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(sandbox): close pvc_mounts reserved-path gaps from review
Reject mount_paths with exactly two leading slashes — POSIX normpath
preserves them so '//home/omnigent' passed both validation gates while
the kernel collapses '//' to '/' at mount time, shadowing HOME. Add
/opt to the reserved prefixes: the host image's omnigent venv lives at
/opt/venv and was shadowable. Both cases now covered in the fail-loud
parametrization.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
* fix(sandbox): reject pvc_mounts paths that mount over reserved prefixes
The reserved-path check only caught mount_paths at or under a reserved
prefix, so an ancestor like /home or /var passed validation while
mounting over the HOME emptyDir mountpoint or the Secret projections.
Reject ancestors too, and reserve /run, /var/run, and /var/lock in full
so the Debian image's /var/run -> /run and /var/lock -> /run/lock
symlinks can't alias around the lexical check.
Co-authored-by: Isaac
Signed-off-by: Bryan Li <bryan.li@gmail.com>
---------
Signed-off-by: Bryan Li <bryan.li@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
## Related issue
Closes F-CR-6
## Summary
- `DeepLink.parse` validated the `/c/<id>` segment with only `!contains("/")`, but Foundation's `URL.path` is percent-DECODED — so `omnigent://host/c/id%3Fview=terminal` exposes `?` as a literal in the path and smuggles a query (and `%23` a fragment, `%2e%2e` a `..`, `%00` a control char) past the intended "/c/<id> only" shape. Added a denylist that rejects `?`, `#`, `/`, `.`, `%`, and control chars in the decoded id, so an encoded separator that `URL.path` decoded into one of those is dropped.
- The denylist deliberately does NOT assume the id's exact format (the server emits 32-hex uuids today, but the SPA's `/c/:id` route accepts any non-slash segment); the SPA stays the authority on id validity, and a future id scheme (ULID, nanoid, base64) won't be silently rejected. Benign non-canonical ids like `conv_abc` are accepted; only structure-smuggling is blocked.
- Documented the custom-scheme hijack risk in `DeepLink.swift`: iOS doesn't verify single ownership of `omnigent://`, so a co-installed app can read the link's host + id (metadata disclosure). For managed Databricks domains that can serve an `apple-app-site-association`, prefer verified Universal Links; the custom scheme is retained for BYO/OSS servers that can't host AASA, with the interception risk documented.
## Test Plan
- Unit tests (`OmnigentTests/DeepLinkTests`): 19 cases, all pass — including `testRejectsSmuggledQueryViaEncodedQuestionMark` (`%3F`→`?`), `testRejectsSmuggledFragmentViaEncodedHash` (`%23`→`#`), `testRejectsEncodedDotAndDotDot` (`%2e%2e`), `testRejectsControlCharacters` (`%00`/`%0A`/`%7F`), `testRejectsMalformedPercentEscape` (`%zz`), and `testAcceptsBenignNonCanonicalIds` (`conv_abc`/`x`/`not-a-uuid` are accepted — no smuggled structure).
- UI tests (`OmnigentUITests`): 6 cases via a DEBUG-only `--omnigent-open-url` launch-argument seam that routes the link through the real `handleDeepLink`/`DeepLink.parse` (XCUITest can't reliably deliver custom-scheme URLs on this toolchain). `testValidDeepLinkShowsConsent` (valid link → consent alert), `testBenignNonCanonicalIdIsAccepted` (`conv_abc` → consent alert), and rejection tests for smuggled `?`/`#`/`..`/control-char (no alert). A `--omnigent-reset-state` flag wipes persisted server state so each case starts with no known server. All pass on the iOS simulator.
- Manual simulator verification: drove `xcrun simctl openurl` against the running app with `OMNIGENT_DEEPLINK_TRACE` set; NSLog trace confirmed `ACCEPTED` for the valid link and `REJECTED` for all 5 smuggling/malformed links (smuggled `?`/`#`, `..`, control char, non-id).
## Demo
N/A
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [x] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [x] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Manually verified end-to-end on the iOS simulator: launched the app with `OMNIGENT_DEEPLINK_TRACE=1` and sent six real `omnigent://` links via `xcrun simctl openurl`. The NSLog trace showed `ACCEPTED` for the valid link and `REJECTED` for all smuggling/malformed links, proving the fix through the real `DeepLink.parse` → `handleDeepLink` path. The DEBUG-only `--omnigent-open-url` / `--omnigent-reset-state` launch-argument seam and `OMNIGENT_DEEPLINK_TRACE` NSLog logging are compiled out of Release builds (gated by `#if DEBUG`), so there is no production behavior change from the test infrastructure.
* fix(cli): normalize Azure Databricks custom-URL workspaces to their canonical host
omni login (and omni host) failed for Azure Databricks workspaces with a custom
(vanity) URL like https://mydomain.azuredatabricks.net/?o=<workspace_id>: the
vanity edge 303-redirects the unauthenticated probe to /login instead of
answering, so _databricks_workspace_login_target does not recognize the
Databricks posture and login fails. The canonical host
adb-{workspace_id}.{workspace_id % 20}.azuredatabricks.net does answer, and the
?o=<workspace_id> selector already carries the id.
Rewrite the custom host to the canonical adb- form in _resolve_server_url (the
shared normalization every --server entry point uses, so omni host is covered
too). Only *.azuredatabricks.net hosts that are not already the adb- form and
carry a numeric ?o= are touched; AWS/GCP hosts, canonical URLs, and URLs without
a selector are left unchanged.
Closes#2781
Signed-off-by: Enes Yilmaz <enesyilmaz5157@gmail.com>
* fix(cli): probe before adopting the canonical Azure Databricks host
The custom-URL fix landed the canonical adb- host rewrite unconditionally in
_resolve_server_url, so a wrong synthesis could strand the user on a host they
never typed, and the unit tests only re-asserted the implementation's own
arithmetic (123 % 20 == 3), which would pass under any modulus.
Try the URL as the user gave it first. Only when that fails to resolve, and only
for an Azure vanity workspace URL carrying a numeric ?o=, synthesize the
canonical host, probe it, and adopt it if it answers. A dead synthesis now falls
back to the user's URL instead of replacing it.
The shard rule remains an observed regularity rather than a documented contract
(Microsoft calls the segment a random number and treats properties.workspaceUrl
from the ARM API as authoritative), so the probe keeps it off the load-bearing
path. Docstrings say so plainly.
Also:
- _canonicalize_azure_databricks_url is now _canonical_azure_databricks_url and
returns None to decline, so a caller can tell "not applicable" from "no change".
- Guard the selector with isascii() as well as isdecimal(): str.isdecimal()
accepts non-ASCII digits that int() also parses, which synthesized a
nonsensical host.
- _probe_root reduces a URL the way _workspace_api_server_url does before
probing. Without it the comparison against the expansion's result never
matched (it drops the ?o= selector first, and that selector is what makes a
URL a candidate), and the new probe requested /?o=123/v1/me.
- Replace the tautological shard assertions with five real observed
workspace/host pairs, and drive the resolver tests through the real expansion
with only httpx scripted, since a stubbed expander cannot catch the above.
Signed-off-by: Enes Yilmaz <enesyilmaz5157@gmail.com>
* docs(cli): drop issue-number refs from Azure canonical-host comments
The repo's comment convention says code comments should describe the
scenario, not reference issue/PR numbers. Remove the (#2781) tags from
the _canonical_azure_databricks_url / _resolve_server_url docstrings and
the vanity-URL fallback test; the surrounding prose already explains the
Azure vanity-host case without needing the external link.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pat.sukprasert@databricks.com>
---------
Signed-off-by: Enes Yilmaz <enesyilmaz5157@gmail.com>
Signed-off-by: Pat Sukprasert <pat.sukprasert@databricks.com>
Co-authored-by: Pat Sukprasert <pat.sukprasert@databricks.com>
* fix(runner): resolve and re-materialize file attachments on remote-runner history reload
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
* fix(runner): seed the native-session compaction anchor; tolerate malformed file metadata
Native-harness sessions skip the history reload entirely, which also
skipped seeding the last server item ID that harness compaction
persistence anchors on — compactions then silently stopped persisting.
Session create now fetches just the newest item ID (newest-first, single
item, no attachment downloads) for native harnesses.
A 200 metadata response with an unparseable body no longer aborts
attachment resolution: both resolvers (the runner's message-content
resolver and the claude-native transcript rebuild) fall back to the
content response's Content-Type for the media-type hint.
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
* refactor(attachments): centralize file_id resolution and reference-line emission in native_attachments
The transcript rebuild and the runner each carried a full copy of the
file_id fetch-and-inline pipeline, and nine native executors repeated
the same materialize-or-marker block. Both now live in
native_attachments: resolve_file_id_block() serves the runner and the
transcript rebuild, attachment_reference_line() serves the executors,
and ATTACHMENT_MARKER_STRIP_PATTERN replaces four hand-copied forwarder
regexes. Materialized filenames are sanitized the same way as marker
names so a bracketed filename cannot break the marker consumers, and
the resume dedupe short-circuits on file size before reading bytes.
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
* fix(attachments): replay resolved history attachments as structured content
Cold-started claude-sdk sessions flattened prior turns into a text
prefix, so a resolved historical image reached the model as the marker
[image: name, media_type, N base64 chars]. The bytes never arrived, which
leaves the #882 symptom in place for that harness: the model describes an
attachment it cannot see.
Prior-turn attachments now replay as real Anthropic image/document blocks
via the existing converter, interleaved in transcript order. Text-only
history still takes the plain-string path and renders byte-identically,
unresolved attachments keep their existing marker, and base64 still never
enters prompt text.
Materialization also derives its collision suffix from a content hash
rather than a random one, so a history carrying two distinct uploads of
the same filename keeps one file per payload instead of gaining a copy on
every transcript rebuild.
The two tests that asserted the compact-placeholder shape are replaced by
cold-reload tests: that shape is the behavior being corrected, but the
invariant those tests protected (no base64 in prompt text) is asserted
against the prompt's text blocks.
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
* refactor(attachments): collapse duplicated prompt-shape branches
The structured and plain-text arms of _build_prompt returned the same
value whenever the latest message was multimodal, and re-scanned the
block list to decide which arm to take. Coalescing already leaves an
all-text history as one block, so the block count answers that.
Materialization's second identity check was a no-op guarding a write
that produces the same bytes, so the collision path flattens to one
branch.
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
* refactor(tests): keep runner conftest identical to upstream
Move the file-server fake's items/failure/malformed-meta behaviors out of
the shared _FakeFileServerClient into local subclasses in the one file
that uses them, so conftest.py stays in sync with upstream and per-test
modes stay next to their tests.
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
---------
Signed-off-by: Sunny Yang <sunnyadn1130@gmail.com>
Co-authored-by: Pat Sukprasert <pattara.sk127@gmail.com>
The before-quit handler defers the quit until serverManager.shutdown()
finishes, then re-issues app.quit() as the *only* way the quit ever
proceeds. Re-issuing app.quit() after before-quit's preventDefault() is a
known intermittently-unreliable Electron behavior (electron/electron#4994,
#33643, #39094); when it no-ops, or shutdown hangs (a stuck
'omnigent server stop'), the app stays up with its window still open —
matching 'sometimes the app is still running and refuses to quit'.
- Hard safety cap: app.exit(0) after quitCleanupTimeoutMs (unref'd) if
graceful cleanup + the re-issued quit haven't terminated. Normal cleanup
(<6s) completes well under the 10s cap; it only trips when stuck.
- Evaluate resolvedCliPath() inside an async IIFE so a future throw becomes
a rejection caught by .catch, never stranding the quit.
- Install fallback: when quitAndInstallIfPending() returns true but
quitAndInstall() doesn't actually quit (staged update gone), a short
app.exit(0) fallback still quits.
- unref() the periodic update-check setInterval so it can't keep the event
loop alive at quit.
Adds two regression tests (install-fallback and cleanup-cap) via an
injectable setQuitTimeouts; harness exposes setTimeout/clearTimeout/app.exit.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
The codex-native launch read the spec model only from
executor.config["model"], a key the single-file agent loader never
populates, so a custom agent's declared model: was silently replaced by
the provider default. Read the canonical executor.model first — the same
field the in-process harness and the claude/cursor native launches
consume — and keep config["model"] as a fallback for bundle specs that
pin the model inside the harness config block.
Co-authored-by: Isaac
* fix(loader): reject the bundle type:/config: nesting in single-file executor blocks
A single-file agent YAML written with the bundle config.yaml shape
(executor: {type: omnigent, config: {harness: ...}}) loaded without
complaint: the unknown keys were silently dropped, the declared harness
with them, and a different harness was inferred from the model prefix —
databricks-gpt-* landing on openai-agents instead of the declared
codex-native, with no diagnostics. Reject exactly type:/config: with an
error that shows the flat spelling. Other extra executor keys
(use_responses, extra, ...) keep loading — the compat loader reads them
from the raw YAML.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
* test: spell e2e fixture executors flat instead of the bundle config: nesting
Six runtime-generated single-file agent YAMLs in the e2e/e2e_ui/server
fixtures nested the harness under executor.config — the exact trap the
loader now rejects. They only worked because the dropped harness was
re-inferred from the gpt-* model prefix as the same openai-agents value.
Spell them flat so the declared harness actually flows. The two
spec_version bundle specs (approval agent, elicitation supervisor) keep
the nesting — config.harness is the correct spelling on the strict
parser path.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
---------
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
The background server spawned by bare `omni` (`_spawn_local_server`)
launched `omnigent.cli server` without `--config`, so the server's
loader returned an empty config and never read `~/.omnigent/config.yaml`.
Its `llm:` (and `policies:`) block was invisible to the detached server,
so self-hosted smart routing silently stayed off (`sys_advise_models` ->
`router_on: false`; `/v1/info` -> `smart_routing_enabled: false`).
Forward `--config <global_config_path()>` when the file exists. Same bug
class as #2386/#2763 (Docker entrypoint dropped `policies:`); this is the
local-spawn instance.
Co-authored-by: Isaac
Signed-off-by: Pranav Setlur <psetlur@gmail.com>
PR #3148 extracted _session_labels_for_runner_spawn into
omnigent.runner.native.orchestration, but _SESSION_STREAM_HEARTBEAT_S
and the stream loop that reads it remained in omnigent.runner.app.
test_session_stream_emits_heartbeat_on_idle located the module to patch
via _session_labels_for_runner_spawn.__module__, which now resolves to
omnigent.runner.native.orchestration — a module that has no
_SESSION_STREAM_HEARTBEAT_S attribute — so the test raised
AttributeError and failed CI on main.
Patch omnigent.runner.app directly, which is where the heartbeat cadence
constant and its consumer actually live.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
When the launching process sets CLAUDE_CODE_USE_GATEWAY=1, that
gateway-aware mode keeps tool search enabled so MCP schemas load on
demand. Setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS alongside it
would override that mode, disabling all betas and inflating startup
token usage.
Only set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS when gateway-aware
mode was NOT selected.
Ported from databricks-eng/universe#2298829.
Co-authored-by: harry-yao_data <harry.yao@databricks.com>
Introduce no-op extension points on the conversation store so a subclass
can transform conversation_items.data and control search_text, without
changing OSS behavior:
- _encode_item_data(data_json): identity by default; append's data write is
routed through it so a subclass may compress or encrypt the payload.
- _decode_item_data_batch(stored_list): identity by default; the read paths
(list_items, list_latest_message_items_for_conversations, the FTS-ranked
read) decode a whole page of rows through it before building entities, and
_to_item now takes the already-decoded data. Making the read seam a batch
(not a per-row hook) lets a subclass decode a page in one pass — e.g. a
single bulk decrypt — instead of once per row.
- _item_search_text(item): extracts the search text as before by default;
may return None to skip persisting search_text (and its FTS row) on a
schema that omits the column.
Every default preserves current behavior exactly: the column stays plaintext
Text, and search/FTS are unchanged. This lets a downstream store (Databricks'
MySQL-homed conversation store) envelope-encrypt item payloads at the column
boundary while reusing append/list_items unchanged.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* docs(deploy): correct docker admin bootstrap flow (no auto-generated password)
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
* docs(deploy): correct remaining generated-password and /data-persistence claims
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
* docs(deploy): scrub generated-password flow from remaining platform guides
The Docker docs were corrected earlier, but fly / railway / render / modal /
hf-spaces still told operators to read a generated admin password out of the
logs / /data/admin-credentials — a flow that no longer exists (bootstrap never
auto-generates a password; the first admin is claimed via the web Create-admin
form or a pre-seeded OMNIGENT_ACCOUNTS_INIT_ADMIN_PASSWORD).
- Rewrite the first-admin step in each guide to the real flow, and drop the
fake "Created initial admin ... password: <generated>" log block.
- Add a first-visitor security note (unauthenticated /auth/setup while no
password-bearing account exists) to every public-facing guide; fold it into
hf-spaces' "make the Space Public" step where the exposure is most direct.
- render: correct the disk bullet (hashes live in Postgres, not on /data) and
the render.yaml comment that called the anchor path a password file.
Co-authored-by: Isaac <isaac@example.com>
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
Co-authored-by: Pat Sukprasert <pattara.sk127@gmail.com>
Co-authored-by: Isaac <isaac@example.com>
* feat(cli): add `omnigent session import` (inverse of session export)
`session export` writes a portable JSONL but there was no way to load it
back — inspecting a shared/exported session meant hand-writing items into
the store. Add `session import` to close the round-trip: it reads the
session_meta + item lines and recreates the conversation on the target
server as a new session (fresh id each time) via POST /v1/sessions with
the history passed as initial_items.
Details:
- De-aliases the `model` serialization alias back to `agent` per item and
validates each with parse_item_data() client-side before the request.
- Agent binding: reuse the exported agent_id when it exists on the target
server; else fall back to the built-in native agent for the export's
harness (mirrors /v1/imports); else fail with a clear message.
- Creates history-only (host_type=external, no host_id) so no runner
launches. Carries over title/workspace/harness/model/effort overrides.
Known limitation (documented in --help): the server seeds initial_items
under a single synthetic response_id, so exact per-turn grouping is not
preserved. Fine for viewing/debugging; a follow-up server route could
preserve it if needed.
Verified end-to-end: imported the real 260-item export, re-exported, and
diffed — identical item counts and types, agent bound, model<->agent
alias round-trips.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(cli): scope agent→model de-alias to alias-bearing item types
Polly review caught that the import de-alias applied `model`→`agent` to
every item type, corrupting the two types where `model` is a genuine
field: `compaction.model` (silently dropped) and `routing_decision.model`
(required + collides with its own `agent` field → hard import failure for
any smart-routed session).
Derive the alias-bearing types from the data-model field definitions
(serialization_alias == "model") so the reverse map only fires for
message/function_call/reasoning/slash_command and can't drift. Add
regression tests for compaction and routing_decision.
Also address non-blocking review notes:
- Wrap non-404 create errors in a clean ClickException instead of a raw
httpx traceback.
- Document created_by re-attribution in --help alongside the response_id
caveat.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
The hermes-native forwarder's messages SELECT omitted the reasoning
columns Hermes persists, so thinking shown in the TUI never reached the
web conversation. Read reasoning_content/reasoning and emit a one-shot
external_output_reasoning_delta before the assistant message (started=True),
matching the codex- and opencode-native transient reasoning contract. The
structured codex_reasoning_items column is left alone.
Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
The codex harness wrap read only HARNESS_CODEX_CWD, so when the spawn env
omits that var the executor fell through to os.getcwd(). Seven sibling
harnesses (acp, claude-sdk, goose, hermes, kimi, pi, qwen) already fall
back to OMNIGENT_RUNNER_WORKSPACE first.
tests/runtime/test_spawn_env_cwd.py::test_builder_omits_cwd_when_none
documents that the builder omits the CWD var precisely so the harness can
apply its own OMNIGENT_RUNNER_WORKSPACE fallback. codex is in that test's
builder list but never held up the harness half of the contract.
Every current caller threads a cwd, so this changes no observed behavior
today. It closes the contract gap and covers a caller that omits it.
Signed-off-by: Enes Yilmaz <enesyilmaz5157@gmail.com>
* ✨ feat(cli): add `omni usage` cost report
Summarize LLM spend across a user's sessions: rolling 24h / 7d / 30d
cost totals plus a per-session breakdown of model and cost.
- server: `GET /v1/usage` aggregates each top-level session's subtree
usage (via `load_session_usage`), scoped to the caller, bucketing
cost by last-activity time; normalizes the primary model per session.
- cli: `omni usage` (`--limit`, `--server`, `--json`) renders the
report through the shared `omnigent.inner.ui` palette.
Co-authored-by: Isaac
Signed-off-by: Jakub Majorek <majorek.jakub@gmail.com>
* ✨ feat(usage): address review — separate router, per-model breakdown, daily-rollup windows
Addresses the four review comments on the `omni usage` cost report:
1. Move the report to its own user-scoped router (omnigent/server/routes/
usage.py) instead of the session-scoped sessions router.
2. Rename the schema UsageSession -> SessionUsage.
3. Show a per-model cost breakdown per session, mirroring the web session
sidebar: authoritative session total on the id line, each model's
recorded cost beneath (shown faithfully, not forced to sum). Single-model
sessions stay on one line.
4. Source the cost summary (Today / Last 7 days / Last 30 days / All time)
from the per-user daily-cost rollup (user_daily_cost) via a new
sum_daily_cost range read, so windows reflect when spend occurred rather
than a session's last-activity time. Labels relabeled to calendar-day
truthful wording.
Regenerates openapi.json; updates unit + e2e tests.
Co-authored-by: Isaac
Signed-off-by: Jakub Majorek <majorek.jakub@gmail.com>
---------
Signed-off-by: Jakub Majorek <majorek.jakub@gmail.com>
* test(ui-snapshot): add sidebar pinned-project flyout baseline
The populated-sidebar baseline covers every sidebar row type but not the
hover flyout that surfaces a pinned session's originating project — the
card is portalled and only mounts on hover, so a restyle of it (recently
aligned to a compact HoverCard: clamped title + folder icon + project
name) sails through that gate.
Add a visual test that hovers a pinned, project-owned row and captures
`PinnedProjectFlyoutContent`. Mirrors the populated-sidebar fixture's
determinism (pinned clock, silenced updates socket, seeded localStorage);
the flyout's 150ms openDelay fires under set_fixed_time since only Date.now
is pinned, so a plain hover opens it.
Baseline PNG intentionally omitted — generated in CI's pinned image via the
`update-ui-snapshot` label so it matches the gate byte-for-byte.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): regenerate visual baselines
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Co-authored-by: omnigent-ci[bot] <294685417+omnigent-ci[bot]@users.noreply.github.com>
The ChatGPT desktop app writes model_reasoning_effort = "ultra" into
~/.codex/config.toml; the codex CLI forwards it as the retired "max"
wire value, which the OpenAI Responses API rejects with
invalid_value: 'max' (its ladder tops out at xhigh). Because the codex
harness copies the user config verbatim into every per-session
CODEX_HOME, every codex turn fails on such machines — including debby's
gpt sub-agents.
Two-part fix:
- validate_effort() coerces a deprecated alias (ultra/max -> xhigh) when
the raw value is unsupported but the canonical one is. Providers that
genuinely support max (Anthropic) are unaffected. This also stops the
server rejecting external_reasoning_effort_change events from
ChatGPT-app-configured codex terminals that report effort ultra.
- _populate_codex_home_config() normalizes a deprecated top-level
model_reasoning_effort in the session's private config.toml copy;
keys inside tables and supported values are left untouched, and the
user's real ~/.codex/config.toml is never modified.
_normalize_copied_codex_effort() now tracks array bracket depth so a
top-level multiline array's continuation lines (which can themselves
start with "[") are never mistaken for a table header — otherwise a
still-top-level model_reasoning_effort key after such an array would be
skipped. Also updates the two reasoning-effort-validation tests that
asserted "max" was rejected outright: since max/ultra now coerce to
xhigh for codex and the OpenAI Agents SDK, those tests now assert the
coercion instead.
Fixes#2696
Signed-off-by: Bryan Chua <me@bryanchua.com>
* fix(runtime): strip base64 image data from stored history on replay
The native-ingest strip only helps images read *after* that fix landed.
Sessions already in the conversation store still hold full base64 images
in their function_call_output items, so they keep overflowing the context
window on resume — replaying the stored output as prompt text wedges
compaction (loads over-window history to summarize, fails "prompt is too
long", writes no boundary, re-overflows).
Strip inline base64 image blocks at the replay boundary in
history_to_input_items, where every harness's stored history is converted
to LLM input. This fixes already-stored large-image sessions without a
store migration. A base64 image tool result (JSON list of
{"type":"image","source":{"type":"base64",...}} blocks) is rewritten to a
"[<media> image omitted from history …]" placeholder that points back at
the originating tool call so the image stays recoverable on demand.
Plain-text and non-image JSON outputs (the common case) pass through
unchanged via a cheap guard before any JSON parse.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(runtime): strip base64 from truncated (invalid-JSON) image outputs
Testing against the real wedged session's export revealed the JSON-only
strip was a no-op on exactly the data that matters: stored image outputs
are clipped at the conversation-store 245760B cap, leaving the base64
string unterminated, so json.loads raises and the original (base64-laden)
output was returned unchanged.
Add a linear regex fallback that rewrites an image source block in place
when the output is not parseable JSON. The pattern uses fixed optional
key groups and a base64-alphabet char class disjoint from the quote
terminator, so it cannot backtrack catastrophically against a
multi-hundred-KB payload (an earlier lazy-quantifier attempt hung).
Verified on the real 3440987444542977 export: all 4 truncated image
items strip, 982,448 -> 832 chars (99.92%), sub-ms. New test covers the
truncated/invalid-JSON shape.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(claude-native): strip truncated base64 images on cold resume
Native Claude Code resumes from its own local transcript, which the
wrapper rebuilds from Omnigent items before `claude --resume`. Intact
image tool results are intentionally rehydrated into real image blocks
(cheap ~1.5K tokens). But an output clipped at the conversation-store
byte cap holds corrupt/partial base64 that no longer parses: rehydration
fails, so the raw ~250K-char string was sent as tool_result text AND
stashed in toolUseResult — re-overflowing the resumed context and
wedging compaction (the exact native failure users hit).
Collapse only that truncated/unparseable-image case to a recoverable
placeholder before building the record, so both the tool_result content
and the toolUseResult metadata stay small. Intact images still resume as
images.
Verified on the real 3440987444542977 export: full transcript rebuild
drops from 1,549,700 to 563,994 chars with zero base64 leak, while a
valid image still rehydrates to an image block.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Merge caller-supplied headers threaded through connection_params so MAS
can route CP serving-endpoint calls through the Barnacle forward proxy
(host + s2s auth headers). Also log the upstream error body on 4xx/5xx
for both non-streaming and streaming requests, which raise_for_status()
otherwise omits — essential for debugging CP serving/gateway failures.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
The in-session config gear PR left comments that narrated the change
(a now-deleted IntelligentModelControl reference, "moved OUT of the picker
trigger", "no longer a standalone toggle", "old/pre-gear picker") and named
a "picker trigger"/"Agent picker" that no longer exists. Rewrite them to
describe current behavior — where the Smart Routing toggle, harness label,
and model/effort label live — per the repo's "describe the scenario, not
the change history" guidance.
Comment-only; no behavior change.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(databricks-adapter): use SDK Config for OAuth token refresh
Cache a databricks.sdk.config.Config per profile and call authenticate()
on every request so OAuth tokens are refreshed transparently instead of
expiring after ~1 hour. Falls back to resolve_databricks_workspace when
the SDK is unavailable.
This addresses the v1 limitation documented in credentials/databricks.py.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): hide per-turn Smart Routing toggle when Auto harness is selected
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(new-chat): hide Smart Routing checkbox in favour of Auto harness
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(auto-harness): propagate routing error to UI via routing card
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(smart-routing): route harness+model for child sessions via sys_session_send
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(smart-routing): force auto-harness for sub-agents when parent routing is on
When the parent session has smart routing enabled, a sub-agent created via
sys_session_send is now routed regardless of the harness/model the
orchestrator chose — the server forces the "auto" sentinel at child-session
create time, ignoring the tool call's agent/model args. The first-message
routing path then picks both harness and model.
Skips native-terminal wrapper labeling for forced-auto children so the
harness isn't prematurely fixed (routing may pick a non-native SDK harness);
the child takes the SDK routing path where auto-resolution runs.
Only applies to omnigent-executor agents (auto needs a swappable brain
harness); non-omnigent children keep the orchestrator's choice.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): persist cost_control=on for Auto sessions, hide composer routing toggle
- New-chat create body sends cost_control_mode_override="on" when harness=auto
so the persisted state matches the routing that always runs for auto sessions.
- Hide the per-turn composer routing icon entirely — it's superseded by the
Auto harness (routes at session start), and its "off" state was misleading.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): exclude databricks-claude-haiku-4-5 from pi routing candidates
pi routes Claude models through the Anthropic Messages gateway, whose request
path adds an eager_input_streaming field the Databricks serving endpoint
rejects with a 400 when tools are present. Filter the model out of pi's
candidate list in route_session_harness (both live-catalog and static paths)
so Claude work routes to claude-sdk instead. Keeps pi's GPT models.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): prevent double-routing on forced-auto child sessions
The auto-harness resolution block and the per-turn routing block both called
route_session_harness on a forced-auto child's first message (parent routing
on + harness_override="auto"), causing two judge calls, two routing cards, and
a possible harness/model mismatch between the two picks. Track whether the auto
block routed this turn and skip the per-turn block when it did. Also fixes the
failure-path card duplication (auto emits an applied=False card, then no longer
falls through to a second card).
Cleanup: except (ImportError, Exception) -> except Exception in the databricks
adapter (Exception already subsumes ImportError).
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(auto-harness): mirror routing card into parent session for sub-agents
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): map live-catalog worker names to harness ids for routing
The live runner catalog (fetch_runner_models) keys rows by worker name —
sub-agent names like "claude_code" plus "self" — not by harness id. So
route_session_harness found no matches for _AUTO_ROUTING_HARNESSES and
returned "No routable harnesses are available", especially for child
(sub-agent) sessions.
Normalize worker names to harness ids via _WORKER_NAME_TO_HARNESS
(claude_code -> claude-sdk, codex, pi), and fall back to the static
infer_models table when the live catalog yields no routable candidates
(e.g. a catalog with only an unrecognized "self" worker).
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(ci): remove dead _ROUTABLE_HARNESSES and effectiveHarness (noUnusedLocals)
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test: update child-session routing test for forced-auto (route_session_harness)
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test: remove dead Smart Routing dialog tests (superseded by Auto harness)
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): exclude gpt-5.5/5.6 reasoning models from pi routing
pi routes GPT models through the openai-completions (/chat/completions) path.
Databricks applies a default reasoning_effort for the gpt-5.5/5.6 reasoning
models there and rejects tool calls with "Function tools with reasoning_effort
are not supported for gpt-5.5 ... use /v1/responses or set reasoning_effort to
'none'." pi's provider can't send that override, so every tool turn 400s.
Exclude databricks-gpt-5-5, -5-5-pro, and the -5-6 family from pi's routing
candidates (same pattern as pi+claude-haiku). The gpt-5.4 family works on pi
and stays; codex serves gpt-5.5+ via the Responses API natively.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): redirect incompatible router verdicts off pi
Some external routers ignore the filtered candidate set we send and still
return an excluded (harness, model) pair — e.g. pi + gpt-5-5. Since we can't
stop the router choosing it, post-process the verdict: redirect a Claude model
on pi to claude-sdk and a gpt-5.5/5.6 reasoning model on pi to codex (which
serves them via the Responses API). The chosen model is preserved; only the
harness is corrected to one that can actually run it with tools.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* style: ruff format test_sessions_model_override
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): order codex before pi so GPT models default to codex
_AUTO_ROUTING_HARNESSES order is both the candidate-set insertion order and
the tiebreak when a model is served by multiple harnesses (the external
router's id-only fallback and our own model-ownership fallback both pick the
first harness owning the model). With pi before codex, a GPT model with no/
ambiguous harness resolved to pi — whose openai-completions path 400s on
gpt-5.5+ reasoning models with tools. Reorder to codex, pi so GPT defaults to
codex (Responses API, handles reasoning+tools).
Complements _redirect_incompatible_pick, which handles the separate case of a
router returning an explicit pi+gpt-5.5 pair despite our filtered candidates.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): stop filtering candidates; router requires full model set
The external task_v0 router enforces a required model set (e.g. must include
gpt-5-6-luna) and returns 400 "task_v0 requires [...] models" when any is
missing. Our _filter_excluded_models pruning stripped gpt-5.5/5.6 and Claude
models from pi's candidates, making the required set incomplete and 400-ing
every route call.
Send the full candidate set unfiltered and rely solely on
_redirect_incompatible_pick to correct an incompatible (harness, model)
verdict after the router responds. Removes the now-unused _filter_excluded_models.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): emit routing card after input.consumed so it renders
The auto-harness routing card (success and failure) was published to the live
SSE stream at resolution time — before the runner forward and before
input.consumed. The user-message bubble hadn't been delivered yet, so the
reducer dropped/misordered the card and it never appeared live (only on
reload). Defer the card emission to after input.consumed, matching the
per-turn routing path's ordering. Now the "router unavailable" failure card
shows in the UI.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): refresh external router OAuth token per call
ExternalRoutingClient captured its bearer once at server startup (from the
routing profile), so after ~1h the token expired and the router 401'd
("Credential was not sent or was of an unsupported type"), which surfaced as
"router returned no verdict". Pass the Databricks profile through and mint a
fresh bearer per route() call via the SDK Config (same OAuth-refresh pattern
as the DatabricksAdapter fix). An explicit api_key still uses a static bearer.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(auto-harness): surface the router's actual error in the failure card
The auto-harness failure card showed a generic "router returned no verdict".
ExternalRoutingClient swallowed the real reason (401, task_v0 required-model-set,
etc.) — only logging it. Record it on client.last_error and have
route_session_harness surface it, so the UI card reads e.g. "Routing
unavailable: router returned HTTP 401: Credential was not sent or was of an
unsupported type". _router_error_detail unwraps the gateway's nested JSON
error envelope to a clean message.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): route sub-agents against the parent's catalog
A sub-agent's own runner catalog is "self"-only (it's a leaf spec with no
sub-agents), so _WORKER_NAME_TO_HARNESS didn't recognize it and routing fell
back to the small static infer_models lists — a different, incomplete candidate
set than the top agent sees (which broke the external router's required-model
check, e.g. missing glm-5-2/gpt-5-6-luna).
Add catalog_session_id to route_session_harness and pass the parent session id
for sub-agent routing (parent + child share a runner). The parent's catalog
enumerates the full spawnable-worker map (claude_code/codex/pi with complete
model lists), so a sub-agent now routes against the same stable candidate set
as the orchestrator — regardless that we route both harness and model for it.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(routing): assert external client defers profile auth to per-call
_build_external_routing_client no longer resolves a Databricks profile
token at build time — the client mints a fresh bearer per request (OAuth
refresh) so it survives ~1h token expiry. Update the test to assert the
profile is threaded through (no eager resolve, no static _auth) instead
of the old build-time resolution contract.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(web): align sidebar session flyout and row padding
The session hover flyout and the sidebar rows were visually inconsistent
with the pinned-project flyout and project folder rows:
- The plain session tooltip used a wide card (w-72, bg-card-solid) while
the pinned-project flyout used a compact HoverCard look. Restyle the
tooltip to mirror it (w-64, bg-popover, clamped title, muted metadata).
- Both flyout titles used rem-based `text-sm`, which scaled with the UI
font-size setting and rendered larger than the fixed-px sidebar rows.
Size both to `sidebar-compact-text` so they match the row name exactly.
- Session rows used `w-[calc(100%+1rem)]`, bleeding ~8px past the right
edge so their highlight didn't align with the project/folder rows.
Switch to `w-full` and shift the trailing pin/kebab controls inward
(right-[30px] / right-1) so they stay inside the row edge.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): drop reserved scrollbar gutter so sidebar rows sit flush right
The sidebar scroll container reserved a stable scrollbar gutter
(`scrollbar-gutter: stable`), which on overlay-scrollbar platforms
(macOS) leaves ~15px of empty space on the right of every row. That made
rows look uncentered — 8px inset on the left vs. 8px + 15px on the right —
and misaligned the project-folder header actions with the session-row
controls. It's also why session rows previously used `w-[calc(100%+1rem)]`
to paint over the gutter (the workaround this series already removed).
Drop the reserved gutter so the right inset collapses to the same 8px
`px-2` as the left. On overlay scrollbars there's no layout shift; the
rows and folder-header actions now line up on both edges.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): match project-folder header controls to compact session kebab
The project-folder header pencil + kebab used `icon-sm` (size-7, 28px)
while the session-row kebab uses `icon-xs` (size-6, 24px). Both anchor at
`right-1` with a centered `size-3.5` glyph, so the 4px width difference
put their glyph centers in different columns — the folder ⋯ sat ~2px left
of the row ⋯ and read as misaligned.
Drop the folder-header controls to `icon-xs` so they share the compact
size (and glyph column) with the session-row kebab.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): match folder-header icon spacing to session row
The folder-header pencil + kebab sat in a gapless flex, while the session
row's pin↔kebab pair has a 2px (right-1 vs right-[30px]) gap. That put the
folder pencil 2px right of the session pin, so the leading-icon columns
didn't line up across row types.
Add `gap-0.5` to the folder-actions flex so the pencil lands in the same
column as the session pin; the kebabs already share the trailing column.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): shrink Projects group-header controls to compact icon
The "New project", "Expand all", and "Collapse to previous" controls in
the Projects group header were still `icon-sm` (size-7, 28px) while every
other right-gutter control — folder-row and session-row pin/kebab — is now
`icon-xs` (size-6, 24px). The larger buttons broke the shared icon column.
Drop all three to `icon-xs` so the whole sidebar right-gutter shares one
compact size.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* refactor(web): share one flex container for sidebar row trailing controls
The session row's pin + kebab were two separately absolute-positioned
buttons, so their spacing was hand-tuned per button and drifted from the
project-folder header actions at non-default font scales. Wrap both in a
single `absolute right-1 flex items-center gap-0.5` container — the same
pattern the folder header already uses — so the spacing is defined once
and stays aligned across every right-gutter control at any scale. Also add
the matching gap-0.5 to the Projects group-header controls.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): regenerate visual baselines
* fix(web): reserve scrollbar gutter symmetrically instead of removing it
Removing `scrollbar-gutter: stable` fixed the right-edge asymmetry on
macOS overlay scrollbars but reintroduced horizontal reflow on classic-
scrollbar platforms (Windows/Linux) when the scrollbar appears/disappears.
Use `stable both-edges` instead: the gutter is reserved symmetrically on
both sides, so rows stay centered against the left `px-2` inset and never
reflow — a no-op on overlay scrollbars, correct on classic ones.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): regenerate visual baselines
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Co-authored-by: omnigent-ci[bot] <294685417+omnigent-ci[bot]@users.noreply.github.com>
The Phase 0 section listed pre-split line counts and framed the cli.py and
sessions.py extractions as to-do, but both have shipped. Update it to reflect
actual state: correct the counts, mark cli.py (#3047) and sessions.py (#3097)
done, and leave runner/app.py and test_app_sessions_native.py as the two
remaining >10k files (which can proceed in parallel). Move chat.py to a
deferred bucket since it is already under the 10k target.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* test(runner-init): guard fork-history directives survive the reconnect envelope
Adds an integration test across the exact seam that regressed in #2793 and
was fixed in #3116: a forked claude-native session's fork directives
(carry-history, source-external-session) must survive from the store's
by-runner-id reconnect lookup into the session-init envelope the runner
reads to decide whether to clone/rebuild the vendor transcript.
Unlike the existing envelope tests (which hand-build an envelope with the
label already present) and the store unit test (which checks one method in
isolation), this drives the real store end to end — create a native source
with a captured external_session_id + workspace, fork it with
carry_history_into_native, bind it to a runner, then run
list_conversations_by_runner_id -> build_runner_session_init_payload ->
parse -> _claude_launch_metadata_from_envelope and assert the fork
directives land as launch metadata. It fails if any layer on that path
stops carrying labels (verified: reverting #3116's hydration makes it fail
with an empty label set).
Runs in CI (no vendor Claude login), unlike the opt-in
tests/e2e/test_host_claude_native_fork_e2e.py that would otherwise be the
only coverage of this path — which is why the original regression slipped
through.
Co-authored-by: Isaac
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* fix: repair test docstring indentation broken by suggested edit
A GitHub-suggested "Potential fix for pull request finding" commit
(b48c50b3) rewrote the test docstring flush-left, leaving the function
with no indented body -> IndentationError, which failed ruff-format,
ruff-check, and pytest collection (server-rest).
Restore a properly-indented docstring and switch the em-dashes/arrows in
comments to ASCII so the file is unambiguously parseable everywhere. Test
behavior is unchanged: still passes with #3116's label hydration and fails
without it (verified by reverting the fix).
Co-authored-by: Isaac
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* refactor(server): split sessions route into facade + impl package
The sessions route had grown to ~15k lines in a single file, well past
the 10k-line ceiling we want for maintainability and ahead of the
native-harness pluggability work that will touch this module heavily.
Split it into a facade over an implementation package:
- sessions.py (7.7k) stays the public entry point, keeps
create_sessions_router, and re-exports the impl modules via `import *`.
- _sessions/common.py, helpers.py, orchestration.py hold the
implementation, layered common -> helpers -> orchestration, each
star-importing the ones below it.
No behavior change. Symbols that tests patch on the facade are exposed
through call-time proxies that delegate back to the facade, so a
`monkeypatch.setattr(sessions_mod, ...)` is honored no matter which impl
module resolves the name. F403/F405 are waived for these files in
pyproject since star re-export is the point of the facade.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* fix(sessions): honor facade monkeypatch across _sessions impl modules
The facade/_sessions split re-exports symbols via `import *`, so each impl
module holds its own binding of every name. A test's
`monkeypatch.setattr(sessions, "_kick_managed_wake", ...)` rebound only the
facade attribute; sibling impl callers kept their stale star-import binding and
ran the real path, breaking managed-wake and compact single-flight tests.
Route the patched symbols (`_kick_managed_wake`, `_compact_lock`) through
call-time facade proxies with the real body renamed `*_impl`, and add explicit
facade override imports so the patch is honored no matter which module resolves
the name.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* refactor(sessions): route impl-module get_agent_cache/session_stream through facade proxy
Drop the function-local `from omnigent.runtime import get_agent_cache`
and `from omnigent.runtime import session_stream` imports in the impl
modules. Those locals shadowed the module-level facade-delegating
proxies (bound via the `# noqa: F401` import block from
`_sessions.common`), so a `monkeypatch.setattr` on the facade was not
honored at those call sites.
Removing the shadowing imports lets the already-bound module-level
proxies resolve the names, keeping facade patches effective while
behaving identically when unpatched (the proxy forwards to the real
runtime symbol). Addresses Copilot review on the sessions split.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* fix(sessions): repair cross-module seams from the facade split
The _sessions split moved code behind an explicit __all__ per impl module
and a star-import facade, which introduced three latent seams:
- _validated_harness_override_executor_type was omitted from
helpers.__all__, so the harness_override == "auto" gate in
orchestration (which sees it only via star-import) hit NameError at
session creation. Add it to __all__.
- _query_host_runner_status read _HOST_RUNNER_STATUS_TIMEOUT_S off its
own star-import binding, so a facade-level monkeypatch was dropped.
Read the constant off the facade module instead; strengthen the
timeout test to assert the wait actually bails early.
- _wait_for_managed_runner_tunnel and _run_managed_wake read
_HOST_RELAUNCH_RUNNER_CONNECT_TIMEOUT_S bare; qualify both through the
facade for the same reason.
Add test_sessions_facade_exports.py to pin these re-export seams so a
dropped __all__ entry or un-re-exported constant fails at import time.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* fix(sessions): restore call-time get_agent_cache import in resolvers
The split dropped the call-time `from omnigent.runtime import
get_agent_cache` local import from the four harness/model resolver
functions. Without it the name resolved to the module-level facade
proxy, which forwards to a snapshot binding taken at import time, so a
test patching `omnigent.runtime.get_agent_cache` was no longer honored
and the call hit the real uninitialized runtime.
Restore the local import in _resolve_llm_model, _resolve_harness_impl,
_validated_harness_override, and _validated_harness_override_executor_type
to match pre-split behavior.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* feat(web): in-session composer config gear modal
Bring the new-session gear-config affordance (#3050) into the in-session
composer. A gear icon left of the send button shows the session's live
run-config on hover and opens a config modal on click, consolidating the
mid-session switchable knobs — Model, Effort, and Smart Routing — behind one
control. Permission/approval/cursor modes stay launch-time only and are
intentionally absent.
What changed:
- New ComposerConfigGear + SessionConfigModal: draft Model/Effort/Smart Routing
and apply on Save (Cancel discards), mirroring HarnessConfigModal. Save
commits SEQUENTIALLY (awaiting each PATCH) because claude-native applies
model/effort by typing separate /model and /effort slash commands into its
terminal — firing them concurrently interleaves the injections into one bad
line. Unchanged knobs are skipped.
- The <Model> <Effort> control is now a read-only status label, not a dropdown
(the gear owns config); bare /model opens the modal. The label reads "Smart
Routing" when routing is on, and falls back to the harness identity
("Polly (Pi)") for SDK/bundle agents that surface no model/effort.
- Harness identity moved out of the status-line tray into the gear tooltip.
- The gear is soft-disabled (aria-disabled + click guard, tooltip preserved)
when the session isn't live, since a config PATCH can't wake a sleeping
runner and those states never load the model catalog.
- Extracted ConfigRow / DescribedSelect / MODEL_SELECT_* sentinels from
NewChatDialog into web/src/components/HarnessConfigControls.tsx for reuse.
- Removed the standalone IntelligentModelControl and its per-turn verdict chip;
Smart Routing now folds into the Claude Model dropdown (a Switch for other
routable agents).
Smart Routing eligibility is unchanged (same isCostRoutingSession gate the
prior control used); a KNOWN GAP note documents that the in-session gate is
stricter than the new-session dialog's routable-harness rule, to be aligned in
a follow-up.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): restore host/context tray + fold Smart Routing into Codex model dropdown
Two follow-up fixes on the in-session composer gear modal:
- Restore the composer status-line tray (host badge + context ring) for
host-bound sessions that have no worktree branch and no context ring yet
(e.g. codex). Removing the harness label from the tray also dropped it from
the render guard, which had been the de-facto "always render for a bound
session" trigger — so the whole shelf vanished. Gate on a `showHostBadge`
(host-bound + non-sub-agent) signal instead. Fixes the failing
test_host_badge / test_hosts_changed_push e2e specs.
- Fold Smart Routing into the Model dropdown for ANY agent that has one
(Claude and Codex), not just Claude. Previously Codex got both a standalone
Smart Routing switch AND a Model dropdown whose selected value could become
the routing sentinel with no matching option (empty trigger). The rule is now
"has a Model dropdown" (showModels): fold in when it does, standalone Switch
only for routable agents without one (e.g. Polly).
Both covered by regression tests (host-bound tray renders with no branch/ring;
Codex folds routing into its dropdown with no standalone switch). Verified the
previously-failing host-badge e2e specs and the gear-modal e2e specs pass
locally.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(ui-snapshot): update visual baselines for composer gear modal
The composer now shows a read-only model/effort label + config gear (and
the harness label moved into the gear tooltip), which changes the chat
conversation render. Regenerate the three drifting visual baselines from
the PR's CI-rendered artifact (byte-identical to the pinned Playwright
image the UI Snapshot gate compares against) so the gate passes.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* refactor(web): drop orphaned IntelligentModelControl + verdict exports
This PR relocated the standalone Smart Routing control into the composer
gear modal and removed its only app-code usage, leaving
IntelligentModelControl, parseCostRoutingVerdict, CostRoutingVerdict,
verdictRelativeTime, ModelTierPill, and COST_CONTROL_PLAN_LABEL with no
remaining consumers (only their own tests). Delete them and their tests.
Keep the still-used exports: isCostRoutingSession (ChatPage eligibility
gate), CostControlMode (NewChatDialog), and shortModelName (StatusBlocks
+ SmartRoutingCard). Fix the stale {@link ModelTierPill} JSDoc reference
in SmartRoutingCard.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(ui-snapshot): exercise the composer config gear in the chat baseline
The chat visual-snapshot fixture served a bare session (no omnigent.wrapper
label, no model_options), so modelPickerKind was null and the composer's
config gear + read-only model/effort label never rendered — the baseline
couldn't guard them. Patch the mocked session into a claude-native wrapper
(labels + harness + llm_model + model_options, mirroring the model-picker
e2e), and wait for the gear + model/effort label before capture, so the
baseline now covers the new composer surface.
The committed [linux] baseline PNG is regenerated separately from the CI
render (no Docker locally); verified on a throwaway [darwin] render that the
gear + "Sonnet 5" label now appear.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(ui-snapshot): regenerate chat baseline capturing the composer gear
Adopt the CI-rendered [linux] baseline (byte-identical to the pinned
Playwright image the gate compares against) now that the fixture renders
a claude-native session: the composer shows the config gear + "Sonnet 5"
model/effort label.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): don't re-pin a leaked sticky on routing-off; use effort sentinel
Two non-blocking review notes:
- Routing-off on a no-dropdown routable agent (e.g. Polly) entered the
model-commit branch and could setModel(resolvedModelId) where
resolvedModelId resolves the leftover cross-session sticky
(sessionModelOverride ?? selectedModel) — pinning a model the user never
chose. Gate the routing-off re-pin on showModels: only agents with a Model
dropdown re-pin; no-dropdown agents clear via setModel(null).
- The Effort select reused MODEL_SELECT_DEFAULT as its "none" sentinel;
switch to the purpose-built EFFORT_SELECT_NONE for consistency with the
new-session dialog.
Adds a regression test proving a leaked "gpt-5.5" sticky is not pinned when
turning routing off on an SDK/bundle agent.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(claude-native): strip base64 image data from tool-result history
Reading an image file via Claude Code's Read tool returns the image as
a list of {"type":"image","source":{"type":"base64",...}} blocks. The
transcript mirror serialized that content verbatim into the stored
function_call_output, so a single image cost ~245KB (~70K+ tokens) of
literal text. On resume the native harness replays these items as prompt
text, and a handful of image reads overflows even a 1M context window —
which then wedges compaction (it must load the same over-window history
to summarize, fails with "prompt is too long", writes no compaction
boundary, and re-overflows on the next resume). The base64 is useless to
the model as text anyway.
Strip inline base64 image blocks to a "[image omitted from history]"
placeholder before serializing the tool-result output. Observed on a
real wedged session: 245,080 -> 55 chars per image (99.98% reduction),
eliminating the ~281K-token replay overrun.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(claude-native): make stripped-image placeholder recoverable
The base64-strip placeholder was a dead "[image omitted from history]"
marker. Since a stripped image always comes from a tool call (e.g. Read
of a file path) that is preserved intact right before the output, the
agent can view the image again by re-running that call. Name the media
type and say so in the placeholder, so the image is recoverable on
demand rather than appearing silently lost.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Non-streaming chat_response_to_response stored message.content raw, so
for Claude via Databricks (and Kimi, etc.) — which return content as a
list of typed blocks — OutputText.text became a list instead of a str.
This broke prompt_policy (fail-closed DENY on .strip() of a list) and
any non-streaming consumer of databricks-claude-* models.
Reuse the existing _extract_delta_content helper (already used by the
streaming path) to flatten list-of-blocks content into a string; it
returns the plain string unchanged for existing providers.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Forked claude-native (and other native) sessions launched the vendor
TUI with no prior conversation history, even though the fork copied the
history into the store (the web UI showed it). The runner never received
the fork directives that drive transcript seeding.
Root cause: list_conversations_by_runner_id built its Conversation
entities without fetching labels, so they carried labels={}. The runner
reconnect path (_on_runner_connect) sources conversations from this
lookup and builds the session-init envelope from conversation.labels;
with an empty label set the fork directives (omnigent.fork.carry_history,
omnigent.fork.source_external_session_id) were dropped in transit. The
init-envelope initializer then caches and shares that label-less envelope
with the first-turn path, so even the label-hydrated get_conversation
result was never used for the envelope. The runner saw no fork labels,
skipped the clone/rebuild branches, and launched the TUI fresh.
This dropped labels for every consumer of the reconnect path, not just
claude-native forks — any label-driven behavior on reconnect (codex / pi
/ qwen fork history, presentation ui/wrapper labels) was equally
affected and is fixed by the same hydration.
Fix: fetch labels via the existing batched _fetch_labels_bulk inside the
same _conv_session and thread them into _to_conversation. One extra
query, no N+1, correct under the split-DB topology (labels live in the
conversation DB).
Co-authored-by: Isaac
`create_conversation` already accepts an optional `conversation_id` (falling back
to `generate_conversation_id()` when omitted). This extends the same capability to
the other two session-creating methods via protected `_..._with_id` seams:
- `create_session_with_agent(...)` -> `_create_session_with_agent_with_id(conversation_id, ...)`
- `fork_conversation(...)` -> `_fork_conversation_with_id(conversation_id, ...)`
The public methods stay unchanged thin wrappers that pass `generate_conversation_id()`,
and the `ConversationStore` ABC is untouched, so this is a behavior-preserving refactor
for all existing callers. It lets a subclass mint the id externally and inject it as the
row id (e.g. a store that keys conversations by an identity-service node id) — which
`create_conversation` already permits but these two methods did not.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* docs(projects): mark the benchmark TODO done (#3094)
The list_projects / list_project_sessions journeys, project corpus seeding, and
the dev/benchmarks PR-benchmark trigger all landed in #3094. Update the PRD
status so the roadmap points at Phase 2 (project defaults) as the next item.
Co-authored-by: Isaac
* feat(projects): add a config column for project-level session defaults (Phase 2)
Phase 2 (P4a) of the projects feature — the backend half. Gives a project a
place to store default session settings (host, workspace, harness, model,
reasoning effort, git base-branch, …) so a new session created in the project
can pre-fill them, replacing the inference-based prefill (#2133) in a follow-up.
- Migration b3c4d5e6f7a8: add a nullable `config` TEXT column to `projects`
(additive; clean downgrade). NULL = no stored defaults.
- The column is an OPAQUE JSON object: the backend persists it whole and never
filters on it, so the key vocabulary is owned by the client (the new-chat
dialog) and can grow without a schema change. Values are hints, not enforced.
- Plumb config through the stack: SqlProject model, Project entity (decoded
dict, empty when unset), ProjectStore.create/update (encode/decode helpers
mirroring session_overrides), and the /v1/projects schemas + routes.
- update() semantics: config=None leaves it unchanged; config={} clears it —
distinct, so a rename never wipes stored defaults.
- Tests: store round-trip + None-vs-{} update semantics, route create/get/patch
round-trip, entity default_factory isolation, migration up/down verified.
- Regenerated openapi.json (config on ProjectObject/Create/Update).
- PRD: mark the backend config column done; the dialog wiring and #2133
retirement remain as follow-up sub-items of Phase 2.
Co-authored-by: Isaac
## Related issue
N/A
## Summary
- Adds `omnidev omnigent <args…>`, which forwards any omnigent command to
`uv run omnigent …` with the current checkout's pod env applied
(`OMNIGENT_DATA_DIR`, `OMNIGENT_DATABASE_URI`, `OMNIGENT_CONFIG_HOME`,
`OMNIGENT_URL`), so a CLI command talks to the same pod the supervisor runs
and coexists with a running supervisor (no lock acquired).
- Resolves the repo root → pod dir (same as the supervisor), ensures the pod
tree, and reads persisted ports so `OMNIGENT_URL` targets a live server. Runs
in the foreground inheriting stdio and exits with omnigent's status code;
omits the supervisor's log-mirror env so omnigent's own TTY detection wins.
- The `omnigent` subcommand is a named gate with `trailing_var_arg` +
`allow_hyphen_values`, so the existing install subcommands
(`install`/`update`/`check`/`refresh`/`shell-hook`) keep their top-level
surface and clap's typo-suggestion guardrail. New `src/omnigent_cmd.rs` holds
the pure `build` + `run` split for testability.
## Test Plan
- `cargo build` and `cargo clippy` clean (no warnings).
- `cargo test` — 60 tests pass (36 unit + 7 install-mgmt + 17 pod-setup),
including 4 new `omnigent_cmd` unit tests: args forwarded after
`uv run omnigent`, empty passthrough, pod-isolation env applied, and
log-mirror env omitted.
- `omnidev --help` shows the flat subcommand surface; `omnidev omnigent …`
outside a checkout fails at repo-root discovery (not at clap); `omnidev
isntall` still suggests `install`.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [x] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Manual verification: confirmed `--help` renders the new `omnigent` subcommand,
the passthrough routes outside a checkout (repo-root error, not a clap error),
and the typo guardrail survives (`omnidev isntall` suggests `install`).
## Changelog
`omnidev omnigent <args…>` runs an omnigent command against the current checkout's pod via `uv run omnigent`, with the pod's isolated env applied
## Related issue
N/A
## Summary
- A bare `omnigent server --host 0.0.0.0` used to stay in header mode and fail-close (401 on every request) with no warning and no path forward, because an end user has no realistic way to inject an identity header. The existing first-admin terminal prompt also never fired, since it no-ops when `account_store is None` (header mode).
- Now a non-loopback bind with no explicit auth config auto-enables accounts (login) mode, mirroring the Docker/Cloudflare/k8s entrypoints. The server boots and serves; first-admin setup happens via the web Create-admin form. A stderr warning is emitted at startup naming the host and the mode change.
- Removed the `_maybe_prompt_first_admin` TUI prompt path entirely — the server should just be a server, and the web Create-admin form (which is fully self-sufficient) is now the only interactive setup route. Explicit operator choices (`OMNIGENT_AUTH_PROVIDER`, `OMNIGENT_AUTH_ENABLED`, deprecated `OMNIGENT_ACCOUNTS_ENABLED`) always win; the loopback default is unchanged.
## Test Plan
- `uv run python -m pytest tests/cli/test_bind_auth_defaults.py -v` — 13 new unit tests covering the loopback/non-loopback/explicit-override matrix (accounts auto-enabled + warning on non-loopback; explicit provider/auth-enabled respected; empty `AUTH_PROVIDER` treated as unset; OIDC resolves downstream).
- `uv run python -m pytest tests/cli/test_server_lifecycle.py tests/cli/test_cli_auth.py tests/server/test_accounts.py -q` — existing tests still pass (131 total).
## Demo
N/A
## Type of change
- [x] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [ ] Manual verification completed
- [x] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
The new `_apply_bind_auth_defaults` helper is unit-tested directly across all matrix corners; existing server-lifecycle / accounts / CLI-auth suites confirm no regressions.
## Changelog
`omnigent server --host 0.0.0.0` now enables accounts (login) mode automatically instead of silently 401-ing every request
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Stack 1 of 3 for the Scheduled Tasks page (UI-1). Pure lib/hooks, not
rendered yet, so it type-checks standalone.
- scheduledTasksApi.ts: hand-written client for all 6 /v1/scheduled-tasks
endpoints (mirrors sessionsApi.ts).
- useScheduledTasks.ts: React-Query list query (page-scoped 60s poll, with
a guard-rail comment) + create/patch/delete mutations with invalidation.
- scheduleText.ts: client-side RRULE → "Weekdays at 8:00 AM · Next run in Xh".
- scheduleBuilder.ts + timezones.ts: RRULE construction + IANA tz helpers.
- Adds the rrule@^2.8.1 dependency (the only new dep).
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
## Related issue
N/A
## Summary
- Removes the `omni server start` subcommand. `omni server` already starts
the server (in the foreground), so `start` was a redundant way to launch it;
the only thing it added was the detached/background mode.
- Adds a `--background` flag to `omni server` that reproduces the former
`start` behavior: spawn (or reuse) the managed detached local server instead
of running uvicorn in the foreground. `omni server stop` / `omni server
status` are unchanged.
- Updates the desktop app's CLI shell-out, docs, skill files, and tests to
the new invocation.
## Test Plan
- `omni server start` now exits `2` with "No such command 'start'" (verified
via `CliRunner`).
- `omni server --background` routes to `ensure_local_omnigent_server()` and
short-circuits before the foreground port-bind check; prints the URL and
captured log path on spawn, "already running" on reuse, and omits the log
line when `log_path` is unknown (3 renamed tests pass).
- `omni server stop` / `omni server status` behave as before (verified via
CliRunner with stubbed registry).
- `server --help` lists `--background` and only the `stop`/`status`
subcommands; bare `omni server` still reaches the foreground port-bind
check.
- `node --check web/electron/src/omnigent_cli.js` passes; the spawn primitive
in `host/local_server.py` invokes the bare `omnigent.cli server` foreground
command, so it is unaffected by the `start` removal.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [x] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [x] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Renamed the three `test_server_start_*` tests in `tests/cli/test_server_lifecycle.py`
to `test_server_background_*` (invoking `server --background`); updated
comments in `tests/host/test_local_server.py`. Manually verified routing,
help output, and the desktop CLI arg via ad-hoc CliRunner/node checks.
## Changelog
`omni server start` is removed; use `omni server --background` to launch the
detached managed server instead.
* perf(benchmarks): add list_projects + list_project_sessions read journeys
The web sidebar now hammers two project read paths that had no benchmark
coverage: GET /v1/sessions/projects (the project list, a dual-read union of
first-class projects and legacy omni_project label-projects) and
GET /v1/sessions?project= (a project folder's sessions, the dual-read filter
behind clicking a folder).
Add both as latency journeys mirroring the existing list_sessions hot-read
path. Each is a single-request read (1 HTTP/op). list_project_sessions'
setup reads a representative project from the seeded corpus, self-seeding a
first-class project + one filed session when the DB is empty (smoke path) so
the ?project= filter resolves a real member instead of an empty match.
Wire both into the smoke test's curated HTTP-journey list and document them
in the README journey table.
Co-authored-by: Isaac
* perf(benchmarks): seed first-class projects so the project journeys measure real work
The list_projects / list_project_sessions journeys added earlier had no project
data to read: the corpus seeder never filed a session into a project, so against
a real corpus list_projects timed an empty union and list_project_sessions read
a degenerate 1-row folder (self-seeded fallback) — testing nothing about scale.
Seed first-class projects into the corpus and file a configurable fraction of
sessions into them (round-robin), across both write paths:
- new --projects N (default 20) and --filed-fraction F (default 0.5) knobs;
- projects owned by the reserved "local" user the loopback server resolves to,
so the owner-scoped project reads see them;
- membership set on conversation_metadata.project_id (store path via
set_conversation_project, core fast path via the bulk metadata insert);
- deterministic project ids (derived from the index) so both paths produce
byte-identical project rows and a re-seed at the same config is stable;
- project knobs folded into the reuse marker so a pre-existing corpus without
projects is reseeded once.
Now list_projects unions a realistic folder count and list_project_sessions
reads a populated folder (~sessions×fraction/projects members).
Tests: extend the fast-path row-count + byte-stability tests to cover the
projects table and per-folder membership; the smoke seed test asserts projects
are created and filed sessions are listable via the owner-scoped ?project=
filter.
Co-authored-by: Isaac
* ci(benchmarks): run the PR benchmark check when the benchmark harness changes
The PR benchmark regression check only triggered on migration/store changes, so
a change to the benchmark harness itself (journeys, seeder) — like adding the
project read journeys and project seeding — never ran the benchmark it defines.
Add dev/benchmarks/** to the trigger paths so harness changes are exercised
against the nightly baseline on the PR that makes them.
Co-authored-by: Isaac
The Subagents panel list view and graph/tree view kept separate,
duplicated status->color maps that had drifted: the quiet connected
states (launching, idle, done) rendered a blue --session-active dot in
the list but a grey --muted-foreground dot in the graph, so the same
agent showed a blue dot in list and a grey dot in graph.
Extract a single shared subagentStatus module (activity classification +
dot palette) and have both StatusIndicator (list) and NodeStatusDot
(graph) color their dot from it, so a given status renders an identical
dot in both views. The graph keeps its own per-activity border/background
tint, but the dot color is now the shared source of truth.
Also align the graph's activity classification with the list's: the
graph now honors the 'disconnected' state (a runner disconnect renders a
quiet grey dot in both views, not the red 'Failed'), and the root/main
node uses sessionStatus so launching and disconnected are reflected
there too.
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
* feat(projects): polish project-folder header actions
Refine the hover-revealed controls on a project-folder header:
- Swap order so the new-session (pencil) sits left of the "..." kebab,
mirroring how the two buttons read left-to-right.
- Align a session row's quick-pin with the kebab (right-8) so the pin/kebab
pair lines up with the project row's pencil/kebab pair.
- Add a "New session in project" tooltip on the pencil.
- On mobile, hide the pencil (max-md:hidden) and fold the action into the
kebab as a md:hidden "New session" item linking to the same pre-filed
composer.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e): cover project new-session mobile fold
Add a Playwright e2e asserting the folder header's new-session pencil is
hidden below the md breakpoint (max-md:hidden) and the same action is offered
as a md:hidden "New session" kebab item linking to the pre-filed composer.
Satisfies the E2E UI Required gate for the mobile behavior change.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e): scope mobile-fold locators to the test's project
The bare project-new-session / project-actions test-ids match every project
folder on the shared e2e server, so the mobile-fold test hit a strict-mode
violation (2+ pencils) once another test seeded a second folder — passing in
isolation but failing in the CI shard. Scope the pencil and kebab locators by
their per-project accessible names ("New session in <project>", "Project
actions for <project>") so only this test's folder is matched.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(projects): first-class projects in the web sidebar
Wires the web app to the first-class projects entity (#2765/#3053), keeping
the legacy omni_project label path working via dual-read so no migration is
forced. Folders are keyed by name (the union key that merges a first-class
project and a like-named label-project into one folder), carrying the
first-class id when one exists.
Backend
- GET /v1/sessions/projects now dual-reads: unions first-class projects
(project_store.list — incl. empty, with id) and legacy label-projects
(id=None), merged by name and sorted. Response shape list[str] →
list[{id, name}]; still owner-scoped. openapi.json regenerated.
Frontend
- projectsApi.ts: typed /v1/projects CRUD client (list/create/rename/delete).
- Hooks: useProjects → ProjectSummary[] ({id, name}); new useCreateProject,
useRenameProject; reworked useDeleteProject (archive + unfile every member,
then delete the container). Filing/moving files via project_id, resolving
the picked name to an id and creating the first-class row on demand for a
label-only folder; "" unfiles. Conversation.project_id added.
- Sidebar: folders keyed by {id, name}, members matched by project_id OR the
legacy label; always-visible Projects section with a "New project"
(create-empty) control extracted to NewProjectButton.tsx; Rename dialog;
delete threads id; a row's current-project dual-reads project_id→name so a
pinned first-class member keeps its project flyout; "Remove from project"
unfiles silently (a first-class project persists when emptied); empty
folders read "No sessions".
- NewChatDialog: composer files new sessions via project_id.
Tests
- projectsApi unit tests; reworked hook tests (resolve→file, create-on-demand,
archive+unfile+delete); sidebar/composer suites updated; server union test;
e2e_ui docstrings + fixtures updated for the project_id membership flow.
Deferred (kept on the label path via dual-read): the new-session prefill state
machine and the Settings archived-only project picker; retiring label reads is
gated on the Phase 4 backfill.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): rename-dialog Enter, checked promote PATCH, typed projects schema
Addresses the review on #3061:
- Rename-project dialog: wrap the body in a <form> so Enter submits natively
(Radix Dialog doesn't provide one, and the prior manual key handler looked
for the confirm button inside the <input> and never fired).
- useRenameProject label-only promote: check res.ok on each re-file PATCH and
throw on failure, so a 4xx/5xx no longer reports success with members left
unfiled.
- GET /v1/sessions/projects: return a typed SessionProjectSummary list instead
of list[dict] + response_model=None, which produced an empty ("schema": {})
OpenAPI response and broke client generation. openapi.json regenerated.
- Drop the stale test comment describing the removed last-session remove-confirm
gate.
Copilot #2 (recreate missing metadata row) and #4 (...->NotImplementedError in
the abstract method) intentionally declined, consistent with prior rounds.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): keep dual-read membership coherent on move/rename; lift row lookup
Addresses the second web-UI review round on #3061:
- moveConversationToProject now clears the legacy omni_project label in the same
PATCH as it sets project_id. The sidebar groups a folder by project_id OR the
label during the dual-read transition, so a stale label would keep a moved
session in its old label-folder (and match two folders at once). project_id is
the single source of truth after a move.
- useRenameProject reconciles members for BOTH paths (first-class rename and
label-only promote): sweep the folder's members via ?project=<oldName>, re-file
each onto the target project_id, and clear the legacy label — so a first-class
rename no longer strands label-matched members in an oldName folder.
- resolveOrCreateProjectId tolerates the create-on-demand race: a concurrent
move to the same new name can 409 on the second POST; re-list and use the
winner's id instead of failing.
- ConversationRow no longer calls useProjects() per row. A list-level
id->name map is provided via context (ProjectNamesContext), so row renders are
O(1) with no per-row query observer.
Test PATCH-body assertions updated for the added labels field.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): preserve the original error when create-on-demand truly fails
resolveOrCreateProjectId caught the create error to tolerate the 409 race
(a concurrent move created the same name), but a genuine 500/network failure
was indistinguishable and surfaced as a generic "Could not resolve or create"
message. Re-list to disambiguate: if the row now exists a racer won — use it;
otherwise rethrow the ORIGINAL error so the true cause isn't masked.
Addresses a non-blocking note on #3061.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): stub /v1/sessions/projects with the {id,name} shape in prefill test
The project-prefill e2e test stubbed GET /v1/sessions/projects with the old
bare-string body, but this PR changed the endpoint to return
SessionProjectSummary objects. The sidebar parsed no folder, so the project
header never rendered and header.hover() timed out.
Return the dual-read union shape ({id: None, name} for the label-only project
the test seeds), matching the endpoint contract and the sibling sidebar tests.
Co-authored-by: Isaac
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* ✨ feat(claude): Load Databricks models live
- Refresh the gateway catalog once per new native session and share the launch snapshot with the UI.
- Keep provider-neutral aliases, cached fallback behavior, and authoritative model removals.
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* 🐛 fix(claude): Handle delayed model catalogs
- Retry sticky model handoff after live options arrive, including bind races
- Map provider model ids and defaults to friendly active picker rows
- Tighten model option contracts and cover backend/UI edge cases
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* fix(api): regenerate OpenAPI schema
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* 🐛 fix(claude): Mirror managed model catalog
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* 🐛 fix(ui): Resolve launch models from host
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* test: fix model discovery CI coverage
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* test: stub host model discovery in e2e
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* fix(claude): preserve live catalog routing
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
* fix(claude): don't treat a failed-primary empty catalog as authoritative
Addresses the outstanding review round:
- discover_databricks_claude_models: when the UC listing fails and the
legacy gateway answers with no Claude routes, re-raise the primary
error instead of returning {} — callers now fall back to cached ucode
models rather than hard-failing the launch on a transient UC outage.
- Warn when model-services pagination is truncated at the page budget.
- Runner claude-model-options: answer ClickException config failures
with 424 instead of the retryable 503, so the picker path stops
conflating "no models configured" with "still booting".
- chatStore bind race: a preserved raced-catalog selection must still
exist in that catalog — a removed sticky alias no longer lingers
visually selected.
- Document that the pre-launch host catalog is an ambient-default
preview; launch re-resolves with the session's agent spec.
Co-authored-by: Isaac
* test(e2e): pick the live catalog label in the model/effort scenario
The config modal's Model rows now carry the host catalog's display
names ("Opus 4.8"), not the static alias labels, so the exact-match
click must use the mocked catalog's label.
Co-authored-by: Isaac
* chore: revert accidental uv.lock churn from the merge
Co-authored-by: Isaac
* fix(api): sync openapi.json with the host model-options docstring
Co-authored-by: Isaac
* fix(api): tolerate provider model rows without displayName
Polly review: the shared NativeModelOption schema made displayName
required and _model_options_from_wire validated all-or-nothing, so one
Codex model/list or OpenCode /api/model row lacking displayName blanked
the whole picker for the session. Restore displayName as optional (the
UI already falls back to the id) and skip malformed rows individually
instead of discarding the catalog.
Co-authored-by: Isaac
---------
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
Co-authored-by: sabhya-db <sabhya.chhabria@databricks.com>
The Configure <agent> modal's Cancel/Save footer used the shared
DialogFooter's muted tray background and top divider, which read as a
distinct gray band. Override it to blend into the modal body so the
footer matches the rest of the surface.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Fold ix_scheduled_tasks_created_at and ix_scheduled_tasks_user_id into a
single ix_scheduled_tasks_user_scope (workspace_id, user_id, created_at, id).
The per-user GET /scheduled-tasks listing (store.list(owner_user_id=...):
WHERE workspace_id AND user_id ORDER BY created_at, id) becomes an ordered
index seek with no filesort, instead of a user_id seek that must sort or a
created_at scan of every owner's rows.
The scheduler-boot read (list_active_all_workspaces) uses neither index for
its state filter and its ordering only feeds independent per-task timer
arming, so dropping the created_at-ordered scan costs nothing.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* feat(web): add ⌘⌥V hotkey to toggle voice dictation
Add a WhisperFlow-style global hotkey (⌘⌥V / Ctrl+Alt+V) that toggles the
composer's voice dictation from anywhere in the app — the same action as
clicking the mic button.
- New useVoiceDictationHotkey hook, mirroring useCommandPaletteHotkey: a
global keydown listener that bails inside terminals / the Monaco editor,
ignores auto-repeat, and matches on the physical KeyV code (⌥ rewrites the
character on macOS). Uses the browser-safe ⌘⌥ chord shared by the
sidebar-toggle and pinned-session hotkeys — plain ⌘M minimizes the window
on macOS and most ⌘⇧-letter combos are browser shortcuts.
- ComposerMicButton gains an opt-in enableHotkey prop plus onVoiceStart /
onVoiceDiscard callbacks. While listening, Enter commits (stop, keep the
text) and Esc cancels (stop, revert to the pre-dictation snapshot); a
discard guard drops a trailing transcript that races in after Esc.
- Wire the hotkey + snapshot/restore into both composers (ChatPage and the
New Chat landing screen); the two never mount at once, so the chord never
double-fires.
- Document the shortcut in the keyboard-shortcuts dialog.
Co-authored-by: Isaac
Signed-off-by: kerryspchang <kerryspchang@users.noreply.github.com>
* fix(web): skip the doomed Web Speech take in Electron dictation
In Electron the SpeechRecognition constructor exists but has no backend, so
the first take always fails with a "network" error and only then falls back
to the server path — a visible ~1s "fail then recover" on every take. Real
browsers don't hit this because Web Speech genuinely works there.
When the server advertises dictation and we're in the Electron shell, go
straight to the server path and skip the Web Speech attempt entirely. The
existing "network" fallback stays as a safety net for other environments.
Co-authored-by: Isaac
Signed-off-by: kerryspchang <kerryspchang@users.noreply.github.com>
* test(e2e): cover the voice-dictation hotkey and Enter/Esc commit/discard
The E2E UI gate flagged the new keyboard-driven dictation behavior as
user-facing and unit-tested only. Extend the existing server-dictation
Playwright test with three cases driving a real browser + live server +
fake engine:
- the ⌘⌥V / Ctrl+Alt+V hotkey starts and stops a take (window keydown
path, matched on the physical KeyV code — not the mic button onClick),
- Enter while listening ends the take and keeps the dictated text (and,
via the capture-phase handler, does not send the draft),
- Esc while listening ends the take and reverts to the pre-dictation text.
Extract the server-mode page setup (mic permission grant + stripping the
SpeechRecognition constructors) into a shared helper the four tests share.
Co-authored-by: Isaac
Signed-off-by: kerryspchang <kerryspchang@users.noreply.github.com>
---------
Signed-off-by: kerryspchang <kerryspchang@users.noreply.github.com>
Co-authored-by: kerryspchang <kerryspchang@users.noreply.github.com>
* fix(egress): don't inject credentials on TRACE/OPTIONS + honor Max-Forwards
TRACE is a loopback diagnostic whose final recipient reflects the request
back to the caller, so the credential proxy attaching a bound-host secret
on TRACE would echo it straight back into the sandbox. Refuse credential
injection/swap on TRACE and OPTIONS regardless of the allowlist.
Also make the proxy a conformant intermediary for Max-Forwards
(RFC 7231 §5.1.2): answer TRACE/OPTIONS as the final recipient when the
hop budget reaches 0 (never forwarding into the injection path), and
decrement a positive budget before forwarding.
Signed-off-by: mxatone <6202935+mxatone@users.noreply.github.com>
* refactor(egress): address Polly review notes on Max-Forwards handling
Non-blocking follow-ups from the automated review:
- Normalize the method with .upper() inside _apply_max_forwards so the
guard holds even if a future caller forgets to upper-case the verb.
- Document that the OPTIONS Allow list is intentionally static and
proxy-scoped (the proxy's own final-recipient capabilities, not the
origin's).
- Note that a request body on the terminate path is intentionally left
undrained since the reply is Connection: close.
Signed-off-by: mxatone <6202935+mxatone@users.noreply.github.com>
---------
Signed-off-by: mxatone <6202935+mxatone@users.noreply.github.com>
* feat(web): set up a missing harness from the New Chat dialog
Turn the dead-end "binary missing" / "needs auth" warning in the New
Chat harness picker into a working setup flow, gated behind the
server's harness_install_enabled capability (flag off → the picker is
byte-for-byte the pre-feature UI).
- A "Set up →" affordance on an unready harness opens HarnessSetupDialog,
a server-driven checklist that reflects the harness's real setup steps
and per-step status from /v1/harnesses and /v1/info.
- One-click install drives POST /v1/hosts/{id}/harnesses/{harness}/install,
scoped per-harness so concurrent installs of different harnesses track
independently; the dialog reads live host readiness so the badge flips
without a reconnect.
- Steps we can't yet detect (API-key / gateway auth) point at
`omnigent setup` rather than showing an untrackable checkbox.
Frontend-only; the backend for this flow landed in #2912.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(web): address review on the harness setup dialog
- Wire the harnessInstallableOnHost guard into the Install button so the
UI never offers a one-click install the server's allowlist would
reject (defence in depth against catalog/allowlist drift); it was
exported and tested but never called. Fix the stale
canInstallHarnessFromUI doc reference.
- Key the post-install toast on the refreshed readiness the install
returns: "ready" only when the harness is actually launchable,
otherwise "installed — one more step" so it can't contradict a
still-showing sign-in row (e.g. Codex).
- Add a fallback message when the server published no setup steps for a
spelling, instead of an empty dead-end dialog.
Adds tests for the guard, both toast wordings, and the empty-steps
fallback.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
---------
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(onboarding): judge install success with the readiness resolver
try_install_harness_cli judged install success with a bare
shutil.which(spec.binary), but readiness (harness_cli_installed) uses
resolve_cli_binary — the full ladder that also probes the
nvm/npm-global/homebrew bin dirs the host daemon's frozen PATH omits.
On a host whose npm prefix is off PATH, npm lands the binary in a
fallback dir: the install verdict returned "not on PATH" (→ 502 → red
"failed" toast) while readiness resolved it via the ladder (→ green
"ready" tick). One install, two contradicting verdicts, surfaced by the
UI setup dialog.
Judge success with the same resolve_cli_binary the readiness badge uses
so the two can't disagree, while keeping the ~/.local/bin PATH-prepend
the setup wizard's later harness_login relies on. Adds a regression test
pinning that an off-PATH-but-on-ladder binary reads installed from both
try_install_harness_cli and harness_cli_installed.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* docs(onboarding): clarify HarnessInstallResult resolves off PATH too
Polly review nit: after unifying the install verdict on resolve_cli_binary,
the "on PATH after the attempt" phrasing on HarnessInstallResult.installed
and in try_install_harness_cli's docstring was stale — success can now also
come from a binary resolved via the fallback ladder (off bare PATH). Reword
both to say "resolves via resolve_cli_binary". No behavior change.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(onboarding): put the resolved install dir on PATH for later login
Polly review follow-up on the install-verdict fix: judging install
success via resolve_cli_binary's full ladder fixed install-vs-readiness,
but the wizard's *later* steps (harness_login / harness_cli_logged_in /
harness_logout) still shell out with the bare binary name and only bare
shutil.which. The prior remediation only prepended ~/.local/bin, so an
install that succeeded via a different fallback dir (nvm / npm-global /
homebrew) could be followed by a login step that couldn't locate the
binary just installed.
Prepend the dir the binary actually resolved from (Path(resolved).parent)
to PATH, so install, readiness, and login all converge on the same
binary. Adds a test pinning that a bare shutil.which (what login uses)
finds the CLI after an off-PATH install, and updates the ~/.local/bin
refresh test for the resolver-based mechanism.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
---------
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(runner): quiet idle-reaper shutdown instead of a scary error banner
When the runner idle monitor reaps an inactive runner after
`runner.idle_timeout_s` (default 1h), the runner exits cleanly (code 0),
but the UI rendered the same loud red `ErrorBanner` a genuine crash would
— even though the session is fully reactivatable (host-bound sessions
relaunch the runner on the next message). A clean idle shutdown tripped
two banner-producing server paths:
1. Relay path (durable / reload banner): the runner's `GET /stream`
dropped abruptly, so the SSE relay published `failed` +
`runner_disconnected` and persisted it as a `last_task_error` label.
2. Host exit-report path (live): the host's `_watch_runner` reported
`host.runner_exited`, which became `failed` + `runner_failed_to_start`.
This treats a clean idle exit as benign (a genuine crash still shows the
banner):
- Runner drains its session streams before the idle shutdown: enqueues the
`[DONE]` sentinel to each `GET /stream` so the relay returns cleanly
(no `runner_disconnected`, no durable label). `serve_tunnel` now takes a
`shutdown_event` + `on_graceful_shutdown` hook; on signal it waits for
in-flight dispatch tasks to emit their end frames, then closes the socket
with a normal close handshake (the handshake completing is the delivery
confirmation — robust over a remote connection, not a timing nudge), and
stops reconnecting.
- Host suppresses the exit report for a clean (code-0) exit; a non-zero
exit still reports its cause.
Co-authored-by: Isaac
* refactor(runner): address PR review nits on graceful-shutdown loop
- Use asyncio.create_task instead of ensure_future in the graceful-shutdown
read loop, matching the module convention (Copilot).
- Make the graceful-shutdown serve test deterministic: pre-arm the shutdown
event so the first recv() race resolves to it, dropping the real-time
sleep(0.01) that could flake under load (Copilot).
- Give the flagged bare `await task` an explicit effect via
`assert task.result() is None` (CodeQL "statement has no effect").
Co-authored-by: Isaac
* docs(runner): note the same-tick frame drop in graceful shutdown
Polly/Copilot review flagged that if a frame and the shutdown signal
complete in the same asyncio.wait tick, the shutdown branch wins and the
frame is dropped. That is acceptable on the idle-reaper teardown path (a
host-bound session replays/relaunches on the next message); document it so
the trade-off is explicit for future readers.
Co-authored-by: Isaac
* refactor(runner): snapshot drain queues; create_task in tests
Follow-up PR review nits (Copilot):
- `_drain_session_streams` now iterates `list(_session_event_queues.values())`.
The loop is synchronous (no await, so nothing interleaves on the event loop
today), but snapshotting keeps the drain robust if a queue mutation ever
moves off this atomic path — matching the `list(...)` idiom already used by
the timer-cleanup / pane-reaper paths.
- Switched the two remaining `asyncio.ensure_future(...)` test helpers to
`asyncio.create_task(...)` for consistency with the module convention.
Co-authored-by: Isaac
* fix(runner): log recv failure while settling cancelled read on shutdown
PR review (Copilot): the graceful-shutdown branch swallowed
WebSocketException while awaiting the cancelled recv_task. If recv() had
already failed with an abnormal close on the same tick the shutdown fired,
the socket may be dead — so the drain's [DONE] frames won't reach the
server and it will see a disconnect — yet there was no trace of why.
Keep suppressing the exception (letting it propagate would skip
_graceful_drain and reintroduce the abrupt drop this PR removes), but split
the handling: silent on CancelledError (normal cancellation), debug-log on
WebSocketException so the rare same-tick failure is diagnosable without
disturbing the quiet UX.
Co-authored-by: Isaac
* perf(scheduled-tasks): fix unbounded queries in scheduled-task store
Three unbounded DB reads could cause excessive load as the task table grows:
- Issue #5: `list()` fetched all workspace tasks then filtered in Python.
Add `owner_user_id` parameter to `list()` (ABC + SQLAlchemy) so the
WHERE clause uses the existing `ix_scheduled_tasks_owner_user_id` index.
Update the route to pass `owner_id` directly instead of post-filtering.
- Issue #6: `list_runs()` returned every historical run for a task with no
LIMIT. Add a `limit: int = 100` keyword parameter (ABC + SQLAlchemy) and
apply `.limit(limit)` to the query.
- Issue #10: `list_active_all_workspaces()` had no cap on rows returned at
scheduler boot. Apply a hard `.limit(10_000)` to prevent unbounded load.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(scheduled-tasks): paginate list_runs and arm all tasks at boot instead of silent caps
Problem A: GET /scheduled-tasks/{id}/runs silently truncated run history at
100 rows with no pagination. Replace the bare limit with cursor pagination:
list_runs now returns (runs, next_cursor) and takes after_id; the endpoint
accepts limit (1-1000) and after, and returns {runs, next_cursor}. Run ids are
random UUIDs, so the keyset resolves the cursor row's scheduled_at and compares
the full (scheduled_at, id) tuple under the DESC order — an id-only cursor
would skip/repeat rows on scheduled_at ties.
Problem B: scheduler boot (list_active_all_workspaces) capped at 10k rows, so
tasks beyond the cap silently never armed. Chose the complete-pagination
approach over a loud-warning cap: the method now keyset-pages internally by
(workspace_id, created_at, id) in 10k batches and returns ALL active tasks, so
every task is armed at boot. Full pagination is strictly correct (no task ever
left un-armed) and the boot scan is a rare, one-shot cost.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(permission-store): add query limits and reduce session opens
Unbounded queries on list_for_user, list_for_session, and list_users
could fetch unlimited rows from the DB. Add limit: int = 1000 to each
with .limit(limit) applied to the query; update the abstract base class
to match.
check_access opened 2 separate sessions for 2 PK lookups.
get_permission_level opened 3 sessions (is_admin + 2 get calls).
Consolidate each into a single `with self._session()` block following
the same pattern used by resolve_access.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* revert(permission-store): restore separate sessions in check_access and get_permission_level
The consolidation of check_access and get_permission_level into single
sessions changed the timing characteristics of permission reads. Under
xdist parallel test execution the CI integration suite (Integration
openai-agents) saw test_share_and_second_user_continues fail: a
concurrent reset from another worker cleared the mock LLM queue between
configure_mock_llm and the owner's first turn, causing the second turn to
receive no LLM response.
Revert check_access and get_permission_level to their original
multi-session implementations to restore the original execution timing.
The resolve_access consolidation (used by the hot GET /v1/sessions path)
is retained as it was already present on main and is not implicated in
the failure.
Issue #15 (reducing session opens in check_access/get_permission_level)
remains open and can be addressed with a more targeted fix that also
addresses test isolation.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(permissions): add cursor pagination to GET /sessions/{id}/permissions
list_for_session now returns (grants, next_cursor) with user_id-ordered
keyset pagination. The API endpoint accepts limit (1–1000, default 100)
and after (cursor = user_id) query params and returns
{"permissions": [...], "next_cursor": str|null}.
GET /users gains a limit query param (1–1000, default 100) wired through
to list_users(). list_for_user keeps its silent 1000-row cap (internal
only).
All callers of list_for_session updated to unpack the tuple.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(permissions): cover cursor pagination and dict response shape
Add a store-level pagination test and update the session permissions
integration tests to unwrap the new {permissions, next_cursor} response
shape. Fix list_for_session cursor to return the last returned user_id
so the exclusive user_id > after_user_id filter does not skip a row.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(permissions): update e2e/server tests for paginated permissions response
GET /v1/sessions/{id}/permissions now returns {permissions, next_cursor}
instead of a bare list. Update the e2e sharing test and the e2e_ui
permissions-modal helper to read the permissions array.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(web): parse paginated permissions response in listPermissions
GET /v1/sessions/{id}/permissions now returns {permissions, next_cursor}
instead of a bare array. listPermissions follows the cursor and
concatenates all pages, returning Permission[] so callers
(isSessionSharedWithOthers, AgentInfo, usePermissions) are unaffected.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(web): move host-offline reconnect prompt into the composer host badge
When a session's host went offline, the "Host is offline — click to
reconnect" affordance rendered as a banner below the composer, separate
from where the host is already named. Fold it into the composer's host
badge: when a session is `host_offline`, the badge becomes a clickable
red "Host is offline — click to reconnect" control in place of the
passive host name + status dot.
ConnectionIndicator now suppresses its banner for `host_offline` whenever
the composer (and its badge) is on screen — i.e. everywhere except the
terminal-first *terminal* view, where the PTY owns the surface and the
banner still carries the affordance. `local_stranded` keeps the banner
everywhere (no host, so no badge to host it).
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): keep host-offline banner for sub-agent sessions
A sub-agent session's composer hides the host badge (the header's child
slot owns that row), so the badge can't carry the host-offline reconnect
affordance. The banner suppression keyed only on the terminal view, so a
non-terminal-first sub-agent `host_offline` session lost the affordance
entirely. Thread `isSubAgentSession` into ConnectionIndicator and only
suppress the banner when the badge will actually render it.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): give sub-agent sessions the same host-offline reconnect path
The previous fix special-cased sub-agents by keeping the banner for them.
Instead, treat them like normal sessions: the composer's host badge carries
the reconnect affordance for a host_offline sub-agent too (only the passive
name badge stays hidden for a child). ConnectionIndicator goes back to
uniform suppression whenever the composer is on screen.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* refactor(web): drop unreachable sub-agent host_offline handling
Sub-agent sessions are never host-bound — sys_session_send creates the
child with host_id null and the server inherits only runner_id, so a
stranded child is always local_stranded, never host_offline. The badge's
reconnect affordance therefore never needs to render for a sub-agent;
gate showReconnect back on showHost and drop the dead sub-agent test.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(auto-harness): use live runner catalog to filter available harnesses
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix: restore Auto harness option and routing icon after merge
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix: remove leftover comment placeholder
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix: restore auto-harness session create intercept and first-message resolution after merge
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix: restore route_session_harness lost in merge
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(auto-harness): always clear 'auto' sentinel after first-message resolution
Add _unset_harness_override to update_conversation so the 'auto' sentinel
is cleared even when routing returns harness=None (unavailable/failed).
Without this, the resolution block re-ran on every turn and emitted
a routing card each time.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
test_first_message_schedules_background_semantic_title wrote its own seed
title via store.update_conversation after posting the first user turn. The
events endpoint already seeds the title synchronously before returning, so
that manual write raced the background coordinator's rename and clobbered it
when it landed late — the source of the flaky
"assert 'please investigate...' == 'Debug authentication timeout'" failure.
Drop the redundant manual seed (and the now-unused db_uri fixture) so the
test relies on the endpoint's seed, matching the passing sibling tests.
Co-authored-by: Isaac
- Route accumulated conversations to the latest matching turn queue
- Keep native mock credentials active and refresh the Claude mock model
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
On Windows, `omnigent setup` could crash as soon as it reached the interactive
harness picker because the TTY menu path imported the POSIX-only termios/tty
modules. The user-visible failure was `ModuleNotFoundError: No module named
'termios'`, after the setup banner and preflight warning had already printed.
Route Windows setup menus through the existing numbered fallback instead of the
raw termios path, including the legacy wizard helpers and their back-navigation
behavior. Also remove the remaining POSIX os.getuid() assumptions from native
bridge temp-root setup so Windows installs do not fail while importing those
bridge modules.
Tested with the focused Windows startup regressions:
python -m pytest tests/onboarding/test_interactive.py tests/onboarding/test_wizard.py tests/test_claude_native_bridge.py::test_ensure_secure_dir_succeeds_without_getuid tests/test_qwen_native_bridge.py -q -k "not rejects_symlinked_ancestor"
Signed-off-by: scwf <wangfei_hello@126.com>
* 🐛 fix(history): Hide Claude task notifications
- Mark Claude task notification transcript rows as meta context
- Hide legacy task-notification rows during history hydration
* 🐛 fix(history): Handle monitor task notifications
---------
Co-authored-by: Anthony Ivan <anthony.ivan@example.com>
Co-authored-by: Serena Ruan <82044803+serena-ruan@users.noreply.github.com>
* feat(slash-menu): substring-match slash commands by name
The slash-command suggestion menu matched a query as a prefix of the
full, namespaced command name, so typing `/using-superpowers` surfaced
nothing — the name starts with `superpowers:`. Match the query as a
case-insensitive substring of the command name instead, so
`/using-superpowers` surfaces `/superpowers:using-superpowers`.
A single shared helper `slashCommandMatches(name, query)` in
SlashCommandMenu.tsx backs all three web filter sites (the menu render
filter, ChatPage `menuMatches`, and NewChatDialog `slashMenuMatches`) so
the visible list and the keyboard-nav index can't drift apart. The
omnigent REPL completer (`_SlashCommandCompleter`) mirrors the same rule
in Python so the CLI and web UI behave alike; parallel unit tests keep
the two implementations from diverging.
Matching is name-only, not description: the web menu never shows
descriptions inline, so a description-driven match would look
unexplained. Insertion order is preserved (no relevance ranking) to keep
the menu's Commands/Skills section split contiguous, and submit routing
is unchanged — menu completion still fills the canonical name first.
Co-authored-by: Isaac
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
* style(slash-menu): prettier-format merged import lines
Rewrap the import statements combined during the ap-web -> web rebase so
they satisfy `prettier --check` (they exceeded the print width). No
behavior change.
Co-authored-by: Isaac
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
* style(repl-test): drop explicit `return None` from _noop_handler
Ruff (RET501) flags an explicit `return None` in a `-> None` function.
The bare `return` is equivalent; keeps `pre-commit run --all-files`
green. No behavior change.
Co-authored-by: Isaac
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
* test(e2e-ui): cover slash-command substring matching in both composers
Adds the Playwright coverage the e2e_ui gate requires for this
user-facing change. Two tests drive the new substring behavior in a real
browser against a spawned server:
- In-session composer: `/ontext` (mid-name substring of `/context`,
prefix of nothing) surfaces the row AND highlights it — proving the
render filter and `menuMatches` keyboard-nav filter substring-match in
lockstep.
- New-chat landing composer: a stubbed non-native agent bundling a
`code-review` skill; `/review` surfaces the row and Tab completes it to
`/code-review ` — covering keyboard completion.
Co-authored-by: Isaac
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
* fix(slash-menu): rank prefix matches ahead of mid-string matches
Substring matching combined with auto-highlight (setMenuIndex(0)) and
immediate execution of no-arg built-ins let a short query execute the
wrong command. Built-ins are ordered /compact, /context, /effort,
/model, /help, so typing `/e` highlighted `/context` first (it contains
"e") and Enter/Tab ran it immediately instead of filling `/effort `;
`/m` similarly hit `/compact` ahead of `/model`. The REPL completer had
the same ordering.
Rank matches for display: built-ins before skills (so the Commands
section stays above Skills and the flat keyboard index walks the same
order that's rendered), and within each group prefix matches before
mid-string matches. The sort is stable, so ties keep insertion order and
an empty query (lone `/`) still lists everything unchanged.
A new shared helper `rankedSlashCommandNames` backs all three web filter
sites (menu render, ChatPage `menuMatches`, NewChatDialog
`slashMenuMatches`) so the visible order and keyboard index stay aligned;
the REPL completer mirrors the rule (prefix tier before substring tier,
insertion order within each). Tests pin the ordering on both sides,
including a real-registry REPL assertion.
Co-authored-by: Isaac
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
---------
Signed-off-by: Colin Reynolds <colin.reynolds@databricks.com>
* feat(web): move new-session harness config into a gear-icon modal
The new-session composer's agent picker did double duty — selecting the
agent/harness AND exposing every run-config knob (model, effort, permission
mode, Codex approval + dangerous bypass, Cursor exec mode, bundle brain
harness) via desktop hover-flyout submenus and a bespoke mobile drill-in.
This overloaded one control and made the submenu machinery complex.
Split the concerns: the picker dropdown now only selects the agent, and a
gear icon beside it opens a "Configure {agent}" modal that adapts to the
selected agent's capabilities. The modal edits a local draft and commits on
Save (Cancel discards).
Also in this pass:
- Picker dropdown groups: "needs setup" harnesses fold into a "More" flyout;
custom (user-registered) agents fold into a "Custom agents" flyout. On
touch, both drill in-place with a Back row instead of hover flyouts.
- Gear tooltip summarizes the current settings on hover.
- Config Selects anchor below the trigger, pinned to trigger width; option
descriptions (permission/approval/cursor) show in a footer that tracks the
hovered row.
- Codex bypass toggle simplified to a plain switch (no typed-phrase gate),
still behind Save with the danger banners.
- Smart routing folds into the Model dropdown as a "Smart Routing" option
(when the server enables it and the harness is routable); picking it
freezes Effort to Default. Removes the standalone composer toggle here
(unchanged in the in-session composer).
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): regenerate visual baselines
* fix(web): surface Smart Routing for all routable agents; address review
Polly AI review flagged that Smart Routing lived only in Claude's Model
dropdown while _ROUTABLE_HARNESSES still advertised Codex/Pi/bundle agents —
a silent UI regression (server still routes them). Fixes:
- Add a standalone "Smart Routing" toggle row in the gear modal for routable
agents that have no Model dropdown to fold it into (Codex, bundle agents).
Claude keeps offering it as a Model option.
- Commit costControlMode in save() for every eligible agent, not just the
Claude branch.
- Reset costControlMode on agent change (alongside the bypass reset), so an
armed routing can't carry to an agent whose modal can't clear it.
- Picking "Default" in the Model dropdown while routing was on now defers
(null → omitted) instead of emitting an explicit "off".
- Refresh the stale reset-effect comment (the typed bypass phrase is gone).
Adds tests for the Codex standalone toggle, its create-flow wiring, and the
reset-on-agent-change behavior.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): make gear tooltip consistent with the modal for effort/routing
Address Copilot review (PR #3050): the tooltip's Effort summary showed the
"—" sentinel while the modal's unset option is "Default", and it didn't
reflect Smart Routing (which freezes effort) for non-Claude agents.
- Effort now reads "Default" when unset or when Smart Routing is on,
mirroring the modal.
- Non-Claude routable agents show a "Smart Routing: On" tooltip row when
armed (Claude folds it into the Model row).
Adds tooltip tests for the Default-effort label and the Smart Routing case.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): keep the gear visible for routing-eligible agents
Address Copilot review (PR #3050): the gear was hidden when the selected
agent had no permission/approval/cursor knob and wasn't a brain-harness
agent — which would also hide Smart Routing, since it lives only in the gear
modal now. Fold smartRoutingEligible into selectedAgentHasKnobs so any
routing-eligible agent keeps its gear.
In practice every routable selectable agent already has another knob (Claude
permission, Codex approval, bundle Agent Harness), so this is defensive —
but it makes the visibility gate provably correct rather than reliant on that
overlap. Adds tests for the bundle-agent routing+harness case and the
knob-less non-routable case (gear hidden).
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): gate Smart Routing UI on eligibility to avoid stale-on states
Address Copilot review (PR #3050): a stale costControlMode="on" combined with
smartRoutingEligible=false (server later disabled the flag, or a non-routable
agent) could (a) leave the Model Select on the __smart__ sentinel with no
matching item, and (b) show misleading "Smart Routing" rows in the gear
tooltip. Gate both smartRoutingOn (modal) and routingOn (tooltip) on
smartRoutingEligible so the UI only reflects routing when it's actually
offered for the current agent.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e-ui): update picker interactions for the grouped/gear-modal picker
The gear-modal refactor moved custom agents into a "Custom agents" submenu,
needs-setup harnesses into a "More" submenu, and the bundle brain-harness
picker into the config modal's Agent Harness select. Update the e2e drivers
that still assumed the old flat picker:
- test_create_custom_agent: reach "Create custom agent" via the Custom agents
submenu; on a sandbox the whole group is omitted (assert both absent).
- test_hide_unconfigured_harnesses: Goose (unconfigured) now folds into "More"
when the toggle is off — drill in to find it.
- test_agent_picker_version: the custom upload lives in the Custom agents
submenu; the built-in stays inline.
- test_codex_auth_availability: the bundle harness badge is in the config
modal's Agent Harness select now (open gear → open select).
- test_start_session (fork-of-fork dedup): top level is now Claude + the
Custom agents submenu trigger (2 menuitems); the custom agent survives
inside the submenu.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): make the new-session picker and config modal mobile-friendly
- Agent picker dropdown ran off the top of short mobile viewports (clipped
under the status bar). Add collisionPadding so Radix's available-height cap
leaves a safe margin and the menu flips/scrolls instead of overflowing.
- Config modal rows squeezed the label into a narrow column beside a fixed
w-52 control, forcing heavy wrapping on mobile. Stack label-over-control
full-width on mobile; keep the side-by-side layout from sm+.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): badge unconfigured brain harnesses in the config modal; fix e2e
Two follow-ups from the E2E run:
- The config modal's Agent Harness select showed a plain "(needs setup)" text
for unconfigured harnesses, dropping the reason-specific badge (and its
new-chat-landing-harness-warning-<id> testid) the old picker had. Restore the
amber badge with the reason text ("needs auth", etc.) so bundle agents like
Polly surface Codex auth state again.
- test_create_custom_agent sandbox check: the "Custom agents" submenu can
legitimately render on a sandbox when a session-scan surfaces a discovered
custom agent; only the create action is gated. Assert just that "Create
custom agent" is absent, not the whole submenu.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): fold Codex bypass into Approval dropdown; a11y + review fixes
UI/UX:
- Codex "Bypass approvals & sandbox" is now the most-permissive option in the
Approval dropdown (it's conceptually an approval stance) instead of a
separate toggle. The persistent danger banner stays when it's selected.
- Smart Routing toggle for non-Claude routable agents moves to the FIRST row
and right-aligns the switch.
Accessibility (Copilot review): the config-modal Select triggers had no
accessible name (the ConfigRow label is visual-only). Add aria-label to the
Model / Effort / Agent Harness triggers and an ariaLabel prop on
DescribedSelect (Permissions / Approval / Mode).
Logic (Copilot review):
- The effectiveAgentId reset effect (bypass + smart routing) now fires only on
an actual agent change, not initial resolution — so a costControlMode/bypass
restored from the landing draft isn't wiped on mount.
- Picking Model "Default" always defers routing to the spec default (null),
never emitting an explicit "off".
Tests: unit + e2e updated for the folded bypass option and the codex
needs-auth badge (now in the Agent Harness select; .first for Radix's
trigger mirror).
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): surface "Create custom agent" when no custom agents exist
On a fresh non-sandbox host with no custom agents, "Create custom agent"
was buried inside a lazily-mounted "Custom agents" submenu — non-obvious,
and it left the sandbox-gating e2e assertion vacuous (the item was never
in the DOM after opening the top-level dropdown regardless of target).
Only fold into the "Custom agents" submenu once custom/pending agents
exist; otherwise surface the create action as a top-level picker row.
This restores discoverability on a fresh server and makes the sandbox
`to_have_count(0)` assertion meaningful.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): compute Smart Routing eligibility from the effective harness
A bundle agent (Polly/Debby) on a routable brain harness shows both the
Smart Routing toggle and the Agent Harness override in the config modal.
Arming routing and then overriding to a non-routable harness (e.g. Cursor)
left eligibility computed from the spec harness, so Save still committed
cost_control_mode_override and the create sent routing "on" for a harness
that can't route — with no visible control to clear it.
Compute eligibility from the effective harness (brain-harness override wins
over the spec harness), and gate cost_control_mode_override on eligibility
at create time as a safety net (also covers a stale "on" left after the
server flag flips off). Add a test for the override -> ineligible path.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e): neutralize agent discovery in create-custom-agent tests
With "Create custom agent" now a top-level picker row only when no custom
agents exist, these tests began failing on the shared e2e_ui server:
sessions left behind by other tests leaked in via the kind=any discovery
scan as discovered custom agents, flipping on the "Custom agents" group and
folding the create action back into a submenu — so the top-level create row
the helper clicks was absent.
Stub the kind=any scan to return no agents (same approach as
test_codex_auth_availability.py) so only the stubbed Claude agent feeds the
picker and the create row renders deterministically at the top level.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): show armed Codex bypass as the Approval value in the gear tooltip
Bypass is now an Approval dropdown option, and the modal's Approval trigger
shows "Bypass approvals & sandbox" when armed. The gear tooltip still split
it into `Approval: <preset>` (often "Default") plus a separate `Bypass: On`
row, implying approvals were still at the preset. Mirror the modal: when
bypass is armed the single Approval row reads "Bypass approvals & sandbox".
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Co-authored-by: omnigent-ci[bot] <294685417+omnigent-ci[bot]@users.noreply.github.com>
* feat(benchmarks): add simulated network delay + per-journey request counts
The benchmark harness runs everything over loopback, so it can't tell a
chatty journey (many round-trips) from a lean one on wall-clock alone, nor
model what those round-trips cost over a real network. Two related knobs
close that gap.
- --network-delay-ms (default 0) injects an httpx request-hook sleep before
every client->server request, modelling a real network hop. benchmark.yml
gains a network_delay_ms dispatch input (0 on the nightly schedule for
stable trend data).
- Every run now reports http_requests / http_requests_per_op: the server-side
HTTP request count over the timed region (schema v4->5). For runner journeys
this captures the cross-process runner->server / host->server traffic a
client hook can't see; for HTTP journeys it's known by construction.
The counter is the server's existing ServerPerformanceMetrics.total_started,
which lives in the server subprocess and is only pushed to OTel. A CI-only
router (dev/benchmarks/omnigent/debug_router.py) exposes it at
GET /debug/server-metrics. It never ships in production: it lives under dev/
(excluded from the wheel), is mounted only via the new debug_router_modules
config key (mirroring the policy_modules load-by-dotted-path seam) that prod
config never sets, and a failed import is logged-and-skipped.
compare.py surfaces a Req/op column so an added/removed round-trip shows up
in the PR comparison. README documents both features and their v1 scope
(client<->server hop only; tunnel frames and LLM hop are follow-ups).
Co-authored-by: Isaac
* docs(benchmarks): note CI time-budget limit for high network delays
A CI dispatch at network_delay_ms=100 over the full journey set hit the
workflow's 30-min per-leg timeout: the delay multiplies across the full-turn
journeys' round-trips (cold start ~12 requests/op; turn journeys poll every
0.2s). Document the empirical budget (10ms finishes in ~6 min; 100ms times
out) and steer high-delay experiments toward an HTTP-journey subset.
Co-authored-by: Isaac
* feat(benchmarks): per-route request appendix + full-width CI table
Two follow-ups from reviewing the request-count output:
- The printed table truncated wide headers ("HTTP/op" -> "HTTP…") in CI logs,
because rich falls back to 80 columns when stdout is not a TTY. Give the
non-interactive console a 160-col floor so every header renders in full;
real terminals keep auto-detection.
- Add a per-journey network appendix so the request count is actionable, not
just a single number. ServerPerformanceMetrics now tallies requests by
low-cardinality route template (record_route, exposed via the debug
endpoint's route_counts); the harness diffs it per journey and the report
gains per-run route_requests plus a summary network_routes breakdown
({route, requests, per_op}, sorted per_op desc, grouped across runs). This
names which endpoints a journey's requests hit — e.g. session_cold_start's
~12 requests/op spread across the cross-process runner->server / host->server
calls — not just the total. The harness's own counter-poll route is filtered
out. Schema v5 -> v6; sample_output.json + README updated.
Co-authored-by: Isaac
* perf(benchmarks): drive warm turns over SSE instead of polling to idle
drive_turn polled GET /v1/sessions/{id} every 0.2s until the session status
returned to idle. That inflated the per-journey request count — normally
~2 GET/op, but ~800/op (124/op averaged) when a turn stalled and the loop
polled out the full 180s timeout, which is what made warm_turn's
GET /v1/sessions/{id} count balloon on the postgres leg.
Switch drive_turn to the SSE completion path the real Web UI uses: subscribe
to GET .../stream, post the message, and return on the session.status -> idle
event (guarded by seen_running so a prior turn's trailing idle can't end the
wait early). One subscription instead of an unbounded poll loop.
Result for warm_turn: a flat 3 requests/op (stream + events + policies/evaluate),
no ballooning when a turn is slow, and it mirrors production client behavior.
Latency is also more accurate — SSE observes completion immediately rather than
at the next 200ms poll tick, so p50 is no longer quantized upward.
_sse_session_status parses both the nested ({"data":{"status"}}) and flat
({"status"}) session.status shapes. Unit test + runner-journeys e2e cover it.
README CI-budget note corrected (turn journeys no longer poll).
Co-authored-by: Isaac
_resolve_harness() routes through _globals._agent_store, which is only
populated when the server starts via the CLI (runtime.init()). In other
deployment paths the global is None, so _resolve_harness silently returns
None and SessionCreatedEvent emits harness: null for SDK sessions.
Fix: in create_session, resolve the harness directly from the in-scope
agent and agent_cache (dependency-injected into every request handler),
which are always populated regardless of how the server starts. This
mirrors the native_agent path for native harnesses and uses the existing
_spec_harness() helper for SDK executor types.
Also adds unit tests for _resolve_harness covering:
- None conv / uninitialized store / agent not found → None
- harness_override wins before any store lookup
- executor config["harness"] key → resolved harness name
- executor.type fallback → resolved harness name
- unexpected exception → None (never raises)
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(credentials): stop mislabeling OAuth Databricks profiles as malformed
The configparser fallback in resolve_databricks_workspace treated any
profile without a static `token` as malformed and told the user to "fix
or remove it". OAuth profiles (auth_type = databricks-cli) legitimately
have no token — only the databricks-sdk path can mint one for them — so
the message was actively misleading, steering users to break a valid
profile.
Distinguish a well-formed OAuth profile (non-`pat` auth_type, no token)
from a genuinely malformed one via a new `_SectionNeedsSdk` signal, and
raise an actionable OSError instead. The message now branches on why the
SDK path failed: if databricks-sdk isn't installed (it ships in the
`databricks` extra, not the base install), it tells the user to install
`omnigent[databricks]`; if the SDK is present but auth failed, it points
at the CLI / OAuth session.
The PAT fail-loud guard (missing token on a token-auth profile) is
unchanged.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(credentials): harden SDK-import check and tailor non-CLI remediation
Address PR review:
- `_databricks_sdk_importable` now does a real `import databricks.sdk.config`
in a try/except instead of `importlib.util.find_spec`. find_spec can return
a spec for an SDK whose transitive deps are missing, and can even raise on a
partial install — both would misroute or escape the error-message branch.
- The `_SectionNeedsSdk` remediation is no longer hard-coded to OAuth. The
signal now carries the section's `auth_type`, and the resolver only suggests
`databricks auth login` for `auth_type = databricks-cli` (OAuth-U2M). Other
SDK-only auth types (azure-cli, metadata-service, oauth-m2m, …) get neutral
wording naming the actual auth_type. The profile is now described as
"token-less ... that only the databricks-sdk can resolve" rather than
unconditionally "OAuth".
Adds a test for the non-databricks-cli branch (azure-cli) asserting the
message names the auth_type and does not misdirect to `databricks auth login`.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* refactor(cli): extract native TUI subcommands into cli_native.py
Phase 0 of making native harnesses pluggable: carve the 11 native
coding-agent subcommands (claude, codex, opencode, pi, cursor, kiro,
goose, hermes, antigravity, qwen, kimi) out of cli.py into a dedicated
cli_native.py so the follow-up registry-driven seam lands in a small,
focused module instead of a 14k-line file. Behavior-preserving.
- New omnigent/cli_common.py holds the decorator-time constants
(RESUME_PICKER_SENTINEL, CLAUDE_STARTUP_PROFILE_ENV_VAR) and
reject_native_on_windows. It is a leaf module (imports nothing from
omnigent.cli), so both cli.py and cli_native.py can import it without a
cycle — required because Click evaluates command decorators at import
time.
- omnigent/cli_native.py exposes register_native_commands(cli), which
cli.py calls at module bottom (after the group and shared launch
helpers exist). Command bodies reach shared cli.py helpers through thin
call-time proxies on the omnigent.cli module, which keeps this module
free of a top-level omnigent.cli import (no cycle) and lets tests that
monkeypatch omnigent.cli.<helper> still take effect.
- polly/debby (bundled example agents, not native TUIs) stay in cli.py,
along with the shared helpers they and the native commands use.
Also drafts designs/harness-modular-registry-proposal.md (the doc the
harness_plugins.py comment already references), which lays out the full
NativeHarnessProvider plan and the phasing this commit begins.
Test plan: tests/cli/test_cli.py (244), test_chat.py/test_import.py/
test_runner_startup.py (137) all pass; ruff format+check and the
pre-commit file hooks pass; `omnigent <tool> --help` renders for all 11.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* refactor(cli): extract config/onboarding subsystem into cli_config.py
Gets cli.py under the 10k-line-per-file budget (13,248 → 9,664). The native
subcommand extraction alone left cli.py well over budget, so move the second
large cohesive block: the interactive harness/credential configuration
subsystem behind `omnigent config` / `omnigent setup` and the first-run
`configure harnesses` picker.
- New omnigent/cli_config.py (~3,650 lines) holds the 63 config helpers:
_configure_harness_add, every _manage_*_harness / _prompt_install_* / _set_*,
the ambient-credential adoption path, node-dependency preflight, and
_run_configure_harnesses_interactive. _CLI_LOGIN_BRAND moves with them (it had
no other user). The config/setup/integration Click commands stay in cli.py.
- The 3 config-load helpers the block needs (_load_global_config /
_save_global_config / _load_effective_config) stay in cli.py (used ~20x each
there); cli_config reaches them through call-time proxies, so importing
cli_config never imports omnigent.cli (no cycle) and monkeypatching
omnigent.cli.<helper> is still honoured.
- cli.py re-imports the 7 config entry points its commands call, so they remain
omnigent.cli attributes (patchable, importable) for callers and tests.
- Tests: repoint references for helpers that are called *intra*-cli_config to
omnigent.cli_config (where patching now takes effect) — the _manage_* dispatch
test, _adopt_detected_providers / _promote_global_auth_to_provider /
_launch_*_configure / _qwen_auth_configured patches, and the opencode / promote
imports. Helpers cli.py itself calls stay patched on omnigent.cli.
Behavior-preserving; no command, flag, or prompt changed.
Test plan: tests/cli/{test_cli,test_configure_models,test_opencode_setup,
test_chat,test_import,test_backend,test_runner_startup}.py all pass; ruff
format+check and pre-commit file hooks clean; cli.py is 9,664 lines.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* refactor(cli): address bot review on native/config extraction
Follow-ups from the PR #3047 bot reviews (Copilot, github-code-quality,
Polly), all behavior-preserving:
- cli_native.py: drop the duplicated --session/--resume validation block in
the codex command (Copilot) — it validated twice; the single pre-backend
check is kept, ordering unchanged.
- cli_native.py: fix the claude --host help text (Copilot) — the flag is a
no-op (del register_host), so the old "Requires --server" help was
misleading. Now marked [DEPRECATED] no-op.
- test_opencode_setup.py: use one import style for omnigent.cli_config
(github-code-quality) — drop the `from ... import` line and qualify the
two calls with the cli_config alias the file already uses.
- cli.py: drop the "(#334)" ticket id from the _run_bundled_agent comment
(Polly / CLAUDE.md "no ticket IDs in comments").
Test plan: tests/cli/{test_opencode_setup,test_cli,test_configure_models}.py
(362) pass; ruff check + format clean; claude/codex --help render.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* feat(projects): session→project membership over HTTP (Phase 1b)
Completes Phase 1 of the projects feature (see designs/PROJECTS_PRD.md) by
linking sessions to first-class projects and exposing it over HTTP. Phase 1a
(#2765) shipped the empty container; this adds the membership pointer and the
move/list surfaces that read it, so no column or store method ships unused.
- Migration c2d3e4f5a6b7 (chained after b1c2d3e4f5a6): nullable project_id
(Uuid16) on omnigent_conversation_metadata + ix_conversation_metadata_project_id.
Additive, no backfill, no DB FK (Rule R032). NULL = unfiled.
- Conversation.project_id on the entity; mapped in _to_conversation.
- ConversationStore.set_conversation_project() (file/move/unfile by id).
- list_conversations(project=<name>) is now a name-based dual-read: a session
is "in <name>" if it has EITHER the first-class membership (metadata.project_id
→ the owner's project of that name) OR the legacy omni_project label. "" =
unfiled. Backward-compatible: with no first-class members the filter collapses
to the prior label-only behaviour. The first-class prefetch is intersected
with the caller's permission-scoped ids so the IN/NOT IN list can't grow past
their own sessions.
- PATCH /v1/sessions/{id} files/unfiles by id (owner-only; target-project
ownership validated → 404, no existence leak); GET /v1/sessions?project=<name>
lists owner-scoped; project_id surfaced on SessionResponse / SessionListItem;
project_store wired into the sessions router; openapi.json regenerated.
- Tests: store membership ops + dual-read (incl. unfiled + cross-DB split-DB);
route move/unfile/list with single- and multi-user ownership boundaries.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): reject null project_id; push unfiled exclusion down in single-DB
Addresses review on #3053:
- PATCH /v1/sessions/{id}: an explicit JSON ``null`` for project_id used to
coerce to "" and silently unfile the session, contradicting the contract
(omit = unchanged, "" = unfile). Reject null with 400 so only "" unfiles.
- list_conversations(project=""): in single-DB mode (metadata colocated with
conversations) push the first-class exclusion down as a NOT IN subquery
instead of materializing every filed id into Python. Split-DB keeps the
bounded prefetch. Caps memory for single-user / unscoped callers.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): unfile-path 404 parity, single-DB IN subquery, doc null vs omit
Addresses the second review pass on #3053:
- PATCH /v1/sessions/{id}: the unfile branch (project_id == "") ignored
set_conversation_project()'s return, so unfiling a session with no metadata
row reported 200 while the file path returns 404. Check the result and raise
404 for parity.
- list_conversations(project=<name>): mirror the unfiled-branch optimization —
in single-DB mode use the member SELECT as an IN subquery instead of
materializing member ids into Python; split-DB keeps the bounded prefetch.
- UpdateSessionRequest.project_id docstring: distinguish omit (unchanged) vs
null (rejected 400) vs "" (unfile); regenerate openapi.json.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
The coverage-report job used `!cancelled()`, so it ran even when one or
more pytest shards failed. A failed shard drops its covered lines from the
`coverage combine`, so the resulting total is computed off partial data and
compared against main's baseline — misleading. A red pytest run gets re-run
anyway, which re-triggers coverage, so there's no value in computing it now.
Gate on `success()` so coverage-report only runs when every pytest shard is
green. The draft guard stays: on drafts pytest is skipped, and a skipped
dependency doesn't make `success()` false.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(projects): first-class projects entity + CRUD container
Promote "projects" from the implicit ``omni_project`` conversation label to a
first-class, owner-private container that groups sessions and exists
independently of its members — so it can be empty, renamed, and (later) carry
its own config. See designs/PROJECTS_PRD.md.
This is Phase 1a — the container only: create / list / rename / delete empty
projects. Session->project membership (the conversation_metadata.project_id
column, conversation-store plumbing, dual-read listing) and the session-move
HTTP surfaces are Phase 1b (a follow-up), so this PR ships no column or store
method that nothing consumes yet.
- projects table (SqlProject): Uuid16 id, name, owner_user_id, created_at,
updated_at. ix_projects_owner_user_id (workspace_id, owner_user_id,
created_at, id) serves the owner-scoped list ordered by created_at as a pure
index scan; UNIQUE (workspace_id, owner_user_id, name) enforces per-owner
name uniqueness at the DB layer for non-NULL owners (the store's _name_taken
check guards NULL-owner / single-user rows).
- Migration b1c2d3e4f5a6 creates the table only; additive, no backfill,
no DB foreign keys (Rule R032).
- Project entity; ProjectStore + SqlAlchemyProjectStore (owner-scoped CRUD;
IntegrityError -> ALREADY_EXISTS as the uniqueness-race backstop).
- POST/GET/PATCH/DELETE /v1/projects, owner-scoped; wired into create_app +
CLI; schemas + openapi.json regenerated.
- Tests: store CRUD + owner isolation + name uniqueness (incl. DB backstop);
route CRUD (single- + multi-user header auth); entity.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(projects): discriminate name-UNIQUE violation before mapping to ALREADY_EXISTS
The create()/update() IntegrityError handlers translated *any* integrity
failure into an ALREADY_EXISTS name collision, which could hide unrelated
problems (a PK collision on id, a NOT NULL violation) behind a misleading
409/"already exists". Add _is_name_conflict() to translate only when the
per-owner name-UNIQUE index was hit and re-raise everything else. It matches
both dialect signatures: Postgres names the index (ix_projects_name), SQLite
lists the columns (projects.name).
Also add a regression test proving a non-name integrity failure (PK reuse)
re-raises as IntegrityError, and tidy the list-order assertion to a set
membership check.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
An abrupt browser disconnect tears the dictation WebSocket's ASGI task
down via cancellation. The cleanup in the finally block awaited
handle.close() inside the already-cancelled scope, so the cancellation
fired at the await before the close ran — leaking the take. For the
remote engine this leaks a worker capacity slot until the connection
dies. contextlib.suppress(Exception) did not help: anyio cancellation is
a BaseException, and suppressing it only hides the traceback while the
close is still skipped.
Wrap the close in a shielded anyio.CancelScope so cleanup always
completes before the outer cancellation resumes.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* feat(host): add install-harness tunnel frame pair + registry plumbing
Adds the HostInstallHarnessFrame / HostInstallHarnessResultFrame pair to
the host tunnel protocol, mirroring the existing HostCreateDirFrame
request/result pattern, plus the pending_installs future map on
HostConnection. This is the vocabulary the server and a connected host
use to negotiate a UI-driven harness install (later PRs add the host
handler, the route, and the frontend button).
Additive only: no frame is sent or received yet, so behavior is
unchanged. The result frame carries a freshly-recomputed readiness map
(configured_harnesses, reusing _optional_str_availability_map) so the UI
can flip the harness badge without waiting for a reconnect.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* refactor(onboarding): surface install failure reason from install_harness_cli
Extracts install_harness_cli_with_reason(key) -> tuple[bool, str | None]
alongside the existing install_harness_cli(key) -> bool, which becomes a
thin wrapper that discards the reason. Single implementation, no caller
churn: the four setup-wizard call sites keep their boolean contract
unchanged.
The reason is derived from the existing failure branches (manual-only
spec, missing installer, timeout, OS error, non-zero exit, post-install
binary-not-found) without capturing installer output — so omni setup's
live npm output UX is preserved. A later PR's UI-driven install returns
this reason to the user instead of a bare failure.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(host): install harness on request + resolve the install result
Adds the host daemon side of UI-driven install:
- _handle_install_harness in host/connect.py runs
install_harness_cli_with_reason off the event loop, recomputes
configured_harness_map(), and returns a HostInstallHarnessResultFrame
carrying either the fresh readiness map or a failure reason.
- host_tunnel.py's receive loop resolves the pending_installs future.
- A shared allowlist/resolver (ui_installable_harnesses / ui_install_key)
in onboarding/harness_install.py is the single source of truth for
which harnesses are UI-installable (claude, codex, pi, opencode, qwen)
and their install-spec keys.
Defence in depth: the handler re-checks ui_install_key, so a stray or
spoofed frame can never drive the installer for a non-allowlisted
harness (e.g. hermes, whose installer is a curl | bash). Inert until PR4
wires a sender: nothing emits HostInstallHarnessFrame yet.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(server): add UI harness-install route behind a default-off flag
Adds POST /v1/hosts/{host_id}/harnesses/{harness}/install: the server
endpoint the web UI's Install action calls. It validates in order —
feature flag (404 when off) -> allowlist (400) -> auth/require_user ->
owner (403) -> liveness (409) — then forwards a HostInstallHarnessFrame
over the tunnel via _proxy_install_harness and returns the host's
refreshed configured_harnesses map.
- Reuses the _proxy_create_dir request/future/wait_for template; the
install timeout (330s) sits above install_harness_cli's 300s subprocess
ceiling so the result is received before the server gives up.
- Concurrent installs of the same (host, harness) coalesce onto one
in-flight task (conn.inflight_installs) so a double-click can't fire two
non-race-safe global npm installs.
- Gated by OMNIGENT_HARNESS_INSTALL_ENABLED, surfaced to the SPA via
GET /v1/info (harness_install_enabled), mirroring smart_routing_enabled.
Allowlist ordering (400 before 403) avoids leaking host ownership through
error codes. Ships dark: with the flag off the route is 404, so merging
this changes nothing in production.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(host): make UI install idempotent + widen the server wait
End-to-end testing against a real host surfaced two issues the stubbed
unit tests masked:
- The host ran `npm install -g` even when the harness CLI was already on
PATH; npm re-resolves over the network and took >60s for an
already-present binary, so a repeat Install click hung. _handle_install_harness
now short-circuits on harness_cli_installed(key) and just returns fresh
readiness (reusing the existing check) — sub-second on the happy path.
- The server's per-call wait (330s) sat only 30s above install_harness_cli's
own 300s subprocess cap, so a genuine cold npm install could finish right
as the server gave up — a "504 but actually installed" outcome. Widened
to 420s (300s + 2min headroom for readiness recompute + tunnel latency).
Verified end-to-end: happy path 200 in 0.8s (already-installed fast-path),
a real cold opencode install completes route->tunnel->daemon->npm->readiness,
hermes rejected 400, codex reports needs-auth post-install.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* chore(openapi): regenerate spec for the harness-install route
CI's openapi-drift guard flagged openapi.json as out of sync after the
new POST /v1/hosts/{host_id}/harnesses/{harness}/install route. Regenerated
via scripts/dump_openapi.py so the committed spec matches the app.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* refactor(server): share the harness-install flag env-var name
Extract OMNIGENT_HARNESS_INSTALL_ENABLED into a single
HARNESS_INSTALL_ENABLED_ENV constant in hosts.py, read by both the
install route and the /v1/info flag in app.py, so the flag the UI sees
and the flag the route enforces can never drift on a typo. Also switch
the install-task scheduling from asyncio.ensure_future to the more
idiomatic asyncio.create_task.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(server): describe per-harness setup steps for the UI setup flow
Extends the harness-install backend so the web UI can render a "set up this
agent" checklist that mirrors omnigent setup, instead of a single Install
button.
- /v1/harnesses now carries an ordered setup_steps list per harness (install,
then auth), derived from the existing HarnessInstallSpec so it can't drift
from the real install/login commands. Claude/Codex/Pi/OpenCode/Qwen get a
first-class two-step flow; other harnesses get a generic "run omnigent setup"
step.
- The host readiness map now reports a two-step signal (binary-missing /
needs-auth) for Claude and OpenCode too, matching Codex, so the UI can show
install-done vs sign-in-done. Pi/Qwen stay binary-only (their credential
isn't locally determinable).
- The launch gate (harness_is_configured) is unchanged and stays binary-only,
so a not-signed-in harness is never blocked from launching.
- /v1/info advertises installable_harnesses (bare + native spellings) so the
UI offers setup only where the install route will accept it.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* feat(server): key harness setup steps by every spelling for the UI
The setup dialog looks up steps by the harness a session declares — often a
native wrapper (codex-native) or an installable id that isn't a picker row
(opencode/qwen), none of which appear in the harness catalog. Add
harness_setup_steps_by_spelling() and return it from GET /v1/harnesses as a
top-level setup_steps map so the dialog can resolve steps for whatever id it
holds, without adding non-pickable rows to the catalog.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(server): use host.user_id in the install route's owner check
The install route still compared host.owner, but the Host model's owner field
was renamed to user_id (identity-columns unification on main). An authenticated
install therefore 500'd with AttributeError. Switch to host.user_id (matching
every other host route) and add an owner-mismatch test that exercises the
ownership branch with a real user_id — the existing tests run unauthenticated,
so the comparison was never hit.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* docs(server): correct the setup-step "can't drift" comment
The auth-step commands (codex login, etc.) are display-only literals, not
derived from HarnessInstallSpec.login_args — only the install step's label is
derived. Reword the comment/docstring so they don't overstate the guarantee.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* Address review: family-keyed install coalescing + clearer naming
- Coalesce concurrent UI installs on the resolved install *family* key
(ui_install_key) rather than the raw spelling, so codex + codex-native
(both the openai npm package) share one in-flight install. Cleanup is
tied to task completion via add_done_callback and every caller awaits
under asyncio.shield, so a cancelled request can't clear the map out
from under a follow-up and start a second concurrent `npm install -g`.
- Add an integration test that fires two overlapping same-family installs
and asserts exactly one frame reaches the host.
- Rename install_harness_cli_with_reason -> try_install_harness_cli and
return a HarnessInstallResult NamedTuple instead of a bare tuple.
- Trim the over-long install-handler docstring and UI-installable map
comment to the essentials.
Co-authored-by: Isaac
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
---------
Signed-off-by: xq-yin <xiaoqian.yin@databricks.com>
* fix(web): don't queue messages while only background work is running
A session with a running background job (background shell / still-running
sub-agent) settles into the `waiting` status: the turn already ended and the
server's turn gate is free to accept a new turn, but the frontend treated
`waiting` as busy and queued every new message client-side until full idle.
Two independent gates forced this:
- `shouldQueueSend` / `maybeFlushQueuedHead` treated `sessionStatus ===
"waiting"` as busy, so sends queued and the queue wouldn't drain.
- The `session_status` handler grouped a `waiting` edge carrying a
`response_id` (which the claude/cursor-native Stop hook always posts) with
`running`, forcing local `status = "streaming"`, which never cleared while
background work ran. The composer's "(queued)" placeholder and the send gate
both key off local `status`, so this alone kept messages queued on native
sessions.
Treat `waiting` as a turn-end edge everywhere it gates sends: drop it from the
busy checks and finalize the local send lifecycle like `idle`, while keeping
`sessionStatus = "waiting"` and `backgroundTaskCount` so the "Working…" spinner
and sidebar dot still reflect the background activity. A new message now starts
a fresh turn immediately, matching what the server already accepts.
This only affects sessions with background work running — a turn that ends with
no background work still settles on `idle` and behaves exactly as before.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): treat waiting as turn-end on reconnect; add e2e coverage
Address the Polly review notes on the message-queueing fix and add the
e2e_ui coverage the required gate asks for.
- `reconnectStatusPatch`: a `waiting` snapshot is a turn-end edge, so it now
finalizes the local send lifecycle like `idle` instead of reopening a
streaming response. The server keeps `active_response_id` populated across
`waiting` (it only pops on idle/failed), so grouping `waiting` with
`running` re-opened "streaming" on a reload/reconnect and re-queued sends —
the exact behavior the fix removes. Now covered for the reloaded-tab path,
not just live SSE.
- The live-SSE mismatched-id `waiting` branch now finalizes a still-streaming
bubble to `completed`, matching the matching-id path, so a stale bubble
doesn't linger spinning with no edge left to close it.
- Add tests/e2e_ui/chat/test_send_while_background_task.py: publishes the
native Stop-hook `waiting`+response_id edge live, then asserts the composer
sends directly (idle placeholder, user bubble renders, no queued strip)
instead of queueing behind the background task.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Replace M individual session.get() PK lookups + M individual UPDATEs
with a single IN-clause query to fetch existing to_user grants, then
one bulk DELETE for duplicates and one bulk UPDATE for reassigns.
For M grants this reduces the query count from 1 + M + up to M = 1+2M
down to 3 queries regardless of M.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* perf(store): batch FTS inserts in append and fork_conversation
Each call to insert_fts issued a separate raw SQL INSERT into the
conversation_items_fts table, causing N+1 queries when appending or
forking conversations with many items.
Add insert_fts_bulk(session, rows) in omnigent/db/utils.py that issues
a single multi-row INSERT for any number of rows. Replace the per-item
insert_fts calls in append and fork_conversation with a single
insert_fts_bulk call after the loop. Keep insert_fts intact for
single-item callers.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(db): chunk insert_fts_bulk to avoid SQLite variable limit
Split rows into chunks of 300 (3 params × 300 = 900 binds) so a
single INSERT never exceeds SQLite's SQLITE_MAX_VARIABLE_NUMBER (999
on pre-3.32 builds). Without chunking, fork_conversation on a large
conversation raises OperationalError: too many SQL variables.
Also add the list[tuple[str, str, str]] annotation to fts_rows in
fork_conversation to match the append call site.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Skipping unresolvable function policies left an empty gate that allowed
every tool call. Install a deny sentinel instead so a misconfigured
policy cannot disappear silently.
Signed-off-by: SabhyaC26 <sabhyachhabria@gmail.com>
Reintroduce the remote path split out of the initial dictation PR, now as
a registered engine rather than a special-cased branch.
- Register a `remote` engine (OMNIGENT_DICTATION_ENGINE=remote) that relays
each take to a dictation worker over the same wire protocol the browser
speaks. Selected purely by env var — OMNIGENT_DICTATION_REMOTE_URL points
at the worker; no CLI integration, keeping the surface small for a niche
deployment (weak main server + a beefier LAN box).
- Ship the standalone worker (python -m omnigent.server.dictation_worker):
create_dictation_router served on its own, unauthenticated, LAN-only.
- Per-take fallback to the local sherpa engine (lazy) when the worker is
unreachable and models are installed.
- Widen the web client's ready/stop timeouts to outlast the worker's
cold-load budget.
websockets is already a core dependency, so no new package. The engine slots
into the registry with no changes to the route, protocol, or selection logic.
Co-authored-by: Isaac
Signed-off-by: kerry.chang <kerry.chang@your.hostname.com>
Co-authored-by: Ubuntu <kerry.chang@your.hostname.com>
* feat(scheduled tasks): track run completion + expose run history
The fire path records a scheduled_task_runs row as `running` and never
revisits it, so runs stayed `running` with finished_at=NULL forever even
after the agent turn completed (the FU-1 gap confirmed in prior E2E).
list_runs also existed in the store but was exposed by no REST route.
Add a periodic reconciliation backstop + run-history endpoint:
- Store `update_run` (conditional WHERE status=running, idempotent — an
already-terminal run is never clobbered and concurrent sweeps can't
double-transition) and `list_runs_by_status_all_workspaces` (the sweep
source). ScheduledTaskRun entity now carries workspace_id so the sweep
can re-enter each run's workspace_scope.
- `run_reconciler.py`: a 60s asyncio loop (own module, off the
ScheduledTaskScheduler) that reads each running run's conversation and
transitions it — completed transcript -> succeeded; a failure label /
missing conversation -> failed(code); live_status running/waiting is a
cheap pre-filter. A run past a 6h max-age with no terminal state is
force-failed (error_code=incomplete) so every run eventually terminates.
Wired into the server lifespan next to the scheduler.
- `GET /v1/scheduled-tasks/{id}/runs`: owner-scoped run history (404 if
not owned), API-stable field naming.
No schema/migration change — status codec already had succeeded/failed and
the columns (finished_at/error/error_code) already exist. FU-3 + #2978
semantics intact (owner via user_id; API-stable owner_user_id JSON key).
Tests: update_run transitions + idempotency; reconciler classification
matrix (completed->succeeded, errored/cancelled->failed, in-flight and
young runs left alone, stale->failed(incomplete)); GET runs 200/empty/404.
Full targeted suite green (155). E2E on a live server + connected host:
a real timer fire's run flipped running->succeeded with finished_at set
(the exact thing that stayed running before), readable via the runs
endpoint; honest-fail still records failed(no_online_host) and the sweep
leaves terminal runs untouched.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled tasks): make run completion event-driven (replaces poll)
Replaces the 60s all-workspaces reconciliation poll from the previous commit
with an event-driven completion hook + a poll-free orphan backstop, matching
how the sibling scheduled-task systems reconcile (at a lifecycle boundary, not
on a timer).
Primary mechanism: a completion hook
(``session_live_state.persist_scheduled_run_completion``) fired from
``_publish_status`` the instant a fired conversation's turn reaches a terminal
edge (idle -> succeeded, failed -> failed+error_code). It rides the same
long-lived SSE relay that already persists ``live_status`` for a browserless
scheduled fire, routed through the same ordered/contextvar-copying executor so
the run's ``workspace_scope`` reaches the write thread. A reverse lookup
(``get_running_run_by_conversation``, backed by a new
``(workspace_id, conversation_id)`` index) finds the run; the idempotent
conditional ``update_run`` (WHERE status=running) transitions it and never
clobbers an already-terminal row. For the common (non-scheduled) conversation
the lookup returns None and the hook is a cheap no-op.
Orphan backstop (no periodic poll): the ``ScheduledRunReconciler`` becomes a
ONE-SHOT startup sweep (reconciles runs left ``running`` by a restart
mid-fire), and a lazy-on-read pass at ``GET /v1/scheduled-tasks/{id}/runs``
force-fails a task's runs past the 6h max age (``incomplete``). Together they
keep the invariant "every run eventually reaches a terminal state" without a
recurring background sweep.
One migration: the ``conversation_id`` index. FU-3 / #2978 owner semantics,
the ``GET /runs`` response shape, and the fire-time ``_record_run`` writes are
unchanged.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* refactor(scheduled tasks): drop startup sweep, lazy-on-read is sole backstop
Simplifies the orphan backstop per review. The event hook already transitions
every normal run the instant its turn ends; the boot-time startup sweep is
removed entirely (fewer moving parts). A run orphaned by a mid-fire restart
that nobody ever opens staying `running` in the DB is harmless until read, and
reading it fixes it.
Changes:
- Remove `run_startup_sweep`, the `ScheduledRunReconciler` class, and its
lifespan wiring in app.py. `run_reconciler.py` reduces to the stale-run
policy: the constants + a shared `force_fail_stale_runs` helper (pure
age-based, no conversation I/O).
- Run the lazy force-fail-stale reconcile on BOTH read endpoints:
- `GET /v1/scheduled-tasks/{id}/runs` (detail, already there).
- `GET /v1/scheduled-tasks` (list, ADDED) — force-fail the owner's tasks'
runs still `running` past 6h so a Tasks-list badge never shows a stale
orphan as `running`. Owner-scoped indexed query
(`list_running_runs_for_tasks`), conditional `update_run`, no per-run
conversation read.
- Drop the now-unused `list_runs_by_status_all_workspaces` store method.
Net mechanism: (a) event hook = primary, instant terminal transition;
(b) lazy-on-read force-fail-stale on list + detail = the only orphan backstop.
No startup sweep, no periodic poll of any kind. Keeps the 6h
STALE_RUN_MAX_AGE_SECONDS invariant "every run eventually terminal".
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* refactor(scheduled tasks): drop dead ScheduledTaskRun.workspace_id field
The ``ScheduledTaskRun`` entity carried a ``workspace_id`` field solely so the
cross-workspace reconciler sweep could re-enter each run's ``workspace_scope``
before acting on it. That sweep is gone — completion is event-driven and the
lazy-on-read backstop both run inside a single ambient ``workspace_scope`` — so
the field has no reader. Its only consumer was the deleted ``_reconcile_run``.
Remove the field from the entity dataclass and drop the ``workspace_id=`` line
in ``_run_to_entity``. The DB column ``scheduled_task_runs.workspace_id`` (the
real tenant partition key) and its index are unchanged; the store still filters
every query on ``current_workspace_id()``.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* refactor(scheduled tasks): PR polish — comment fix, fired_at age basis, hook wiring test
Addresses three review findings on the FU-1 run-completion PR:
- Fix a stale finally-block comment in app.py: it still said the run reconciler
is "a one-shot startup sweep (no periodic task to cancel)", but the startup
sweep was removed — completion is event-driven + lazy-on-read, so there is no
reconciler task at all. Comment now says only the per-job scheduler needs
stopping. The scheduled_task_scheduler.stop() logic is unchanged.
- Measure the lazy-on-read stale window from fired_at (falling back to
scheduled_at when a run never recorded a fire time), not scheduled_at. A run
that fired late no longer gets a shortened effective window — the 6h clock
starts when dispatch actually began. Locked by two unit tests: a run fired
>6h ago is force-failed; a run scheduled >6h ago but fired recently is left
alone.
- Add integration coverage for the primary completion mechanism at the
_publish_status seam: drive the real _publish_status(conversation_id, "idle")
/ "failed" edge (the way the SSE relay does) and assert the scheduled_task_run
transitions running -> succeeded / failed(+error_code) with finished_at set,
through the hook + shared session_live_state executor (workspace_scope
contract exercised, not bypassed). This locks the wiring so a future
_publish_status refactor can't silently break scheduled-run completion.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(server): streaming dictation endpoint (local speech-to-text)
Adds WS /v1/dictation/stream + GET /v1/dictation availability probe,
backed by a lazily-loaded sherpa-onnx streaming transducer (new
optional extra: omnigent[dictation]) with optional online
re-punctuation. Fills the gap documented in web/electron/README.md:
dictation where the browser Web Speech API has no backend, with audio
never leaving the operator's infrastructure.
A deterministic fake engine (OMNIGENT_DICTATION_ENGINE=fake) keeps CI
hermetic and will drive the Playwright e2e test.
See designs/server-dictation.md.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(web): stream server dictation into the composer mic button
When the browser has no Web Speech backend (Electron, Firefox,
Chromium), the mic button now falls back to the server recognizer:
GET /v1/info advertises dictation_available, an AudioWorklet
downsamples the mic to 16 kHz PCM over WS /v1/dictation/stream, and
partial transcripts form live in the composer via a replaceable
interim region (useDictationInsert) shared by ChatPage and
NewChatDialog. Web Speech behavior is unchanged where it works.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(e2e-ui): dictation loop against the fake engine
Fake mic (Chromium fake media device) -> AudioWorklet -> dictation WS ->
OMNIGENT_DICTATION_ENGINE=fake -> transcript lands in the composer.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: ruff format + regenerated openapi.json for dictation routes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: prettier formatting
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* test(e2e-ui): honor plugin context args in the dictation test
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor: drop the caller-less GET /v1/dictation probe
ponytail review: the web UI only reads dictation_available from
GET /v1/info, so the dedicated probe endpoint had no caller. Also
simplify the engine singleton (config never changes mid-process;
tests inject engine_provider) — a failed load still caches nothing,
so gaining models doesn't require a restart.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: hardware sizing table for dictation models
Measured on Apple M-series and an Intel N95 mini-PC: the default
Nemotron 0.6B is too slow for N95-class servers (0.6-0.7x realtime);
the mid-size streaming zipformer decodes 1.4-2.3x realtime there in
~190 MB and held accuracy in spot checks.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(server): remote dictation worker relay with local fallback
OMNIGENT_DICTATION_REMOTE_URL relays takes to a dictation worker on a
beefier LAN box over the existing wire protocol; local models (when
installed) serve as a lazy fallback when the worker is down. Ships a
standalone single-route worker entrypoint
(python -m omnigent.server.dictation_worker). Motivated by real
hardware: an N95 main server decodes the default 0.6B model at only
0.6x realtime, but a workstation on the same LAN runs it at 9x.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(deps): pin sherpa-onnx-core + numpy explicitly in the dictation extra
sherpa-onnx's wheel metadata declares its native payload package
(sherpa-onnx-core, which carries libonnxruntime) inconsistently across
platforms, so it was missing from uv.lock — failing the hashed OSV
audit in CI and breaking aarch64 installs. Pinning it explicitly fixes
both and removes the fetch script's aarch64 fixup. numpy is imported
directly by the engine, so declare it instead of riding transitives.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix: harden dictation take lifecycle (adversarial review findings)
Server: the route now closes the engine stream handle on every exit
path — an abandoned take (browser vanished mid-dictation) previously
leaked the remote relay's worker WebSocket and reader thread, holding a
worker capacity slot forever and eventually starving dictation for
everyone.
Web client, all confirmed by review:
- useDictationInsert strips the interim region only when the draft
still ends with the exact text it inserted, so dictation can never
delete user-typed text; ref bookkeeping moved out of the setState
updater (StrictMode double-invokes updaters).
- The worklet flushes its partial chunk before stop() tears the graph
down — trailing speech under the 100 ms boundary was being clipped
from every take.
- Client ready/stop budgets now exceed the server's cold-load and
worker-flush budgets (40 s / 15 s), so slow first takes and slow
tail flushes no longer fail or drop text spuriously.
- The 1013 at-capacity close surfaces as "busy — try again" instead of
"unavailable", and engine-init error frames surface their message.
- A socket close during audio-graph setup now fails the start instead
of resolving a dead session that silently drops all audio.
- Web Speech network-error fallback is per take, not sticky: a
transient blip in real Chrome no longer permanently downgrades the
page to the server model, and stale events from the dead recognizer
can no longer clobber the live server take's state (which could
leave the mic recording while the button showed idle).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* docs: dictation model choices for other languages
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore(web): format dictation files
* fix(server): close dictation takes even when the task is cancelled
An ASGI server cancels the websocket handler task on shutdown. The
cleanup awaited asyncio.to_thread(handle.close) inside finally, so the
CancelledError could arrive before the worker thread ran close() --
about half the time, measured. contextlib.suppress(Exception) never
caught it: CancelledError is a BaseException.
Create the close task before the first await point and shield it, so it
runs to completion while cancellation propagates. Hold a strong ref
(asyncio keeps only a weak one) and retrieve the result so a failing
close logs instead of warning.
Also corrects the comments: an abandoned take is reaped by the ASGI
server's ping timeout (~20s), not held forever. Verified against a live
worker with OMNIGENT_DICTATION_MAX_STREAMS=1.
* refactor(dictation): split out remote, add engine registry, fold beautify
Keep this PR focused on local dictation and make future model swaps cheap:
- Defer the remote worker (RemoteDictationEngine, dictation_worker.py, and
the close-on-cancel machinery that existed to release a worker slot) to a
follow-up PR. Remote only helps a narrow deployment; local sherpa runs at
many-times realtime on any normal machine, so this does not block testing.
- Select engines by name from a registry (register_engine); get_engine and
engine_availability resolve from it instead of an if/elif ladder. Adding
an engine is one call with a factory + availability probe.
- Fold punctuation into the sherpa engine and drop beautify from the
DictationStreamHandle protocol. Emitted text is display-ready, so the
seam is PCM-in -> text-out -> close; models that punctuate themselves
(Whisper, Parakeet) implement nothing extra.
Co-authored-by: Isaac
* chore: re-trigger CI checks
Empty commit to re-run the security scan and CI on this PR.
Co-authored-by: Isaac
* build(deps): minimize dictation lock diff to sherpa-only, public index
The merge re-lock rewrote every uv.lock URL to the Databricks internal
index proxy and would fail the public-registry lint. Restore public
pypi.org / files.pythonhosted.org URLs so the lockfile diff versus main
is only the two dictation packages (sherpa-onnx, sherpa-onnx-core), with
no unrelated churn.
Co-authored-by: Isaac
* fix(web): sync ServerInfo test fixtures with merged capability fields
The main merge made single_user/sharing_mode/public_sharing_enabled
required on ServerInfo while dictation_available became required from this
PR, but four test fixtures each construct a ServerInfo literal missing the
other side's fields, failing tsc (and the web build via Docker/E2E-UI).
Add the missing fields so every fixture is a complete ServerInfo.
Co-authored-by: Isaac
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Ubuntu <kerry.chang@your.hostname.com>
Idle shutdown was terminating runners while sys_call_async results were
still in flight because has_active_work only checked foreground/harness
turns. Keep the runner alive for live async tasks, timers, and parked
approvals without pinning on completed or housekeeping work.
Signed-off-by: SabhyaC26 <sabhyachhabria@gmail.com>
Malformed JSON previously fell through to {}, which could run a
default/no-argument system tool. Require a JSON object and return the
canonical structured error before dispatch.
Signed-off-by: SabhyaC26 <sabhyachhabria@gmail.com>
Descriptions told the model to cancel with task_id while dispatch already returned handle_id. Align schemas/messages on handle_id and keep task_id as an identical compatibility alias scheduled for removal in 0.8.0.
Signed-off-by: SabhyaC26 <sabhyachhabria@gmail.com>
_COMPACT_LOCKS existed but was never acquired, so concurrent compact
events could both observe idle and run at once. Hold a WeakValueDictionary
lock per session, recheck status after acquire, and cover the race with a
deterministic concurrency test.
Signed-off-by: SabhyaC26 <sabhyachhabria@gmail.com>
Per-parent child-title uniqueness was enforced by a UNIQUE index on
(workspace_id, parent_conversation_id, title_hash), where title_hash was a
16-byte sha256(title)[:16] mirror of title maintained solely to key that
index. Reads never used it (the runner's find-or-create pre-check filters
title, whose 3rd index column was title_hash), so it was pure write
amplification.
Move the check into create_conversation: a per-parent (parent, title)
existence SELECT served by idx_conversations_parent, raising
NameAlreadyExistsError on a hit. Only children are scoped; top-level (NULL
parent) sessions may reuse titles freely, as before. Drop the index, the
title_hash column, the two hash helpers, the _CKSUM16 alias, the ORM default
and the two rename-path recomputes, and the store's IntegrityError->title
translation (the id-PK branch stays).
Trade-off: the DB index was the atomic backstop for concurrent same-name
spawns (tool calls dispatch concurrently within a turn). The app check is
best-effort, so a rare concurrent duplicate spawn now yields a stranded
duplicate child + a wasted runner instead of a clean error. Bounded, not
corruption; the common repeat-send path is unaffected (served by the runner
pre-check).
Migration 72e6dceae14f. SQLite drops/recreates idx_conversations_parent by
hand around the batch rebuild so its DESC ordering survives; MySQL/Postgres
use native DROP COLUMN. Downgrade re-adds title_hash, back-fills it in
Python, and restores the unique index.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
Runners were reported to be "randomly dying" with no explanation in the
runner log — an uncaught exception left only a bare traceback on stderr,
and orderly shutdowns (signal, idle timeout, tunnel drop, parent death)
logged nothing at all.
Attribute the exit on each hookable path so the runner log always says
why it stopped:
- uncaught exceptions via sys.excepthook (with traceback) — the
silent-crash case
- SIGTERM/SIGINT, recording the specific signal
- idle timeout, websocket tunnel close, and the parent-death hard-exit
backstop (logged at the os._exit call site, which skips atexit hooks)
- fatal server rejection keeps its concise stderr message
SIGKILL and os._exit remain uncatchable in-process; the absence of an
exit line is itself the signal that the runner was killed uncatchably.
Co-authored-by: Isaac
Replace M individual session.get() PK lookups + M individual UPDATEs
with a single IN-clause query to fetch existing to_user grants, then
one bulk DELETE for duplicates and one bulk UPDATE for reassigns.
For M grants this reduces the query count from 1 + M + up to M = 1+2M
down to 3 queries regardless of M.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
When deleting a conversation with N descendants, each FTS row was
deleted in a separate DELETE statement. Replace the per-ID loop with
a single DELETE ... WHERE conversation_id IN (...) via the new
delete_fts_by_conversation_ids helper. The single-ID function is
kept intact for other callers.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(telemetry): track sdk harness name in SessionCreatedEvent
SDK sessions (claude-sdk, openai-agents, codex, etc.) previously emitted
`harness: null` on the SessionCreatedEvent because only native agents have
a `native_agent.harness` attribute. Fall back to `_resolve_harness(conv)`,
which already handles harness_override and spec lookup, so every harness
kind is now represented in telemetry.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* feat(session-ui): support HTTP headers on MCP servers in session UI
Adds the ability to set, view, and edit HTTP headers (e.g. Authorization)
on HTTP-transport MCP servers through the session agent info panel.
Backend:
- MCPServerSummary now includes a headers field; values are always
[REDACTED] in API responses (only key names are exposed).
- UpsertMCPServerRequest accepts headers: dict[str, str] | None.
None preserves existing headers; {} clears them.
- New _apply_headers() helper replaces the old _preserve_keys() call for
headers so edits via the UI actually take effect rather than always
restoring the bundle's headers.
- Fixed sessions.py and builtin_agents.py MCPServerSummary construction
to populate headers (previously always returned {}), which caused
headers to disappear when reopening the edit dialog.
Frontend:
- McpFormState/UpsertMcpServerInput/McpServerSummary all carry headers.
- McpServerManagerDialog shows a key-value editor for HTTP headers
(add row with +, remove with x, values show as [REDACTED] for
existing headers).
- Fixed AgentInfoButton popover closing when the MCP manager Dialog
opens: uses onInteractOutside/onFocusOutside on PopoverContent to
suppress Radix's outside-click dismiss while a nested dialog is open.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(create-agent): accept KEY: VALUE format in headers textarea
parseKVLines only split on '=' so users typing the natural HTTP header
format (Authorization: Bearer ...) got silently dropped. Now accepts
both '=' and ':' as separators, taking whichever comes first.
Updated the placeholder to show the colon form.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(mcp-headers): preserve real secrets when [REDACTED] sent on edit
When a user opens the MCP server edit dialog, header values come back
as [REDACTED] from the API. If they save without changing those values
the client sends { Authorization: '[REDACTED]' }, which was being
written literally into the bundle YAML — overwriting the real token.
_apply_headers now treats a value equal to the '[REDACTED]' sentinel
for an existing key as 'preserve the stored value', restoring it from
the existing bundle entry instead of writing the placeholder.
Also reverts unrelated package-lock.json churn and adds a round-trip
integration test covering the edit-with-existing-headers scenario.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* chore: regenerate openapi.json for MCP headers fields
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(mcp-headers): send {} to clear headers when all rows removed
When editing a server and removing all header rows, the frontend was
sending null (preserve) instead of {} (clear), so stale auth tokens
were silently kept in the bundle.
null now only means 'preserve' for new servers (no originalName).
Editing an existing server with zero rows sends {} to explicitly clear.
Adds integration test covering the clear-all path.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Bump the SDK-proxy harness subprocess and native CLI pane idle-reap
defaults from 30 minutes to 1 hour so short lulls between turns don't
tear down live sessions. Both defaults intentionally mirror each other;
the runner-level watchdog was already at 1 hour, so it now consistently
outlives the inner reapers it contains. Both remain env-overridable.
Co-authored-by: Isaac
* perf(web): lazy-load Shiki so it leaves the main bundle
Shiki's engine (including its WASM regex engine) was pulled into the app's
main entry chunk even when no code block ever rendered. Two eager importers
kept it there: code-block.tsx and the @streamdown/code highlighter plugin
wired into chat markdown via streamdown-security.ts.
Defer both. code-block.tsx now imports shiki at highlight time inside its
existing per-language cached getHighlighter helper. A new lazyCodePlugin
wraps @streamdown/code, satisfying Streamdown's CodeHighlighterPlugin
contract (default themes synchronously; highlight() returns null until the
engine loads, then resolves tokens through the callback) while deferring the
@streamdown/code import — and with it shiki — to the first highlight call.
Rendering, theming, language handling, and public APIs are unchanged. Shiki
now splits into a separate on-demand chunk: the main entry chunk drops from
4,551.81 kB to 4,356.25 kB (~196 kB raw, ~60 kB gzip), and Vite no longer
reports the ineffective-dynamic-import warning.
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
* test(web): prove lazy Shiki highlighting through Streamdown + harden callback
Address cross-vendor review of the lazy-Shiki change.
Verified lazyCodePlugin matches Streamdown's real consumption contract:
HighlightedCodeBlockBody runs highlight() inside a useEffect and stores the
result via setState — `let r=o.highlight({...}, c=>{i(c)}); r&&i(r);`
(streamdown/dist/highlighted-body-OFNGDK62.js). Returning null keeps the raw
code in state; the callback calls setState, forcing a re-render with the
highlighted tokens. The highlighted body is itself React.lazy + Suspense
(chunk-BO2N2NFS.js), so raw text paints first and highlighting streams in.
So the null-then-callback path reliably produces highlighted output.
- Add streamdownCodeHighlight.test.tsx: renders MessageResponse (which uses
STREAMDOWN_PLUGINS with code: lazyCodePlugin) on a fenced code block,
asserts raw code shows immediately, then waits for the lazy @streamdown/code
import + callback and asserts multiple per-token colored spans appear
(Streamdown colors tokens via the --sdm-c CSS custom property).
- Harden highlight() against double callback invocation with a fire-once guard
so the callback runs exactly once whether the real plugin resolves via its
return value (sync cache hit) or its own callback. Add a unit test asserting
the callback fires exactly once.
- Clarify supportsLanguage: Streamdown has zero call sites for it/
getSupportedLanguages, and highlight() falls back to "text" for unknown
languages, so the optimistic pre-load answer is safe.
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
* test(e2e): assert chat code blocks lazy-load Shiki highlighting
Regression guard for the lazy-Shiki change: seeds a deterministic
assistant message with a fenced code block and asserts the observable
syntax-highlighted token spans appear once the on-demand Shiki import
resolves, proving highlighting survives the deferral.
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
* style: apply ruff format to lazy-Shiki e2e test
`ruff format` collapses the multi-line `wait_for_function` string
concat onto one line; matches the pre-commit CI fix so the check
passes.
Co-authored-by: Isaac
* test(ui-snapshot): wait for lazy Shiki highlight before chat capture
The lazy-Shiki change defers `@streamdown/code`, so the fenced code
block first paints raw and only re-renders with syntax-highlighted
token spans once the on-demand import resolves. The visual snapshot
was capturing the pre-highlight frame, drifting from the committed
(highlighted) baseline and failing the UI Snapshot gate.
Wait for the `--sdm-c` token spans (same signal the lazy-Shiki e2e
test uses) before capture so the render is highlighted and matches
the existing baseline — no baseline regen needed.
Co-authored-by: Isaac
* test(ui-snapshot): update chat baseline for lazy-Shiki render
The lazy-Shiki change defers `@streamdown/code`; in the pinned headless
Playwright renderer the fenced code block paints uncolored even after the
token spans mount (confirmed across two CI runs — the DOM wait added last
commit does not repaint the colors at capture). Highlighting works in a
real browser, so this is a snapshot-environment artifact, not a UX
regression. Adopt the CI-rendered baseline (byte-identical to the gate's
render) so the visual gate matches, and keep the token-span wait so the
capture is the settled post-import DOM rather than a mid-tokenization frame.
Co-authored-by: Isaac
* test(ui-snapshot): fix chat snapshot flake on lazy Shiki highlight
The chat baseline flaked between highlighted and raw code renders. The
lazy `@streamdown/code` import mounts the colored token spans a frame
before the browser composites their colors, so waiting on span presence
raced the paint — the screenshot sometimes caught the raw frame.
Wait until the tokens resolve more than one distinct computed color (the
raw fallback is a uniform `inherit`), then flush two animation frames so
the colors are painted before capture. Restore the highlighted baseline
as the correct target (a prior commit had adopted a raced raw render).
Co-authored-by: Isaac
---------
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
Co-authored-by: Daniel Lok <daniel.lok@databricks.com>
* feat(scheduled tasks): make workspace/host optional on create
Many scheduled tasks do no code work — research, summaries, chat-only —
so requiring a workspace and a connected host at create time is wrong.
Make both optional on CREATE. No schema/migration change: the DB columns
are already nullable.
- routes/scheduled_tasks.py: CreateScheduledTaskRequest.workspace and
host_id become optional (still reject empty strings). The router's
_validate_launch_inputs skips connected-host workspace validation when
BOTH are unset and returns a null canonical workspace; supplying just
one of the pair is still an error. PATCH is unchanged — it still cannot
null an already-set workspace/host_id.
- scheduled/fire.py: a fired task with neither host nor workspace creates
a default/no-workspace session and seeds its prompt as the opening user
turn (the no-host analog of the connected-host launch+dispatch), instead
of recording a failed run. A task that pins a host_id (with or without a
workspace) stays on the honest connected-host path and still records a
skipped/failed run when that host is missing or offline.
- tools/builtins/scheduled_tasks.py: drop workspace/host_id from the
sys_scheduled_task_create required list; they remain optional properties.
Normal POST /v1/sessions is unchanged — the shared session-create
validation and the sessions route still require a workspace.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(scheduled tasks): resolve owner's live host when host unset (rework)
Rework of the optional-workspace/host semantics: an unset host_id no
longer means "run hostless" — it means "run on the owner's live host,
whichever it is". The prompt always runs on real compute.
- Unset host_id: resolve the owner's most-recently-active ONLINE host at
fire time (host_store.list_hosts(owner) + host_registry; v1 first-online
tiebreak). No online host, or no host store/registry, records a failed
run (no_online_host / host_registry_unavailable) — never a silent no-op.
- Unset workspace: default to the host's HOME, canonicalized to an
absolute realpath via a host.stat of '~' (_resolve_default_workspace).
The stored conversation row never holds a literal '~'; an unresolvable
HOME records a failed run (default_workspace_unresolved).
- Removed the hostless seed-prompt dispatch path; every fire goes through
connected-host launch+dispatch. Resolution produces an effective task
(dataclasses.replace) threaded through preflight/validate/create/dispatch
and is never written back to the stored row.
- Pinned-host tasks are unchanged (offline still skipped/failed); the API
partial-binding rejection and PATCH rules are unchanged.
Fixes two /review MAJOR findings from the rework:
- literal '~' persisted where an absolute realpath is contracted → now a
canonical absolute path via host.stat.
- os_env.cwd boundary bypassed for a defaulted workspace → workspace
validation is gated on the resolved effective.workspace, so a defaulted
HOME outside a boundary-pinned agent records a failed run, matching
POST /v1/sessions.
Tests: 101 passed across the scheduled fire/routes/tool-dispatch and
scheduler-lifespan suites; ruff clean.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* docs(scheduled tasks): correct optional host/workspace wording to resolve-live-host
Doc-only. The tool description, workspace/host_id schema property text,
and the route request comment + _validate_launch_inputs docstring still
described the pre-rework hostless design ('fires as a default/no-workspace
session', 'omit both for research/summaries/chat-only', 'needs neither a
workspace nor a connected host'). After the rework an unset host_id
RESOLVES the owner's online host at fire time (a failed run is recorded if
none is online) and an unset workspace defaults to that host's home dir —
it is not hostless. Reword the surface text to match. No logic change.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled tasks): allow pinned host without workspace (default to host HOME)
Workspace is now ALWAYS optional. A task may pin a host but omit the
workspace — e.g. a task that only talks to an MCP (PagerDuty, etc.) needs
no code directory. The workspace defaults to the launch host's home
directory whether the host was pinned OR resolved from the owner's live
hosts at fire time.
The four combos:
- host none + workspace none → resolve owner's live host, default workspace to HOME.
- host set + workspace set → run there (workspace validated at create).
- host set + workspace none → run on the pinned host, default workspace to HOME. (was 400; now allowed — the fix.)
- host none + workspace set → still 400 (a path with no machine is meaningless).
- routes/scheduled_tasks.py _validate_launch_inputs: short-circuit to a
null canonical workspace whenever workspace is None (host set or not),
skipping validate_existing_host_workspace (which raises on a null
workspace). Only workspace-without-host stays a 400. Agent + model/effort
validation still run.
- scheduled/fire.py _resolve_effective_task: the HOME default already
applies to a pinned host (host_id kept, workspace resolved to canonical
HOME); docstring clarified that a pinned host is not re-resolved.
- tools/builtins/scheduled_tasks.py: tool + property text note workspace is
always optional and a host may be pinned without one.
Shared _session_create_validation.py / sessions.py untouched — normal
POST /v1/sessions still requires a workspace.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(scheduled tasks): check pinned-host ownership before stat RPC
When a task pinned host_id but omitted the workspace, _resolve_effective_task
issued a host.stat of '~' to the pinned host to derive the default workspace
BEFORE the ownership check (which lived in the preflight, run after
resolution). A task pinning another owner's online host would thus dispatch a
stat RPC to a host it doesn't own on every fire — the preflight then correctly
rejected it (host_not_owned, no session, path not leaked), but the RPC had
already gone out.
Reorder, not new validation: extract the existence + ownership check into a
shared _authorize_pinned_host helper (a local host_store.get_host read — no RPC
to the host) and call it for a PINNED host before _resolve_default_workspace.
The preflight reuses the same helper. A resolved host (host_id was unset) is by
construction the owner's own, so its path is unchanged and not double-checked.
Single-user / auth-disabled (owner_user_id None) behavior is unchanged — the
owner check is skipped, matching the preflight.
Net: for a pinned host, ownership is authorized before any RPC reaches it;
owned/valid hosts behave exactly as before.
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(scheduled tasks): authorize pinned host at create even when workspace omitted
_validate_launch_inputs returned early the moment workspace was None,
before any host authorization ran. So a scheduled-task create/PATCH with
host_id set but no workspace persisted the host_id without verifying the
caller owns it or that it exists (200), and a bad reference only surfaced
as a failed run at fire time.
Authorize a pinned host (existence + ownership) BEFORE the workspace-None
early return, reusing the same resolve_host_owner the workspace-present
branch already calls inside validate_existing_host_workspace (whose
semantics fire.py:_authorize_pinned_host mirrors) so create-time and
fire-time authorization cannot drift. It is a LOCAL store read only — no
host.stat / workspace RPC — preserving the no-workspace contract (workspace
defaults to host HOME at fire time). Single-user / auth-disabled mode still
skips the owner check (existence is still enforced), matching the fire path.
A nonexistent host now 404s and a non-owned host 403s at create; PATCH is
covered via the shared helper. Updates the test that asserted the old 200,
adds nonexistent/non-owned create cases and a PATCH-adds-host case, and
keeps the fire-path late-failure backstop tests.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style: ruff-format test_desktop_update.py (whole-repo pre-commit gate)
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
Three tables stored the same session-owner Databricks identity under
different column names and widths. hosts.owner (VARCHAR(256)) and
scheduled_tasks.owner_user_id are renamed to user_id (VARCHAR(128)),
matching user_daily_cost.user_id and the schema-wide identity
convention (session_permissions.user_id, account_tokens.user_id,
device_grants.user_id).
The change is confined to the DB + Python layer: the JSON API keys
("owner", "owner_user_id") are preserved at the route boundary, so the
HTTP contract, OpenAPI, SDKs, and web UI are unaffected.
Migration b3c1a2d4e5f6 renames both columns (narrowing hosts.user_id
256->128), swaps uq_hosts_workspace_owner_name ->
uq_hosts_workspace_user_id_name and ix_scheduled_tasks_owner_user_id ->
ix_scheduled_tasks_user_id, with a full downgrade. Verified
up/down/data-preservation on SQLite.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
## Related issue
N/A
## Summary
The Electron build workflow could not install the web dependencies because it used strict peer resolution against a lockfile generated with legacy peer handling. Use `--legacy-peer-deps` consistently with the web lockfile generation and other web CI jobs.
## Test Plan
- `cd web && npx --yes --package npm@11.12.1 npm ci --legacy-peer-deps --no-audit --no-fund`
- `cd web && npm run build:overlay`
- `uv run pre-commit run --files .github/workflows/electron-build.yml`
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [x] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Verified the install with CI's pinned npm 11.12.1 and built the update overlay successfully. This workflow-only correction does not require a new automated test.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
## Related issue
N/A
## Summary
Desktop update UX is moved out of the server-rendered web bundle into the
Electron shell, so an update notification shows regardless of the connected
server's web-bundle version (an older server that predates the in-page banner
no longer leaves the desktop app unable to say it's out of date).
- Shell-owned overlay: a transparent, frameless child window (per shell window)
renders the SAME `UpdateBanner` component (reused, not duplicated) built into
`electron/overlay/` via a standalone Vite entry. It sizes to the card via
ResizeObserver height reports and collapses to a 1px click-through sliver when
empty (never `hide()`, so the renderer keeps laying out and can re-appear).
- Banner-safe server-page bridge: `preload.js` collapses
available/downloaded/error-security to `idle`, so no web bundle — including
older ones still mounting the in-page banner — can show a duplicate; Settings
still reads/writes update prefs and surfaces check errors.
- Menus: "Check for Updates…" and "Restart to Update" (with native up-to-date /
failed / nothing-ready dialogs) live under the production Server menu;
notification sounds + DevTools fold into a dev-only Debug menu.
- Security: `forceDevUpdateConfig` is derived from `!app.isPackaged` (env var
removed) so a packaged build can never be redirected to the HTTP dev feed.
- In-app theme is mirrored to `nativeTheme` (setColorScheme IPC) so the overlay,
native dialogs, and menus follow the theme switcher, not just the OS.
- Feed: publish provider points at the omnigent.ai generic feed; the build
workflow uploads `latest-linux.yml` / `latest.yml`. The overlay is built
automatically before dev/packaging via `prebuild:*` hooks.
## Test Plan
- `npm test` in web/electron — 218 pass.
- `npx vitest run` for UpdateBanner / SettingsPage / settingsNav — pass.
- `npx tsc -b` clean; `npm run build:overlay` produces the island.
- Manual: ran the unpackaged app against a local fake feed (127.0.0.1:8765
advertising 0.6.1); confirmed the overlay appears, re-appears across repeated
checks (root-caused a hidden-window ResizeObserver stall and fixed it), the
in-page top banner stays suppressed, and "Check for Updates…" shows the native
up-to-date / failure dialogs.
## Demo
N/A — desktop overlay; verified manually (see Test Plan). No media captured in
this environment.
## Type of change
- [ ] Bug fix
- [x] Feature
- [x] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Unit tests cover the updater main-process wiring and the UpdateBanner states.
The windowed overlay (positioning, show/collapse, theme) was verified manually
against a local fake feed, since it can't be exercised headlessly.
## Changelog
Desktop update notifications now appear in a native corner toast that works
regardless of the connected server's version.
## Follow-up review fixes
- Overlay lifecycle: explicitly `destroy()` the child overlay when its parent
shell window closes (Electron does not auto-close child windows, so it would
otherwise be orphaned with live IPC handlers).
- Production install path: "Restart to Update" moved into the production Server
menu (not just the dev-only Debug menu) so a user who dismisses the toast can
still install a downloaded update; surfaces a native dialog when nothing is
ready instead of silently no-op'ing.
- Overlay build: `publicDir: false` in the overlay Vite config so the ~150KB of
PWA icons / favicon from `web/public/` are no longer copied into the shipped
`electron/overlay/` bundle.
- Theme on reload: push the live `nativeTheme` theme on every
`did-finish-load` (not just on `nativeTheme` changes), so Cmd+R on the overlay
no longer reverts to the stale OS theme captured in the `?theme=` URL param.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
- Move the optional filesystem probe off the runner startup path
- Deduplicate setup across processes and linked worktrees
- Keep runner and workspace registry initialization explicit and idempotent
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
* fix(telemetry): track sdk harness name in SessionCreatedEvent
SDK sessions (claude-sdk, openai-agents, codex, etc.) previously emitted
`harness: null` on the SessionCreatedEvent because only native agents have
a `native_agent.harness` attribute. Fall back to `_resolve_harness(conv)`,
which already handles harness_override and spec lookup, so every harness
kind is now represented in telemetry.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* deps(policies): migrate CEL evaluation from cel-expr-python to cel-python
cel-expr-python had no wheels for Linux aarch64 or macOS x86_64, requiring
a platform conditional in pyproject.toml and graceful degradation. cel-python
(cloud-custodian/cel-python) is pure Python and ships on all platforms.
- Replace cel-expr-python with cel-python>=0.5 (unconditional dependency)
- Rewrite omnigent/policies/builtins/cel.py to use the celpy API:
- celpy.Environment() + env.compile() + env.program() for compile phase
- prog.evaluate({"event": celpy.json_to_cel(event)}) for eval phase
- CELParseError / CELEvalError for specific exception handling
- Direct MapType key lookup (key in result / result[key]) rather than
converting the whole map to strings
- Remove platform restriction notes from deploy READMEs
- Update NOTICE attribution URL
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* chore: update uv.lock and apply pre-commit fixes for cel-python migration
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
The managed-host launch-token auth path no longer needs a token_hash
index. The tunnel endpoint is /hosts/{host_id}/tunnel, so the connecting
peer already names the host it claims to be — resolve_launch_token now
seeks the row by the (workspace_id, host_id) primary key and compares the
stored digest to the presented token's digest with hmac.compare_digest
(constant-time, preserving the no-timing-oracle property).
Drops uq_hosts_token_hash (workspace_id, token_hash). Its uniqueness was
never load-bearing — launch tokens are 256-bit secrets.token_urlsafe(32)
values whose digests do not collide in practice — and nothing rides it now
that the lookup keys on the PK.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* fix(web): trust server session.status so "Working…" clears on idle
The main chat's "Working…" indicator reads only `sessionStatus`, but the
`session.status` handler dropped a bare `idle` (no responseId) whenever an
`activeResponse` was still `streaming` — deferring to `response_end` to own
the lifecycle. `response_end` only sets the local `status`/`activeResponse`,
never `sessionStatus`, so when that guard fired nothing ever cleared the one
field the indicator reads. On a fresh session the first-turn wrapper-response
id mismatch leaves `activeResponse` stuck `streaming`, so the turn's genuine
terminal `idle` was eaten and the shimmer stayed lit even though the server,
sidebar, and local status all reported idle.
Remove the guard so `sessionStatus` tracks the server's session-level status
1:1. The idle heuristic now lives in exactly one place — the runner's
PTY-activity watcher — instead of being split between server and client. The
bubble lifecycle (`status`/`activeResponse`) still defers to `response_end`,
independently of the session-level status.
Co-authored-by: Isaac
* test(e2e-ui): cover Working indicator clearing on a bare server idle
The E2E UI gate requires a tests/e2e_ui/** test covering the visible chat
behavior this branch changes. Add a Playwright test that drives the exact
edge shape the claude-native PTY-activity watcher emits on a plain turn — a
turn-start `running` carrying a `response_id` (opening the streaming
`activeResponse`), then a trailing bare `idle` with no `response_id` — and
asserts the "Working…" indicator clears. This is the case the removed
dropped-idle guard covered; before the fix the indicator stayed lit forever.
Verified the test fails with the old guard restored and passes with the fix.
Co-authored-by: Isaac
* fix(telemetry): track sdk harness name in SessionCreatedEvent
SDK sessions (claude-sdk, openai-agents, codex, etc.) previously emitted
`harness: null` on the SessionCreatedEvent because only native agents have
a `native_agent.harness` attribute. Fall back to `_resolve_harness(conv)`,
which already handles harness_override and spec lookup, so every harness
kind is now represented in telemetry.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* style: reformat harness ternary in SessionCreatedEvent telemetry
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
The in-memory host registry keyed live connections by host_id alone,
but a host_id is only unique within a workspace — the hosts table PK is
(workspace_id, host_id). A BYO/local host has a stable config.yaml
host_id, so a user who belongs to multiple workspaces and points that
host at more than one presents the same host_id to each.
Keyed on host_id alone, the second workspace's connect treated the
first's healthy tunnel as stale: it evicted the entry (newest-wins) and
poisoned the first connection's outbound queue, so that workspace's host
operations then failed with "connection was replaced". Without host-
tunnel replica affinity, routing could also resolve the wrong
workspace's tunnel for the same host_id.
Key the registry by (workspace_id, host_id) to mirror the DB PK. The
workspace defaults to current_workspace_id() — 0 in single-tenant/OSS,
so behavior there is unchanged — and is captured into HostConnection at
register time so the long-lived sender loop's send_text guard never
reads request context. Every call site is already request-scoped, so no
call-site changes are needed; the change is contained to host_registry.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
The `policies` table carried three overlapping secondary structures that
didn't pull their weight: `ix_policies_created_at` matched no query,
`ix_policies_session_id` and a scope-less listing left `list_defaults`
scanning every session row to find the handful of global policies, and a
`uq_policies_session_id_name_cksum` unique constraint that only enforced
session-name uniqueness (default-name uniqueness was already app-enforced).
Collapse the two listing indexes into one combined
`ix_policies_scope_session (workspace_id, scope, session_id, id)`. `scope`
leads `session_id` so `list_defaults` (WHERE ws + scope='default') seeks the
prefix and `list_for_session` (WHERE ws + scope='session' + session_id) seeks
the full key — `list_for_session` gains a `scope='session'` predicate so it can
reach `session_id` in the key (proven via EXPLAIN QUERY PLAN; without it the
planner table-scans). `created_at` is deliberately omitted: with `session_id`
between `scope` and `id` it cannot cover the `ORDER BY created_at, id` for both
queries, so both sort their small result set in memory (as the session listing
already did).
Drop the `uq_policies_session_id_name_cksum` unique constraint and enforce
session-name uniqueness in the store (`create`/`update`), mirroring the
existing default-policy path. The session-policy PATCH route now maps a rename
collision to 409. Net: one fewer index maintained per write, no DB constraint,
same seek performance on both reads.
Migration d4c1b9e6f3a2 (off a7f3c1b9e2d4).
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
- Send versioned launch metadata with the session-init handshake
- Share initialization across tunnel callbacks and first-turn dispatch
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
Bump omnigent-desktop-electron from 0.3.0 to 0.6.0 in web/electron/package.json and package-lock.json. The shell reads its version dynamically via Electron's app.getVersion() (sourced from package.json#version), so no source, build-config, or updater changes are needed.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
The Telemetry disclosure section added in #2934 (5fd0012f) was accidentally
removed by #2933 (c555ba9c), which deleted it in the same diff that added the
Configuration section. Restore the Telemetry section verbatim between "Write
your own agent" and "Contributing", and remove the Configuration section.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Widen the comments PK from (workspace_id, id) to
(workspace_id, conversation_id, id) and drop the now-redundant
ix_comments_conversation_id index (workspace_id, conversation_id,
created_at, id).
The (workspace_id, conversation_id) prefix the secondary index shared
with the PK is now carried by the PK itself, so it backed the
per-conversation reads (list_for_conversation, the fingerprint
aggregate, the cascade delete) purely as write/space overhead. Its one
extra job -- feeding list_for_conversation's ORDER BY created_at, id an
index-ordered scan -- is given up for a filesort over the small
per-conversation comment set.
The three store point-lookups (get/update_comment/delete) already
receive conversation_id, so they now key on the full PK tuple instead of
fetching by (workspace_id, id) and filtering conversation_id in Python;
the lookup itself enforces the conversation scoping.
Migration a7f3c1b9e2d4 (off z9a2b3c4d5e6) is a pure key change:
conversation_id is already NOT NULL and populated, so no backfill.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
`ix_files_created_at` on `files` (workspace_id, created_at, id) only served
a session-less listing (WHERE workspace_id ORDER BY created_at, id), and
nothing issues that query. Every read of a session's files goes through
`FileStore.list(session_id=...)` — the agent `list_files` tool (in-process
and runner-proxied over GET /v1/sessions/{id}/resources/files) and the
session-resources route — all of which filter by session_id and are served
by `ix_files_session_id_created_at`. Global (session_id IS NULL) files are
only surfaced via the `include_unscoped` OR query, which also rides the
session-scoped index.
Since the global listing had no caller, `FileStore.list` now requires
`session_id` (the `session_id=None` branch that produced the unindexed
query is removed), and migration c3e8f1a9d2b7 drops the index.
`ix_files_session_id_created_at` is unchanged.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
Add rahulrav1 to the canonical maintainer roster in .github/MAINTAINER. This grants merge-approval, the skip-security-scan waiver, and e2e-approved permissions per the existing workflows.
A journey's setup ran unwrapped inside run_latency/run_throughput, so a
transient 500 there (e.g. _setup_target_session's raise_for_status) propagated
up and aborted the whole benchmark suite mid-run. Separately, a run in which
every operation failed contributed all-zero latencies to the summary averages,
so a failed run masqueraded as an infinitely fast one and skewed the reported
numbers toward zero.
- journeys.py: catch setup failures and record them as a single failed run
(`setup: HTTP 500`); suppress teardown failures; unify per-op failure
classification in `_failure_reason`.
- measure.py: aggregate() and check_thresholds() average only runs with a
successful sample; summaries gain runs_total/runs_ok and omit metric keys
when every run failed. print_results matches and notes excluded runs.
- run.py: outer per-journey safety net — any other unexpected error records a
`skipped` block and the suite continues. A no-successful-sample journey fails
the CI gate only when a threshold was supplied.
- compare.py: report skipped/all-failed journeys as `skipped` rather than a
spurious -100% improvement.
- schema.py: bump SCHEMA_VERSION 3 -> 4; update sample_output.json + README.
Co-authored-by: Isaac
test_build_report_contains_required_fields pinned the expected version line
to "omnigent 0.6.0.dev0". The 0.7.0.dev0 bump (#2950) left it stale, so the
misc pytest shard fails on main and every branch cut from it. Assert against
`omnigent.version.VERSION` so the check tracks the real version and does not
break on future bumps.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* ⚡ perf(auth): Reuse delegated runner credentials
- Exchange host launch binding tokens for short-lived owner bearers before resolving user credentials.\n- Share runner auth with Claude and refresh hook snapshots without exposing the binding token.
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
* ♻️ refactor(auth): Address review feedback
- Avoid logging bridge paths and collect cancelled refresh tasks explicitly.\n- Inject the refresh interval so tests use the existing direct import style.
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
* fix runner auth fallback behind Apps proxy
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
* perf(auth): bootstrap runners with host bearer
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
* docs(api): regenerate OpenAPI schema
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
---------
Signed-off-by: Daniel Lok <daniel.lok@databricks.com>
dev/benchmarks/omnigent/seed.py seeded the benchmark corpus through the
production store ORM API one row at a time (~2M single-row INSERTs, ~20k
commits, each preceded by throwaway PRAGMAs on session open), taking ~6-10
min on CI. The benchmark only measures the store read path, so the write
strategy does not taint what's measured provided the resulting corpus is the
same shape.
Add a SQLAlchemy Core bulk-insert fast path (_seed_via_core) that writes the
whole corpus in one transaction via ~10 batched executemany flushes (1 commit
instead of ~20k). It uses the ORM Table objects so Uuid16 binds bare-hex to
16 bytes byte-identically to the store, computes title_hash explicitly
(Python defaults don't fire under executemany, and sets all kind/status
columns explicitly. The schema at head carries no FK constraints (migration
p1a2b3c4d5e6 dropped them all), so insert order is free under
PRAGMA foreign_keys=ON.
Dialect-gated: SQLite uses the fast path; every other dialect (e.g. the
nightly Postgres benchmark) falls back to the existing store-API loop
(_seed_via_store), extracted verbatim, so behavior there stays identical.
Byte-stable: same RNG seed/counts/_FRAGMENTS, same generate_*_id calls, same
per-session draw order (title first, then items), same 0-based position
allocation, same label stamped on the last session, same _meta_value config
string. Item data/search_text are built byte-identical to
MessageData.model_dump(exclude_none=True) + extract_search_text (the slow
path keeps _make_items as the single source of truth). The fast path item
build bypasses pydantic (building plain dicts) to keep the 1M-item Python
phase cheap; a byte-stability test pins both paths to identical corpora.
Idempotency preserved: the reuse-skip check, --reseed, and --print-head work
unchanged; ensure_user(local) and the seed-meta label upsert are mirrored
via sqlite_insert.on_conflict_do_*.
Target: ~20-30s end-to-end (was ~6-10 min) for the 5000x200 corpus; measured
~27s locally. Scope: seed.py + a new test file only; no product store/db code
under omnigent/stores/ or omnigent/db/ touched.
EOF
)
* feat(routing): server-side smart routing via external routes:select gateway
Adds a GatewayRoutingClient that implements the existing RoutingClient
protocol by calling an external routes:select gateway (the Databricks
AI-Gateway routing service, or any endpoint speaking the
omnigent.api.routing.v1 proto). Because every frontend — CLI, web UI,
SDK, the native-harness forwarders, and child sessions — already routes
through the server's route_turn() chokepoint, swapping the routing
client covers all of them with no per-client code and no web changes.
Server config selects between two mutually-exclusive providers via a new
routing: block (gated on OMNIGENT_SMART_ROUTING=1 as before):
routing:
provider: gateway # or "llm" (default, existing built-in judge)
base_url: https://<host>/ai-gateway/routing/v1
router_name: task_v0
profile: <databricks-profile> # optional; mints a bearer for the gateway host
Candidate models come from the server's live catalog (the same
available_models the built-in judge receives), mapped to proto
route_options; the SelectRouteResponse maps back to a RoutingResult.
Requests use snake_case proto3-JSON (preserving_proto_field_name=True).
A gateway error or empty selection returns None so the turn proceeds on
the agent's default model.
Routing is gated per-session by the existing cost_control_mode_override
switch (the web UI's "Intelligent model" toggle). The CLI had no way to
set it, so this adds a /route on|off slash command (and the SDK
set_cost_control_mode + Session.cost_control_mode_override plumbing it
needs); turning routing on clears any pinned /model override in the same
PATCH, matching the web client.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): rename GatewayRoutingClient to ExternalRoutingClient
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): drop CLI /route toggle; keep ExternalRoutingClient for parity
Tables the CLI-side cost-control enablement (the /route slash command and
its SDK set_cost_control_mode / Session.cost_control_mode_override
plumbing). Scope is now feature parity with today's routing: the server
can route via an external routes:select gateway (ExternalRoutingClient +
routing: config), gated per-session by the existing
cost_control_mode_override switch that the web UI toggle already sets.
Enabling routing from the CLI can come later.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): add ROUTES_SELECT_PATH constant; provider "external"
- Extract the "routes:select" custom-method path to a ROUTES_SELECT_PATH
constant in smart_routing.py.
- Rename the config provider value "gateway" -> "external" (routing.provider:
external) and update prose/logs to say "external"/"router" instead of
"gateway" (the Databricks AI-Gateway product name and its URL path are
kept where they refer to the real endpoint).
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): split _build_routing_client into per-provider helpers
_build_routing_client is now a thin dispatcher on routing.provider,
delegating to _build_external_routing_client and
_build_local_llm_routing_client. Behavior unchanged.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): inline provider dispatch; drop _build_routing_client
The provider selection (routing.provider -> external vs llm) now lives
inline at the server startup call site, calling
_build_external_routing_client / _build_local_llm_routing_client
directly. Behavior unchanged.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): simplify provider dispatch at startup
Collapse the provider-selection block to a single condition: an
``external`` provider requires ``routing.provider == "external"``;
anything else (no block, other/missing provider) falls through to the
built-in llm judge, preserving the OMNIGENT_SMART_ROUTING + llm: parity.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): flatten external routing-client config parsing
Normalize base_url/router_name/profile with (x or "").strip() up front so
the validation collapses to plain `if not base_url or not router_name`.
Drop the dead isinstance(dict) guard (the caller guarantees a dict) and
its now-invalid test.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* test(routing): merge redundant missing-field cases into one test
base_url and router_name are validated by a single condition now, so
fold the two separate missing-field tests into one.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* feat(routing): config-driven model_prefix + log gateway error bodies
ExternalRoutingClient now round-trips model ids through a per-request
router_id -> local_id map: it applies an optional, config-declared
model_prefix (routing.model_prefix, default empty) to strip a
deployment's catalog prefix on the way out and restore the exact catalog
id on the router's answer. No provider is hardcoded in core — an
unconfigured deployment sends catalog ids verbatim, so OSS/non-Databricks
setups (bare model ids) work unchanged. A Databricks workspace whose
serving endpoints are named "databricks-<model>" sets
model_prefix: databricks- to match a router (e.g. task_v0) that keys on
bare ids.
Also split routes:select error handling so the gateway's response body
is logged on 4xx/5xx (the actual reason, e.g. task_v0's required-model
error) instead of a bare status code, and surface transport/parse
failures at warning level.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* feat(routing): add provider-agnostic routing.api_key auth option
routing.profile is Databricks-specific. Mirror the llm: block by adding
an env-expandable routing.api_key: an explicit bearer token (${ENV}
expanded) that takes precedence over profile, else the Databricks profile
convenience, else unauthenticated. Non-Databricks deployments can now
authenticate an external router without a Databricks CLI profile.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* refactor(routing): use click.echo for config warnings, drop lone _logger
Match cli.py's house style (click.echo(..., err=True)) for the two
routing-config warnings instead of introducing the file's only
logging.getLogger. Behavior unchanged.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
* feat(routing): multi-prefix model map + validate router pick against candidates
Address review feedback on external routes:select routing:
- model_prefix accepts a list (or scalar) so multiple catalog prefixes
(databricks-, system.ai.) can be stripped; first match wins.
- key the router-id -> local-id map on (harness, router_id) so the same
bare model id served under different harnesses (Databricks-authed PI vs
a Codex subscription) maps back to distinct local ids.
- validate the router's returned model against the candidate set we sent,
like the built-in judge: an out-of-set pick returns None instead of being
persisted as the session's model_override.
Co-authored-by: Isaac
Signed-off-by: Lilly <lilly.gray@tecton.ai>
---------
Signed-off-by: Lilly <lilly.gray@tecton.ai>
Co-authored-by: Lilly <lilly.gray@tecton.ai>
Three release-workflow bugs that blocked the 0.6.0rc1 release. Real CI on
the base commit was green in all cases — the failures were self-inflicted.
1. Assert-green-CI gate self-poisoning. The gate queried the base SHA's
check-runs and failed on any non-green run, but counted check-runs produced
by THIS workflow (plan, benchmark, cut, bump-main, …). A single premature
failure on a prior dispatch left a failure conclusion on the SHA and
poisoned every later dispatch in a self-sustaining loop.
Fix: exclude every check-run belonging to a release.yml run (identified by
workflow run ID in details_url, not by job name — so a real nightly
`benchmark` regression from a different workflow still gates). One-shot
fail-fast design preserved.
2. benchmark ModuleNotFoundError. The benchmark job's first `uv run --no-sync`
ran seed.py before any `uv sync`, so the venv had no deps and `import yaml`
died. The sync was buried later, too late for the seed steps.
Fix: add one `uv sync --extra dev` up front (the "sync once" half of the
repo's existing --no-sync pattern), matching benchmark.yml/benchmark-pr.yml.
3. Baseline benchmark fails across schema boundary. The baseline step checked
out the previous release tag and booted its server against a bench.db seeded
by the current (newer) code. The DB was at the newer Alembic head; the older
server didn't know that revision (migrations are forward-only) → server
died → 90s health-check timeout.
Fix: seed at the OLDER release's schema head instead. The baseline (older
code) reads it natively; the candidate (newer code) auto-migrates it forward
on startup. Reordered the benchmark job: find the previous tag first, then
seed + run baseline at the older schema, then re-sync and run the candidate
(which migrates the same bench.db forward). Removed the seed cache (the cache
key was scoped to the newer schema head, which no longer matches the seed
point; the separate seed-perf PR will make seeding fast enough not to need it).
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Convert the three remaining raw TEXT columns — policies.handler,
policies.factory_params, and hosts.configured_harnesses — to
CompressedText (a transparent zstd-compressed BLOB) so they satisfy the
no-TEXT/MEDIUMTEXT schema rule and stay 1:1 with the managed USM schema.
These columns hold opaque handler paths / machine-generated JSON and are
never used in a SQL predicate, so storing them as a compressed byte frame
is safe. The Python type stays `str`, so stores and callers are unaffected.
Migration z9a2b3c4d5e6 mirrors z4a2b3c4d5e6 (TEXT->LargeBinary on upgrade,
no backfill; downgrade decompresses each value then restores TEXT). Its
downgrade addresses each row by that table's real PK column — hosts keys
on host_id, not id.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* fix(repl): treat /model show|list|status|current as display, not a switch (#2779)
Typing /model show (intending to display the current model) was parsed as
a switch to the literal model id 'show', persisting it as model_override and
breaking every subsequent turn with no UI way to recover. Route the display
keywords show/list/status/current to the same readout as bare /model instead
of setting an override.
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
* ♻️ refactor(repl): Simplify model command tests
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
---------
Signed-off-by: simtsc <2539637+simtsc@users.noreply.github.com>
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
Co-authored-by: sabhya-db <sabhya.chhabria@databricks.com>
The automatic "auto-title" rename asks the model to call
sys_session_rename on the first turn of every fresh session — an extra
model round-trip that slows every new session. Gate it behind
OMNIGENT_SESSION_RENAME, defaulting to off, so the feature ships
disabled out of the box while keeping the implementation (tool
registration, dispatch, the auto-title endpoint) intact. The manual
"Rename" sidebar item is unaffected.
session_rename_instruction() and session_rename_allowed_tools() are the
single canonical gate both the Claude-native launcher and the shared
runner consult; returning None / () there suppresses the instruction
and empties the tool preapproval everywhere.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
ix_scheduled_tasks_state (workspace_id, state, created_at, id) on
scheduled_tasks does not earn its keep. Its per-workspace query shape --
WHERE workspace_id AND state ORDER BY created_at, id (list_active) -- has no
production caller; the scheduler reads active tasks exactly once at boot via
list_active_all_workspaces (WHERE state ORDER BY workspace_id, created_at,
id), which is a near-full scan regardless.
ix_scheduled_tasks_created_at (workspace_id, created_at, id) already serves
that boot read: scanning it yields the exact ORDER BY workspace_id,
created_at, id the query wants, with state applied as a residual filter. The
residual check is free here because the store selects whole rows (state is
already loaded), and scheduled_tasks is low-cardinality (a handful of tasks
per user, and delete is a hard delete so no deleted rows linger) -- nothing
meaningful to skip. So the index is pure write/space overhead.
The state column and its ck_scheduled_tasks_state check constraint are
unchanged -- only the index is removed. Index-only, no data change; DROP is
native on every dialect and the downgrade restores it.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
In #2605 the `memory` optional-dependency extra was renamed to `hindsight`
without keeping the old name around, making `omnigent[memory]` / `--extra
memory` silently install a nonexistent extra. Re-add `memory` as an alias
extra pulling the same `hindsight-client` so existing install commands keep
working. Scheduled for removal in 0.70 (TODO).
Add a polymorphic `harness:` key in config.yaml — a scalar (legacy) or a
mapping with `default` plus per-harness `command`/`args` overrides. The
legacy scalar form still works and auto-migrates to the mapping form on the
next config write.
Harness binary-path precedence: `OMNIGENT_<NAME>_PATH` env var >
`harness.<id>.command` config > built-in default. `args` follow the same
precedence with config args as the base and CLI pass-through args appended.
Env-var standardization: `OMNIGENT_<NAME>_PATH` (base id, `-native` suffix
stripped) is the canonical per-binary override, unifying the headless
`HARNESS_*_PATH` and native `OMNIGENT_*_PATH` conventions into one namespaced
name. The env var keys off the underlying binary, not the harness id, so
`claude-sdk` (which runs the `claude` CLI) shares `OMNIGENT_CLAUDE_PATH` with
`claude-native`.
The legacy `HARNESS_<NAME>_PATH` (codex/pi/kimi/goose/qwen/hermes) is still
read as a deprecated fallback — a one-time runner-side log warning when it
provides the value, plus a terminal-visible CLI startup notice for
interactive invocations. Slated for removal in v0.8.0.
The pre-existing `omnigent claude --command` flag is deprecated (warns on
use, pointing to `OMNIGENT_CLAUDE_PATH`/config) and will be removed in a
future release. No other native command gained a `--command` flag —
override via env or config.
New module `omnigent/harness_startup_config.py` (leaf resolver, lazy-imports
the alias helper): `resolve_harness_config`, `resolve_harness_command`,
`resolve_harness_args`, `resolve_harness_path`, `config_harness_path_override`.
Config deep-merge of the `harness` mapping across global+local (per-harness
sub-keys). Write-side scalar→mapping migration with a one-time stderr notice.
`config set harness=<id>` deep-merges into existing overrides; `config list`
renders the default + notes overrides.
`args` wiring: the 11 native Click commands thread config args as the base
with CLI pass-through args appended (via `_resolve_harness_startup_args`).
The 7 env-resolver native commands (pi/cursor/kiro/goose/hermes/qwen/kimi)
thread `harness.<name>-native.command` config into `OMNIGENT_*_PATH` before
`_ensure_backend`. The 5 headless spawn-env builders (codex/pi/kimi/goose/qwen)
set `OMNIGENT_*_PATH` from config when ambient env is unset.
Signed-off-by: Zeyi Fan <zeyi.f@databricks.com>
ix_conversation_metadata_kind (workspace_id, kind, id) on
omnigent_conversation_metadata has no serving query. kind is fully
determined by parent_conversation_id nullness -- a child always has a
parent, a top-level session never does -- so list_conversations filters
kind on the AP conversations table (parent-nullness) and the sub-agent
roll-up (list_child_conversation_ids_by_parent) rides
idx_conversations_parent; neither reads the metadata kind column. kind is
also a 2-value column (kind IN (1, 2)), so a standalone index could never
be selective.
The kind column and its ck_conversation_metadata_kind check constraint are
unchanged -- only the index is removed.
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
## Related issue
N/A
## Summary
- Add a **Telemetry** section to the README disclosing that Omnigent collects
anonymized usage data by default, with no sensitive or personally
identifiable information.
- Link to the [Usage Telemetry](https://omnigent.ai/docs/deploy/telemetry)
docs page for opt-out instructions, and note that managed-service users
should consult their service agreement.
## Test Plan
- Previewed the rendered markdown locally; verified the section sits between
"Write your own agent" and "Contributing" and the docs link points to
https://omnigent.ai/docs/deploy/telemetry.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [x] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Docs-only change; verified by reading the rendered README diff.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Fold the 1-to-1 agent_configuration companion table back onto
conversations: agent_id returns as a first-class indexed column and the
four per-session overrides collapse into one nullable session_overrides
JSON blob (VARCHAR(512), NULL when the session uses all agent/spec
defaults).
The overrides were never filtered in SQL, so a blob loses no query
capability while dropping a table, an extra INSERT, the get_conversation
JOIN, and the paired-row repair/fork/delete plumbing. agent_id stays a
real indexed column (ix_conversations_agent_id) so the agent->conversation
reverse lookup and the agent_id / has_agent_id / agent_name list filters
stay index-backed.
- db_models: delete SqlAgentConfiguration; add agent_id + session_overrides
to SqlConversation; restore ix_conversations_agent_id.
- conversation store: add _encode/_decode_session_overrides; rewire
create/get/list/update/fork/switch/delete and the bulk reads onto the
merged row; drop the JOIN, batch-fetch, and missing-row repair logic.
Fix the id-collision -> ConversationAlreadyExistsError translation, which
had relied on the agent_configuration INSERT failing first.
- agent store: session-id reverse lookup reads conversations.agent_id.
- migration b7e4d2c9a1f3: reversible; ids are normalised to bytes in Python
so the copy is correct on SQLite/Postgres/MySQL regardless of the source
column's declared type (the split created it VARCHAR; conversations stores
ids as raw bytes).
Reverses bb2c3d4e5f6a.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
ix_conversation_items_conversation_id_position was UNIQUE on (workspace_id, conversation_id, position, created_at). The created_at tail only existed because a UNIQUE index must contain the partition key, and with it in the key the DB no longer enforced position uniqueness anyway (only per epoch-second). Strict position uniqueness is owned by the next_position allocator under _lock_conversation, which never reuses a position; no code path catches a position IntegrityError.
So the UNIQUE flag is redundant. Repoint the index to a plain (workspace_id, conversation_id, position): same access path for the dominant per-conversation position-ordered scan, one less uniqueness probe on the hot insert path, and created_at drops out (a non-unique index needs no partition key). The PK still carries created_at, so the table stays partition-ready.
Migration c7d2e9f4a1b8; index-only, no data change. Updates the three tests that asserted the old unique/created_at shape.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* feat(scheduled): real on_fire fire path + wire store into entrypoints
Replace the no-op _placeholder_on_fire with a real fire path
(omnigent/server/scheduled/fire.py): on firing, re-read the row (skip if
missing/non-active), create an owner-granted session bound to the task's
agent, launch its connected-host runner, dispatch the prompt, and record
the run — all fire-and-forget via asyncio.create_task so the scheduler
timer re-arms immediately. managed_sandbox targets are recorded as a
skipped run for now (connected_host only in v1).
Wire SqlAlchemyScheduledTaskStore into all three entrypoints (cli.py,
deploy/databricks, deploy/docker) so the scheduler actually starts.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled): add /v1/scheduled-tasks CRUD routes
Owner-scoped CRUD for scheduled tasks (create/list/get/update/delete),
mirroring the hosts router. Create/update validate the RRULE via
validate_rrule (400 on invalid); every mutation keeps the live
ScheduledTaskScheduler in sync via add/update/remove. Mounted under /v1
whenever a scheduled_task_store is configured.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* feat(scheduled): add sys_scheduled_task_* MCP tools
Four agent-facing builtins — create/list/update/delete scheduled tasks —
always registered by ToolManager (no spec opt-in, like the policy tools).
The runner dispatches each to the /v1/scheduled-tasks REST endpoints via
server_client; RRULE validation and owner scoping stay server-side. Added
to the local-dispatch and native-relay tool sets so native harnesses see
them too.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* style(scheduled): ruff lint + format cleanup
Sort imports, drop unused imports, dict-literal, de-Yoda a condition,
wrap long tool-schema descriptions, and drop redundant None defaults —
no behavior change.
Co-authored-by: Isaac
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* test: allow scheduled task tools in manager schemas
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Tighten scheduled task fire v1 scope
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Trigger CI rerun
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* fix(scheduled): timezone validation, remove unused FireDeps.agent_store, fix _grant_owner docstring
- Validate IANA timezone on POST /v1/scheduled-tasks and PATCH
/v1/scheduled-tasks/{id}; an unrecognized timezone name returns HTTP 400.
- Remove FireDeps.agent_store: the field was declared but never read inside
fire.py. Updated the FireDeps constructor in app.py and test_fire.py.
- Correct _grant_owner docstring: permission_store=None is a no-op (auth
disabled), not a grant — the previous wording claimed the grant was never
skipped, directly contradicting the early-return on line 281.
- Add integration tests for invalid timezone on create and update.
Signed-off-by: Rahul Ravindranathan <rahul.ravindranathan@databricks.com>
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Fix scheduled task validation and failure runs
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Preserve scheduled workspace validation comments
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Preserve session metadata validation comments
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Remove scheduled fire v1 wording
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
* Fix scheduled fire races and scoping
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
---------
Signed-off-by: Rahul Ravindranathan <rahulnathan73@gmail.com>
Signed-off-by: Rahul Ravindranathan <rahul.ravindranathan@databricks.com>
The per-parent child-title unique index keyed on the wide title column (a 512-char prefix on MySQL, ~2 KB per entry on utf8mb4). Add a title_hash column holding sha256(title)[:16] and repoint the index at it, so entries are a fixed 16 bytes. The index keeps its name so the store's IntegrityError to NameAlreadyExistsError translation still matches; semantics are unchanged (two titles collide iff their 128-bit digests do, and only among siblings under one parent).
The ORM default stamps title_hash on INSERT and the store recomputes it on the two rename paths; the column is nullable so raw-SQL inserts that bypass the ORM default don't have to supply it. Migration a2b7c3d8e4f9 adds the column, backfills existing rows (keyset-batched Python, since SQLite has no sha256), and swaps the index.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
The two bare (workspace_id, <ts>, id) sort indexes on conversations are never the chosen access path: the sessions list is ACL-scoped (id IN (...)) and resolves via the PK, the default sidebar (archived=false, updated_at DESC) is served by ix_conversations_archived_updated, and sub-agent/root listings use their own indexes. Meanwhile updated_at is rewritten on every item append, so the index is pure write amplification.
Migration f4a1c8b2d3e6 drops both; downgrade recreates them.
Co-authored-by: Isaac
Signed-off-by: aravind-segu <aravind.segu@databricks.com>
* feat(ci): auto-assign the maintainer with most context on a feature blog
Mirror doc-sync's reviewer assignment, adapted for the multi-PR nature of a
feature blog: tally who merged the feature's contributing PRs (from pr_refs)
and request review from the most frequent merger — the maintainer with the
most context. Authors are the fallback (outside contributors may lack site
access; a maintainer always merges), bots and the CI identity are skipped.
The merger/author tally reuses the existing per-PR `gh` loop in Draft posts
(one extra `gh pr view --json mergedBy,author` per ref), writing the chosen
login to /tmp/reviewer_<idx>.txt. The Open-draft-PRs step @-mentions them in
the body (durable ping) and best-effort --add-reviewer/--add-assignee,
tolerating GitHub's 422 for non-collaborators.
Co-authored-by: Isaac
* fix(ci): write reviewer @-mention on the draft-PR update path too
Polly review: the force-push update path called assign_reviewer but never
refreshed the PR body, so an existing draft never got the durable @-mention.
Since --add-reviewer commonly 422s (the source-repo maintainer isn't an
omnigent-site collaborator), the mention is the only reliable ping — it must
land on both paths. Build the body once and `gh pr edit --body` it on update.
Also surface gh-pr-view failures in the merger tally with a ::notice:: instead
of swallowing them silently, so a systematic API failure isn't invisible.
Co-authored-by: Isaac
* feat(ci): auto-generate a hero image for each feature-blog post
The drafter now emits an IMAGE_PROMPT line describing a concrete visual scene
for the feature (subject only, grounded in the post content, no style words).
The workflow appends a fixed brand style suffix, calls the image model on the
same gateway host (databricks-gemini-3-pro-image), writes the PNG to
public/images/blog/<slug>.png, and rewrites heroArt to point at it.
- Content-driven: the subject comes from the feature the drafter just wrote
about, so every hero depicts that feature (not a generic mascot).
- Fail-soft: any error (no gateway/key, bad response, non-PNG) logs a warning
and leaves heroArt blank, so image generation never blocks a draft.
- No new secret: the image endpoint is derived from GATEWAY_BASE_URL's host and
authed with LLM_API_KEY, both already in the step env.
- Hero art / byline drop from the mandatory-human checklist to review-only.
Co-authored-by: Isaac
* fix(ci): scope gateway URL to image step, guard heroArt rewrite
Address Polly review on the hero-image change:
- Scope GATEWAY_BASE_URL to the image-generation Python invocation only,
instead of the whole Draft posts step. The unsandboxed drafter run no longer
inherits it, so it can't reach the drafter's stdout (which is embedded in the
PR body and only scanned for LLM_API_KEY).
- If the post has no double-quoted `heroArt` field to rewrite, discard the
generated PNG and warn, instead of committing an unreferenced image.
Confirmed omnigent-site's .gitignore only ignores /public/pagefind, so the
generated public/images/blog/<slug>.png commits normally.
Co-authored-by: Isaac
* fix(ci): sync draft-PR boilerplate with auto hero, harden slug path
Address Polly non-blocking notes:
- The "Open draft PRs" body still told reviewers to "add hero art, set the
author byline" — now auto-generated. Reword to say the hero image and
`author: omnigent` byline are generated and only need review, keeping the
demo + voice pass as the human tasks.
- Re-validate slug as strict kebab-case at the point the hero PNG path is
built (defense-in-depth; slug is already validated upstream but this is the
one place it names a new file).
Left as-is per review: inline GATEWAY_BASE_URL expansion is intentional (env:
would re-expose it to the drafter run), and max_tokens on the image endpoint
is harmless.
Co-authored-by: Isaac
* perf(runtime): speed up changed-files git status on large repos
The changed-files panel runs `git status --porcelain --untracked-files=all`
with a hardcoded 5s cap. On large repos that walk is slow and the panel fails
hard (HTTP 500 / git_status_failed) when it exceeds the cap. Three changes:
- Make the git-subprocess timeout configurable via
OMNIGENT_GIT_STATUS_TIMEOUT_SECONDS and bump the default 5s -> 30s so slow
(but not hung) repos get more headroom before erroring.
- Enable core.untrackedCache=true best-effort on registry init so
`git status` stops re-stat'ing every untracked path (upstream git >= 2.8).
- Pass `:(exclude)` pathspecs for _SKIP_DIRS so git never walks large
untracked build/cache trees (node_modules/, .venv/ ...) that we discard
anyway; the root-level post-filter stays as a safety net.
Adds functional tests for the timeout knob, the skip-dir pathspecs, and the
untracked-cache init (including graceful degradation on config failure).
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* perf(runtime): make untracked-cache config a one-shot per git-root
The host fallback path (server reading the host filesystem directly when the
runner is offline) builds a fresh WorkspaceReader — and thus a fresh
GitFilesystemRegistry — for every fs request, unlike the runner path which
caches registries per session. That meant the new core.untrackedCache config
write re-spawned a `git config` subprocess on every host changes/diff/list/
search request.
Guard the write with a process-global set keyed by git-root so it runs at most
once per root per process. Idempotent and thread-safe; adds a test asserting
repeated registry construction on the same root issues the config write once.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* perf(runtime): gate untracked-cache on git's --test-untracked-cache probe
Enabling core.untrackedCache unconditionally risks stale results on
filesystems with unreliable directory mtimes — a newly-untracked file could
then be missing from the changed-files panel. Git's own guidance is to run
`git update-index --test-untracked-cache` first, which exits non-zero on such
filesystems.
Gate the config write on that read-only probe: only enable the cache when the
probe passes. Failures anywhere still degrade silently (pure speedup). Adds a
test asserting the config is left unset when the probe fails.
Addresses a non-blocking review comment on #2905.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(sessions): don't show runner_disconnected error on intentional stop
Clicking "Stop session" in the web UI on a host-spawned session showed a
red "Error · runner_disconnected / Runner disconnected unexpectedly."
card even though the user stopped it on purpose. Stop deliberately tears
the runner's WS tunnel down (_stop_session_host_runner) so runner_online
flips false, which makes the SSE relay hit the same
except (httpx.HTTPError, ConnectionError) path a genuine runner death
takes. That block couldn't tell an intentional stop from a crash, so it
published a failed status with runner_disconnected and persisted durable
error labels that also polluted snapshots and child summaries.
Add a one-shot _intentional_stop_sessions marker set alongside the
existing _interrupt_fenced_sessions. The stop handler marks the session
right before tearing the tunnel down (host-spawned branch only), and the
relay's disconnect handler consults it: an intentional drop resolves to a
quiet idle with cleared error labels, while a genuine disconnect still
surfaces runner_disconnected as before. Safety-net discards on the next
running edge and on session delete keep a stale marker from swallowing a
later real disconnect.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(sessions): clear intentional-stop marker on every relay exit path
Address a correctness regression flagged in review: the one-shot
_intentional_stop_sessions marker could outlive the turn that set it and
silently downgrade a LATER genuine runner disconnect to a quiet idle,
defeating the runner_disconnected surfacing the relay was built to
provide.
Two holes are fixed:
- The running-edge discard was nested under
`if session_id in _interrupt_fenced_sessions`. A Stop typically emits a
terminal response.cancelled first, which clears the fence, so the outer
guard was false on every subsequent running edge and the marker could
never be cleared there. Move the discard into the fence-independent
session.status running branch so a new turn always clears it. The
terminal branch is deliberately NOT used: on an intentional stop the
terminal event arrives over the tunnel before the tunnel drops, so the
marker must survive it to be consumed by the disconnect handler.
- A best-effort stop that never dropped the tunnel (host offline, ack
timeout, host-reported failure) left the marker set with no disconnect
to consume it. _stop_session_host_runner now returns whether teardown
was actually delivered, and the stop handler discards the marker when it
wasn't. A finally-block discard in the relay is added as a belt-and-
suspenders clear for clean/cancelled exits.
Add test_relay_running_edge_clears_stale_intentional_stop_marker covering
the stop -> terminal event clears fence -> new running edge -> later
genuine disconnect sequence; it fails without the running-edge fix.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(web): show busy spinner on new-session Send while create is in flight
The new-session landing screen awaits the full backend round-trip (session
bootstrap + git worktree setup) before navigating to /c/{id}. During that
multi-second window the Send button only went disabled with no other feedback,
so the click read as "frozen" — the typed message just sat in the composer and
users assumed nothing was sent.
Swap the Send button's static arrow for a spinning Loader2Icon while `creating`
is true, and add `aria-busy` + a "Starting session" label. The button was
already disabled via `canSubmit`, so this only adds the missing visual signal
that the click registered and work is in flight.
This is the perceived-latency fix; it doesn't change the actual backend timing.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* test(e2e_ui): cover the new-session Send busy spinner
Add a Playwright test that holds the create POST open with a gate so the
in-flight window is observable, then asserts the Send button flips to its busy
state (disabled + aria-busy="true" + "Starting session" label) while the create
is pending and the landing composer is still mounted, and that navigation runs
once the create resolves. Satisfies the E2E UI Required gate for the visible
submit-button behavior change.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
The randomize button lives inside a Radix PopoverContent that animates in
and is repositioned by Floating UI on mount. A click racing that enter
transition/reposition intermittently timed out with "element is not stable"
/ "detached from the DOM" on loaded CI runners.
Disable CSS animations/transitions on the page and wait for the popover to
fully mount (its hex input visible) before clicking randomize, so the click
lands on a settled node.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
Managed sandbox hosts boot in a fresh HOME with env-var credentials only,
so there was no way to give them config.yaml-level configuration — locking
provider-agnostic harnesses like pi out of self-hosted model gateways
(LiteLLM/vLLM) in managed sessions.
- New top-level `sandbox.host_config:` server config key — verbatim
in-sandbox ~/.omnigent/config.yaml content (e.g. a providers: block with
kind: gateway, default: [pi]), provider-agnostic across all managed
launch providers.
- Validated fail-loud at server startup: mapping shape, providers block
through the same provider_config parser omnigent itself uses (secrets
deliberately not resolved — api_key_ref: env:VAR names sandbox env),
inline api_key literals rejected at parse time, the block's own default
scopes checked for collisions, plus a JSON round-trip so YAML-native
values can't fail every launch at runtime.
- Materialized before `omnigent host` starts, from one shared rendering
primitive so merge semantics can't drift between providers: exec-model
providers run a self-contained python3 -c merge script (stdlib+yaml
only) via the shared SandboxLauncher.start_host; kubernetes appends the
same rendered command to its init-container prep script, landing the
file on the HOME emptyDir before the main container boots the host.
- Merge mirrors cli.py's deep_merge_keys=("providers",): providers entries
merge one level deep (injected wins), other top-level keys replace
wholesale. The payload rides base64, so arbitrary YAML content never
touches shell quoting.
- Server-managed replacement semantics: a marker file records what was
injected, and each launch/resume removes those entries by name before
merging the current payload — a renamed gateway or a removed host_config
block cleans up on the next wake instead of stranding stale providers.
User-created config in the sandbox survives; config and marker are
written atomically. A missing or corrupt marker degrades to additive
merging — never delete without evidence of what was injected.
Closes#2126
Signed-off-by: Bryan Li <bryan.li@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix(harness): resolve CLI binaries off the daemon's frozen PATH in readiness gates
Follow-up to the codex/claude resolver fix. The general readiness gates
still probed bare shutil.which(spec.binary), so a claude-native /
cursor-native / kiro-native / etc. CLI installed into an nvm/npm-managed
global bin dir (only on PATH via interactive shell init) could still be
reported 'binary missing' by the host daemon, whose PATH snapshot omits
that dir — the same split the codex fix closed for its own gate.
Route harness_cli_installed, missing_harness_cli, and the
harness_is_configured fallback gate through the shared resolve_cli_binary
(PATH -> global-dir ladder), so readiness matches what the launch will
see for every CLI harness. install_harness_cli keeps a bare shutil.which
check: it runs in the setup flow's own process, where the ~/.local/bin
PATH refresh (and the subsequent bare-binary login shell-outs) depend on
the binary being reachable via this process's PATH.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* refactor(harness): drop unreachable spec-None guards in install_harness_cli
Past harness_install_command(key), a spec-less key has already raised
KeyError, so spec is non-None — the 'if spec is not None' guards and the
trailing 'return False' were dead. Assert the invariant instead, per PR
review.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* test(harness): patch resolve_cli_binary, not readiness.shutil
The harness_is_configured fallback gate now resolves via resolve_cli_binary
(shutil was dropped from harness_readiness), so the community-harness
readiness test must patch that instead of the removed readiness.shutil.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
A context overflow on a live (stream=true) turn raised
_ContextWindowOverflow uncaught, since only the background-turn path
caught it, so the process manager's in-flight marker never cleared and
the harness subprocess leaked forever.
Catch it inside proxy_stream() itself so both paths clean up the same
way. Adds a regression test confirmed to fail before this fix and pass
after.
Signed-off-by: Nick Chakre <nickchakre18@gmail.com>
* fix(acp): make prompt timeout configurable
Signed-off-by: Robert Dosen <robert.dosen@gmail.com>
* docs(acp): document HARNESS_ACP_PROMPT_TIMEOUT_S and tidy timeout code
Document the new prompt-timeout env var alongside the other HARNESS_ACP_*
vars in the acp_harness module docstring, its discoverability home. Hoist
the duplicated validation error string to a single _PROMPT_TIMEOUT_ERR
constant, and rework the timeout comments so each constant's comment sits
adjacent to it (the init-handshake timeout was left orphaned by the new
parsing block).
Co-authored-by: Isaac
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
---------
Signed-off-by: Robert Dosen <robert.dosen@gmail.com>
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
Co-authored-by: Bryan Qiu <bryan.qiu@databricks.com>
* feat(web): gate sidebar row actions on ownership, not permission level
The session sidebar derived every row affordance (rename, share,
move-to-project, drag-to-file) and the My/Shared tab split from each
row's `permission_level`. That forced the server to resolve the
caller's effective grant for every listed session on each list build
and updates poll.
The sidebar only ever needs owner-vs-not, and every list row already
carries `owner`. Switch `isOwnedByViewer` to compare `owner` against
the resolved viewer id (permissive when owner is null — single-user /
legacy rows), and gate the row actions on ownership alone:
- Rename, Share, Move-to-project, and drag-to-file are now owner-only
(Share was manage-gated, Rename/move/drag were edit-gated).
- Non-owners get a read-only row; finer-grained edit/manage affordances
remain on the open-session view, which fetches the caller's real
level via GET /v1/sessions/{id}.
`permission_level` is no longer read anywhere in the sidebar, so a
backend can list sessions without a per-session permission lookup.
Co-authored-by: Isaac
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
* feat(web): make sharing owner-only and null-safe on managed list rows
Two follow-ons to the owner-only sidebar, for backends whose session
list is owner-only and omits the caller's effective permission_level
(the Databricks-managed server):
- derivePermissionLevel no longer concludes from a sidebar row whose
permission_level is null. That null is "level not carried", not the
permissive null sentinel, so we skip the fast path and defer to the
authoritative single-session snapshot / read-only fallback. A backend
that keeps emitting a level on list rows (OSS default) is unchanged.
- The header Share affordance is now owner-only (isOwnerLevel of the
derived level), matching the sidebar's owner-only Share gate and the
terminal readOnly gate. Was manage-or-higher (>= 3).
- ChatPage's liveness row prefers the snapshot's permissionLevel over
the sidebar row's, so host_offline's isOwner (who may reconnect the
host) isn't decided by a null managed list level reading as permissive.
Co-authored-by: Isaac
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
* test(e2e): cover sidebar owner-vs-not row gating and tab placement
Adds the Playwright e2e coverage the E2E-UI-Required gate asks for on
this PR: the sidebar derives ownership (and every owner-only row action)
from the session's `owner`, not from an effective permission level.
Two flows on a dedicated multi-user server (the shared single-user
live_server hides the My/Shared tabs and the Share item, so the split
can't be observed there):
- Owner: session under "My sessions", kebab Rename + Share enabled,
Rename opens the inline edit.
- Non-owner granted EDIT: session under "Shared with me" (absent from
"My sessions"), kebab Rename + Share disabled — owner-only gating
regardless of the granted level.
Test-only; no product code changes.
Co-authored-by: Isaac
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
---------
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
In an embedded mount (basename e.g. `/omnigent`) the app matches absolute
paths, so `useLocation().pathname` already includes the basename. The
settings sidebar captures that location as the "Back to Omnigent" return
target — on the home page that's the bare basename plus the host's search,
`/omnigent?o=<workspace>`. The link then routes it back through
`rebasePath`, whose idempotency guard only treated `=== basename` and
`${basename}/` as "already under the basename".
`/omnigent?o=123` matches neither (the char after `/omnigent` is `?`, not
`/`), so it gets prefixed a second time → `/omnigent/omnigent?o=123`, which
404s. A conversation return path (`/omnigent/c/abc`) escaped the bug only
because it happens to start with `/omnigent/`.
Treat `/`, `?`, `#`, and end-of-string as the basename boundary, matching
the guard's documented "does not double-prefix a path already under the
basename" contract, while still rebasing a distinct sibling segment like
`/mounting`.
Adds regression coverage in routing.test.tsx for the query/hash boundary
forms (Link + rebasePath primitive) and the over-match guard.
Signed-off-by: Bryan Qiu <bryan.qiu@databricks.com>
Replace Python's raw wall-of-red traceback with a calm, branded crash
screen and a one-tap path to file a GitHub issue from the repo's
bug_report.yml template.
On crash: amber header, compact traceback (shortened paths, collapsed
library frames, first-party packages always visible), report path
next to the [Y/n] prompt. On yes: opens a pre-filled GitHub issue
(template, title, version, OS, traceback in Description). Clipboard
as backup. URL drops body if >8000 chars.
New: omnigent/crash_ui.py, omnigent/crash_handler.py,
tests/cli/test_crash_handler.py (21 tests).
Wired into omnigent/cli.py:main().
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Add two new sections to the agent guidance:
- Finishing a task: agents should print explicit testing instructions
(commands, inputs, reproduction steps) when completing a task so the
user can verify the work without guessing.
- Deprecating features: record the target removal version in code (e.g.
a @deprecated tag/comment naming the release) and in the PR/commit
description, so the feature can be cleaned up when that version ships.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* feat(web): open agent info panel on hover over the (i) icon (#2736)
The agent info popover (agent name, session cost, model usage, etc.)
only opened on click. Make it also open when the pointer hovers the (i)
icon and stay open while the pointer is on the icon or the panel — a
short close delay bridges the gap between them so it doesn't flicker
shut mid-move, and re-entering either side cancels the pending close.
Click and keyboard still toggle the panel, so touch devices (no
mouseenter) and keyboard users are unaffected. Hover-open suppresses
Radix's auto-focus into the panel (which would steal focus / scroll)
while click and keyboard opens keep it. The redundant "Agent tools &
policies" tooltip is hidden while the panel is open.
Co-authored-by: Isaac
* fix(web): gate agent-info hover-open to mouse pointers so taps still open (#2736)
In-browser testing (real Chrome via CDP) surfaced a touch regression the
unit tests missed: a tap synthesizes pointerenter + click, so the
mouseenter-based hover-open fired on the pointerenter and then Radix's
synthetic click toggled the panel straight back shut — a tap could never
open the panel.
Switch the hover wiring from onMouseEnter/Leave to onPointerEnter/Leave
gated on `pointerType === "mouse"`. Touch/pen now fall through to Radix's
native click-to-open, while mouse hover-open (with the stay-open bridge
and close delay) is unchanged. Verified end-to-end in a browser: hover
opens, moving onto the panel keeps it open, leaving both closes after
~150ms, click toggles, and a touch tap now opens the panel.
Add regression tests for the touch-tap-opens path and the
hover-then-click-closes path.
Co-authored-by: Isaac
* test(e2e-ui): cover agent-info popover hover interaction
Add a Playwright e2e under tests/e2e_ui for the agent-info (i) popover's
hover flow (issue #2736): hover opens the panel, the 150ms close-delay
bridge keeps it open when the pointer crosses from the icon onto the
panel, leaving both closes it after the delay, click toggles, and a
touch tap falls through to native click-to-open. The existing coverage
was component/unit only; this exercises the pointer-type gating and the
hover→panel bridge in a real browser.
Co-authored-by: Isaac
* test(e2e-ui): strengthen agent-info hover bridge + click coverage
Two test-quality fixes so the popover tests prove the behavior rather
than passing incidentally:
- Bridge test now walks the pointer down through the real vertical gap
between the icon and the panel (computed from bounding boxes), dwelling
in the empty space past a fraction of the close delay, then lands on the
panel. A bridge-less (zero-delay) implementation closes the panel during
the transit and fails the test — verified by temporarily setting
HOVER_CLOSE_DELAY_MS=0.
- Click test now drives a real mouse pointer (hover + click) instead of
dispatch_event("click"): on a mouse the pointer must move onto the icon
first (hover-opens), so the meaningful click behavior is toggling the
open panel shut and keeping it shut (no double-open). Click-to-open on a
hover-less pointer stays covered by the touch-tap test.
Co-authored-by: Isaac
* fix(web): keep AgentInfo click-to-open reliable under the hover model
A mouse click's own pointer arrival hover-opens the panel (pointerenter →
setOpen(true)) before the click's Radix trigger toggle runs. On a slow render
the hover-open commits open=true first, so the controlled toggle reads true and
flips it back to false — the panel never opens. This regressed click-to-open
(and re-open after a modal dialog closes) on slow/CI machines, failing
test_agent_info_policy_add_and_remove.
Swallow an onOpenChange(false) that lands within a short grace window
(HOVER_CLICK_GRACE_MS) of a hover-open: those two events are one gesture, so the
close is the racy self-toggle, not a dismiss. A deliberate hover-then-click
dismiss dwells far past the window, so click-to-dismiss, the hover bridge, and
the touch-tap fix are all unchanged.
Co-authored-by: Isaac
## Related issue
N/A
## Summary
- Add a required `version-code` input to the `workflow_dispatch` trigger in the Android Bundle workflow. The value is passed to Gradle via `-PversionCode=N` and read in `build.gradle.kts` so each CI-built AAB gets a unique, Play-compatible `versionCode` without manual edits to the build file.
## Test Plan
- Verified locally: `./gradlew -PversionCode=99 assembleDebug` produces an APK with `versionCode='99'`.
- Verified fallback: `./gradlew assembleDebug` (no property) still defaults to `versionCode=2`.
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [x] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Verified the Gradle property override produces the correct versionCode in the built APK via `aapt dump badging`.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
## Related issue
N/A
## Summary
- Add a `workflow_dispatch`-triggered GitHub Actions workflow that builds an unsigned release AAB (`./gradlew bundleRelease`) and uploads it as a workflow artifact. Download the artifact and sign it locally with the upload keystore — no secrets in CI, no signing key on GitHub.
## Test Plan
- Triggered the workflow manually on this branch; verified the build succeeds and the AAB artifact is produced.
- Verified `bundleRelease` produces an unsigned AAB when no keystore credentials are present (existing `build.gradle.kts` behavior).
## Demo
N/A
## Type of change
- [ ] Bug fix
- [ ] Feature
- [ ] UI / frontend change
- [x] Refactor / chore
- [ ] Docs
- [x] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Triggered the workflow on the branch; confirmed the AAB is built and uploaded as an artifact.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* fix(web): disable "Create custom agent" on a managed sandbox
Selecting a managed sandbox as the target and then creating a custom
agent leaves the affordance offered but unsupported: the sandbox
provisions its runner from a baked image and has no create path for an
uploaded bundle. Gate the "Create custom agent" picker item on
`sandboxSelected` — when a sandbox is the target, render it disabled with
an explanatory tooltip (mirroring the disabled New-Sandbox row) instead
of opening the dialog. On a connected host it stays enabled and opens the
dialog as before.
Adds vitest coverage (disabled on sandbox, enabled on host) and a
Playwright e2e test under tests/e2e_ui/start_session.
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
* fix(web): hide "Create custom agent" on a sandbox instead of disabling
Follow-up on the sandbox gating: rather than showing the "Create custom
agent" picker item disabled with a tooltip on a managed sandbox target,
omit it entirely. On a connected host it is shown and opens the dialog as
before. Tests updated to assert the item is absent on a sandbox and
present on a host.
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
* fix(web): drop redundant sandboxSelected prop comment
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
* fix(web): drop a selected pending custom agent on a sandbox target
Hiding the "Create custom agent" button stops a new pending agent from
being created on a sandbox, but a pending agent selected before switching
to a sandbox would still be submitted through the unsupported multipart
path. Gate the pending pick on `!sandboxSelected`: on a sandbox the
selection falls back to a real agent (`effectiveAgentId`) and the pending
row is hidden from the picker. Off the sandbox the pending pick is kept.
Adds vitest + Playwright e2e coverage for the host->sandbox deselection.
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
* fix(web): drop redundant pendingAgent prop comment
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
---------
Signed-off-by: Edwinhe03 <41037314+Edwinhe03@users.noreply.github.com>
## Related issue
N/A
## Summary
- Add a floating server-switcher pill to the Android WebView shell, mirroring the iOS `ServerSwitcher`. The pill is always visible at the top center of the screen, shows the current server's host, and opens a dropdown menu with recent servers, Reload, and Connect to New Server — giving users a universal recovery path when the server is unreachable or a non-Omnigent page loads.
- Add an Android-specific scroll-fade gradient so the chat transcript fades smoothly into the pill area, starting at the pill's bottom edge. The fade offsets are driven by CSS variables (`--omnigent-android-switcher-margin/height`) so they stay in sync with the pill dimensions.
- Theme-aware pill styling via the app's brand color resources (light/dark).
## Test Plan
- `./gradlew :app:assembleDebug :app:lintDebug` — 0 lint errors, build succeeds.
- Manual: installed on a Pixel 9a via `adb install`, verified the pill renders with correct theme colors, the dropdown menu opens with recent servers and actions, switching servers reloads the bridge for the new origin, and the scroll-fade gradient appears below the pill.
- Verified the pill stays visible across page loads (always-visible default, backward compatible with older web builds).
## Demo
N/A — tested on physical device; screenshots taken via `adb screencap` during development.
## Type of change
- [ ] Bug fix
- [x] Feature
- [x] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [ ] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Manual verification on a Pixel 9a (API 35): confirmed pill rendering, theme-aware colors (light/dark), dropdown menu with group dividers, server switching via `reloadWithNewServer` (removes old bridge, re-registers for new origin), scroll-fade gradient position, and backward-compatible always-visible default. Existing Robolectric unit tests fail due to Maven Central network blocking (pre-existing, unrelated to this change).
## Changelog
Android app shows a floating server switcher pill with a dropdown menu for quick server switching
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* feat(web): add QR code for opening a session in the mobile app
The share dialog (PermissionsModal) gains an "Open in mobile app"
button next to "Copy link". Clicking it opens a separate modal with
a QR code encoding the session's
deep link — the same scheme the desktop shell's deep-link handler
parses (electron/src/deepLink.js). The QR sits on a fixed white tile
with error-correction level M so it stays scannable in dark mode.
- getDeepLink() derives the host (with port when non-default) from
the same shareable URL getShareableLink() resolves, so standalone
and embedded (host-transformed) origins agree on the same server.
- The QR modal is a sibling Dialog inside the share Dialog, so closing
it returns the user to the share dialog rather than dismissing both.
- Tests pin host resolution for standalone origin, non-default port,
and the embedded host-transform case.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* test(e2e_ui): add QR code modal test to permissions modal suite
Add a Playwright e2e test covering the new "Open in mobile app" QR code
flow in the share dialog: the button opens a second dialog with the QR
code, and closing it returns to the share modal.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
---------
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
The Electron Build workflow's Windows job failed at `npm ci` with
ETIMEDOUT because 5 packages in web/electron/package-lock.json had
`resolved` URLs pointing at npm-proxy.cloud.databricks.com — an
internal proxy unreachable from public GitHub Actions runners.
- Rewrite all 5 internal proxy URLs to registry.npmjs.org in
web/electron/package-lock.json
- Add web/electron/.npmrc pinning the public registry so future
`npm install` runs don't reintroduce internal proxy URLs
- Add scripts/normalize_package_lock_registry.py (fixer + --check mode),
mirroring the existing normalize_uv_lock_registry.py for npm
- Wire normalize-package-lock-registry into .pre-commit-config.yaml for
all three package-lock files (web, web/electron, editors/vscode)
- Add a pre-`npm ci` guard step in the workflow that uses the shared
script to fail fast if internal registry URLs are detected
- Split Linux AppImage and .deb into separate downloadable artifacts
Signed-off-by: Zeyi Fan <zeyi.fan@databricks.com>
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* feat(policies): show config-file policies in admin policy page
Policies loaded from the server --config YAML (RuntimeCaps.default_policies)
were applied to every session but invisible in the admin UI, which only read
from the database. The GET /v1/policies response now appends them as read-only
entries tagged with source: "config".
The frontend renders them with a "Config" badge and omits the toggle/delete
controls, since they are managed via the config file rather than the admin UI.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(policies): cover config-file policies in GET /v1/policies
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
get_client's model-change branch (a concrete harness, different model requested for the same conversation, respawn) had no direct test coverage despite running in production via post_responses. Adds test_get_client_respawns_on_model_change, covering both the respawn-on-change case and the no-respawn-on-same-model case.
Follow-up to the discussion on #2226.
Signed-off-by: Nick Chakre <nickchakre18@gmail.com>
@tiptap/markdown (beta) can hand back a bare inline image with no wrapping
paragraph — a standalone image in document flow (blank lines around it, or
after ---) or an image-first list item (1. ). The doc and listItem
content models are block+, which cannot hold a bare inline node, so the
parsed doc is schema-invalid; nodeFromJSON loads it without validating and
the first transaction (a user edit, or StarterKit's TrailingNode on load)
throws "Called contentMatchAt on a node with invalid content", crashing the
whole file panel ("Page failed to load") and leaving the conversation
bricked until the session is stopped.
This is the known residual documented in #2320 (which fixed block-FIRST
list items via block+ but could not cover bare INLINE children). Fix it the
way #2320's follow-up note prescribed: generalize #2004's toBlockContent
guard from blockquote-only to every block container, as a post-parse
normalization on MarkdownManager.parse (same runtime-patch pattern as the
existing serializer patch in tiptapMarkdownPatches.ts).
Verified against the real triggering file: pre-fix, its only schema
violation is the doc-level standalone image (its :::list-table nested lists
are already handled by #2320); post-fix the file loads, edits, and
round-trips.
Fixes the crash family of #2559 / #2004 / #2320.
Signed-off-by: Jenny <jenny.sun@databricks.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Switching to a previously-viewed chat blanked the view and blocked on
two network fetches before rendering, every time — including switching
back to a chat opened seconds ago. Cache each conversation's rendered
transcript per client and paint it synchronously on switch-back, then
revalidate in the background: bindStream still refetches metadata and
history and reconciles by item id, so items committed while away still
land. In-flight live previews are never cached, the history cursor is
restored atomically so scroll-up paging keeps working, and the cache is
bounded by an LRU cap.
The changed-files panel gained per-file +N/-M line counts, threaded from
the filesystem registry through the runner endpoint to the web UI. But
the changed-files list has a second server-side builder: when a session's
runner is offline and the host holding the workspace answers over the fs
tunnel, WorkspaceReader.changes() shapes its own entry dict — and it
dropped the new lines_added / lines_removed fields, so the counts silently
vanished whenever the list was host-served.
Forward both fields there too, matching the runner endpoint exactly. The
underlying registry already populates them (host and runner share
create_filesystem_registry), so this is purely payload parity.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
omnigent-site now renders each blog post's title + author + date + reading-time
byline via a <BlogPostHeader slug="..." /> component. Update the drafter prompt
so generated posts use it: export the `meta` object (title/date/category/
author/heroArt), render <BlogPostHeader slug="SLUG" /> as the first body
element, and never hand-write a `# H1` title (the component draws it, so an H1
would duplicate the title).
Co-authored-by: Isaac
The host daemon snapshots PATH at spawn and never refreshes it, so a
codex or claude CLI installed into an nvm/npm-managed global bin dir
(only added to PATH by interactive shell init) is invisible to
shutil.which. Native Codex readiness then reports 'binary-missing' and
the claude-sdk executor can't find its system CLI — even though a
foreground launch works, because that runs in the interactive shell's
PATH.
Add a shared resolve_cli_binary(name, env_var) in _platform.py:
override env var -> PATH -> a ladder of common global install dirs
(~/.local/bin, /usr/local/bin, /opt/homebrew/bin, ~/.npm-global/bin).
Route _find_codex_cli (OMNIGENT_CODEX_PATH) and _find_system_claude
(OMNIGENT_CLAUDE_PATH) through it, and the codex readiness gate too, so
the readiness verdict and the actual launch can't disagree. Update the
codex binary-missing UI message and the ImportErrors to point at the
real fix (restart the host, or set the override) instead of 'omnigent
setup', which doesn't address a stale PATH snapshot.
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* fix(ci): make feature-blog drafts read user-facing, not machine-generated
The first drafted posts leaked the prompt's skeleton labels as literal text
("Who it's for:", "The problem it solves"), buried the reader in
implementation detail (per-harness verification status, internal component
names, harness ids), and overused " — " dashes that read as AI-generated.
Rework the drafter prompt:
- The 5 items are the post's SHAPE, not headings or sentence lead-ins. Only the
H1 title is a heading; everything else is flowing prose. Explicitly ban the
label phrases as headings or sentence starts.
- Add a "Voice and content rules" section: write what the user can DO (not how
it's built/verified); never list harness ids / component names / PR numbers /
verification caveats — say "works with any agent you run in Omnigent"; cap the
whole post at one dash; plain, active, no marketing adjectives.
Co-authored-by: Isaac
* feat(ci): surface drafted post body for dry-run review
A dry_run=true run opens no PR and the workflow didn't upload the drafted
page.mdx, so the actual post body was invisible — you could only see the
drafter's narration + summary. Copy each drafted post to /tmp/post_<i>.mdx
(added to the uploaded artifact) and render it into the job summary inside a
collapsible block, so the post can be reviewed on a dry run without opening a
PR. Also rename the upload step to reflect that it runs on success too.
Co-authored-by: Isaac
* fix(ci): find drafted post via -uall (untracked dir hid page.mdx)
`git status --porcelain` collapses a brand-new untracked directory to
"app/blog/<slug>/" and never names page.mdx inside it, so `grep page.mdx`
returned empty and `$post` was blank. That silently skipped everything guarded
on $post: the CTA footer, the HTML-comment guard, and the drafted-post
copy/summary — the post still committed via `git add -A`, so it looked fine.
Add -uall to both porcelain reads so individual new files are enumerated.
Co-authored-by: Isaac
Remove the daily weekday cron trigger from the Reviewer SLA workflow so it
no longer auto-pings reviewers, adds second reviewers, and labels open PRs
awaiting review. Keeps workflow_dispatch so the sweep can still be run
manually if needed.
Co-authored-by: Isaac
* Show per-file and total line-change counts in changed-files panel
Add +N/-M line-change counters beside the A/D/M badge for each file in the
changed-files panel, plus totals in the "Changed N" header. Line counts come
from git numstat, computed at the record source and threaded through the
runner API to the web UI (also used by desktop and iOS webview clients).
Binaries and non-git workspaces render no count. No backend consumer outside
the web UI.
* Refine changed-files line counts: right-align status, drop size and untracked/total stats
- Move the A/D/M status badge to the right of each row; left-align the
filename with a muted parent-directory suffix.
- Remove the per-row file-size label from the changed-files list.
- Only surface line counts from `git diff HEAD` (numstat); untracked files
no longer read off disk to count lines, matching VS Code / Cursor.
- Drop the +/- line totals from the "Changed" header pill.
Co-authored-by: Isaac
* Hoist git subprocess timeout into a shared _GIT_TIMEOUT_SECONDS constant
All four git calls backing the changed-files view shared a literal
timeout=5. Name it once so the cap can be tuned in a single place.
Co-authored-by: Isaac
* Hide the line-count badge for mode-only changes; clarify rename docstring
- A chmod-only edit surfaces in numstat as 0/0; suppress the "+0 −0" badge
(it's noise) while still rendering a real deletion's −N.
- Clarify the _run_git_numstat docstring: with --no-renames a pure rename
shows +N on the destination, not (None, None).
Co-authored-by: Isaac
---------
Co-authored-by: Anthony Ivan <anthony.ivan@example.com>
Co-authored-by: Serena Ruan <serena.rxy@gmail.com>
Sample the omnigent server process's CPU% and RSS memory in a 1-second
background thread (BenchEnvironment._sample_resources via psutil) for the
full duration of each benchmark run. Summarise as mean/min/max/samples and
emit under a top-level 'resource_usage' key in the JSON report.
Schema bumped to version 3 so the workspace ETL can branch on it.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Native TUI CLIs that read LC_ALL / LANG directly (opencode, pi, hermes)
rather than calling POSIX setlocale render multibyte UTF-8 as mojibake when
the inherited env has an empty LANG and no LC_ALL (only a UTF-8 LC_CTYPE,
as in a minimal container). They fall back to an ASCII/Latin-1 codeset and
re-encode their own UTF-8 output byte-by-byte; because the corrupt bytes
are what the CLI physically writes to the tmux pane, the garbling shows up
in the raw terminal view too. CLIs that call setlocale (claude, codex) are
unaffected because glibc honors LC_CTYPE.
TerminalInstance.launch now forces LANG=LC_ALL=C.UTF-8 into the pane spawn
env when the inherited env carries no UTF-8 signal in the vars those CLIs
actually read. A UTF-8 LC_CTYPE alone is not treated as a signal (it does
not help them). Operator-provided UTF-8 locales are preserved; a pinned
non-UTF-8 LC_ALL is corrected; no-op on Windows (tmux panes are POSIX-only).
C.UTF-8 is used because it needs no locale archive and so is present on
minimal images where en_US.UTF-8 is not.
Helpers _is_utf8_locale_value / _has_utf8_locale / _apply_utf8_locale_default
are pure and unit-tested: codeset parsing, POSIX LC_ALL-over-LANG precedence,
the LC_CTYPE-only repro config, operator-locale preservation, non-UTF-8
LC_ALL correction, and the Windows no-op.
Closes#2427
Signed-off-by: abhay-codes07 <abhaysingh0293@gmail.com>
* fix(sessions): stop running child sub-agents, not just the parent, before archive/delete
_best_effort_stop used the child-rollup status only to decide whether to act, then always issued the stop against the parent's own session id. A parent that had gone idle while a sub-agent child kept running got a no-op stop, and the child was then orphaned by the recursive subtree delete/archive (still running, but unreachable via the API).
Signed-off-by: Nick Chakre <nickchakre18@gmail.com>
* fix(sessions): walk the full sub-agent tree, not just direct children
_best_effort_stop only checked one level of children, but delete_conversation's recursive subtree delete has no depth limit. A running grandchild (or deeper descendant) was invisible to the one-level check and stayed orphaned exactly like the original bug. Now walks the whole descendant tree level by level and stops every running/waiting descendant at any depth.
Addresses review feedback from TomeHirata on PR review.
Signed-off-by: Nick Chakre <nickchakre18@gmail.com>
---------
Signed-off-by: Nick Chakre <nickchakre18@gmail.com>
The Open-draft-PRs step created the PRs but only logged the already-open case
to the job summary, so a normal run left no clickable link to the drafts it
opened. Capture `gh pr create`'s stdout URL and write a "Draft blog PRs"
section with a markdown link per feature (both newly created and
force-push-updated existing drafts).
Co-authored-by: Isaac
The drafter emitted the demo placeholder as an HTML comment
(`<!-- DEMO REQUIRED ... -->`), which is invalid in MDX — only `{/* ... */}`
works. It passed prettier's fmt:check but broke the site's `next build`
(page.mdx:36 "Unexpected character !"), so every generated blog PR failed CI.
- Change the drafter's demo marker to an MDX comment `{/* DEMO REQUIRED ... */}`
and update the summary reference to match.
- Add a fail-fast guard in the workflow: if the drafted page.mdx contains any
`<!--`, abort before opening the PR so we never ship a build-red PR again.
Co-authored-by: Isaac
The forwarder's _PostRetryTracker exhausts only permanent 4xx failures
(_is_permanent_http_error = 400 <= status < 500); a 503 is treated as
transient and retried forever with backoff. The runner's
`subagent_delivery_not_confirmed` 503 -- a terminal sub-agent result that
could not be delivered to the parent inbox -- is usually a brief dispatch
race and should be retried, but when the parent host is gone the condition
is permanent, so unbounded retries let a single orphaned sub-agent flood
the shared server indefinitely.
Add `_is_subagent_delivery_not_confirmed()` (a 503 whose JSON body carries
error == "subagent_delivery_not_confirmed") and bound this class to
_SUBAGENT_DELIVERY_NOT_CONFIRMED_MAX_ATTEMPTS (12). The budget spans the
backoff schedule (capped at 30s) -- a few minutes, comfortably covering the
dispatch race -- after which the entry is dropped as exhausted (and
non-permanent, since the failure is environmental). Generic 5xx retry
behaviour is unchanged.
Signed-off-by: abedegno <jon@jonwilliams.org.uk>
chatStore was invalidating ["conversation", convId, "items"] on turn
completion, but useSessionItems registers its cache under
["session", sessionId, "items", "raw"]. The key mismatch meant the
execution-logs panel's cache was never invalidated by SSE, so the
panel stayed stale after a turn ended and relied solely on its 3s
refetchInterval to show new items.
Import sessionItemsQueryKey from useSessionItems and use it in the
invalidateQueries call so the hook's cache is actually invalidated
when a session turn completes.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
Add a `max_posts` workflow_dispatch input (default 3) so a manual run can ask
for more or fewer blog drafts. The guard step sanitizes it to a positive
integer, and the value is threaded into both the scout prompt (told to return
at most N, ranked) and the parse step's defensive cap (cands[:max_posts]),
replacing the hardcoded 3. The scout config's cap wording now defers to the
run-supplied limit. A real release cut (workflow_run) still uses the default.
Co-authored-by: Isaac
The omnigent-site blog surface now exists on main (app/blog/ layout + index +
lib/blog.js scanner + nav link, from omnigent-site#334). The drafter must stop
scaffolding it — its runs were nondeterministic (one candidate invented the
whole layout/index/nav, others wrote only the post), producing incoherent,
merge-order-dependent PRs. Tighten the prompt so the drafter creates ONLY
app/blog/<SLUG>/page.mdx, reads existing posts + lib/blog.js read-only to match
conventions, and flags any missing infra under "Manual review needed" rather
than inventing site plumbing that can break the build.
Co-authored-by: Isaac
The omnigent-site CI gates on `prettier --check .`, and LLM-generated MDX/JS
(plus the CTA footer the workflow appends) is rarely prettier-clean, so draft
PRs fail `fmt:check` on arrival. Run `prettier --write` on the drafter's
changed files from inside the site checkout — so it picks up the site's
.prettierrc.json + .prettierignore — before staging and committing. Pinned to
prettier@3 (the site's major). Non-fatal: a formatting failure logs a warning
and commits anyway, since these are human-reviewed draft PRs and CI still
reports residual issues.
Co-authored-by: Isaac
Add any_policies_apply() to builder.py — a cheap check that returns False
when the combined policy list (session + agent guardrails + server defaults)
would be empty. Call it in POST /policies/evaluate after loading the agent
spec, returning POLICY_ACTION_ALLOW immediately when nothing would fire —
matching what the engine returns when all policies pass.
This avoids the engine build and its associated conversation-store reads
(labels, state, usage) on every tool call hook for sessions with no policies
configured — the common case. The session-policy check uses the existing
LRU cache so it's a cache hit after the first call per session. Mid-session
policy additions invalidate the cache immediately, so newly added policies
are visible on the very next evaluate call.
sys_add_policy TOOL_CALL events always bypass the fast path: the engine
unconditionally injects _ASK_ON_ADD_POLICY_SPEC to require human approval
before an agent can install session policies. Passing phase and tool_name
to any_policies_apply() ensures that gate is never skipped.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): thread turn-initiating created_by as policy actor via runner
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(policies): verify runner-supplied actor overrides request identity at evaluate and MCP proxy
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): stash turn actor server-side to prevent body-based spoofing
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): bound _session_turn_actor with LRUCache; skip None on stash; fix test cleanup
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(host): silently refresh Databricks token on /v1/me 401 before failing
When omnigent-host.service starts in headless mode and the stored OIDC
token has expired, _ensure_databricks_server_auth probes /v1/me, gets
401, and immediately raises ClickException — crashing the daemon before
the tunnel is ever attempted.
Fix: before giving up, attempt a silent SDK token refresh via
_databricks_workspace_token (which calls _resolve_databricks_auth and
mints a fresh bearer from the cached OAuth grant). If the retry succeeds
(HTTP 200), return normally so the daemon continues to start. Only raise
the ClickException if the SDK has no valid grant either.
This is the root cause of the mass runner-stranding incident, where an
expired OAuth token caused 32+ crash-loop restarts of the host daemon,
killing all 48 runner processes simultaneously.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): persist turn actor to conversation labels for cross-replica safety
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* style: ruff format sessions.py
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): guard omnigent.turn_actor label against client writes; drop unrelated cli.py change
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): guard omnigent.turn_actor on multipart bundle-create path; drop dead created_by runner body field
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* refactor(policies): simplify turn-actor label guard; trim comment; drop redundant None check
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* docs(policies): document turn-serialization gap and native-terminal bypass; restore None guard on mcp_conv
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(fork): drop CLI-specific launch args when a fork switches harness
Forking a Claude Code session onto pi failed to start with
`required_terminal_exited`. The fork copied the source's
`terminal_launch_args` verbatim, so `--permission-mode auto` (a Claude
Code flag) reached the pi argv; pi rejects the unknown option and exits 1
at launch, taking the required terminal — and the session — down with it.
Launch flags are CLI-specific and must not survive a cross-CLI switch:
- `fork_conversation` gains `copy_terminal_launch_args` (default True);
the fork route passes `not switching_agent`, so a same-agent fork still
inherits flags but an agent switch starts with clean args.
- `switch_conversation_agent` (in-place claude->pi switch, same latent
bug) now clears `terminal_launch_args` alongside `external_session_id`.
Co-authored-by: Isaac
* test(fork): teach route-test fake store the copy_terminal_launch_args arg
The route fake's fork_conversation lacked the new keyword-only parameter,
so every forking route test raised TypeError. Add it to the signature,
record it in fork_calls, and assert the route's switch-gated wiring:
False on an agent switch, True on a same-agent fork.
Co-authored-by: Isaac
* fix(runner): recover cold-resume context when server GET returns null external_session_id
On reconnect, the GET /v1/sessions/{id} may return external_session_id=null
due to a workspace-scope ContextVar defaulting to 0 on fresh tasks. The runner
then launches a fresh Claude session and loses all conversation context.
- app.py: after the GET block in _auto_create_claude_terminal, fall back to
read_claude_session_id(bridge_dir) if session_external_id is still None; the
local bridge state file survives reset_transcript_forward_state and holds the
previous claude_session_id, so we use it as the resume hint.
- claude_native_forwarder.py: on a 400 PATCH rejection in
_maybe_mirror_external_session_id, fetch the server-bound external_session_id
and include both the rejected sid and the server-bound sid in the warning so
operators can identify which session retains the context.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(runner): capture bridge claude_session_id before prepare_bridge_dir wipes it
The cold-resume fallback read read_claude_session_id(bridge_dir) after
prepare_bridge_dir had already deleted _STATE_FILE, so it always returned
None and the fallback was dead code.
Fix: read read_claude_session_id from the pre-wipe bridge dir (computed via
bridge_dir_for_bridge_id using the bridge_id already resolved at that point)
before the prepare_bridge_dir call, stash the result, and use the stash in
the fallback block.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* test(runner): assert cold-resume fallback reads bridge sid before prepare_bridge_dir wipes it
Adds a test for the ES-2065116 fix: when the server snapshot omits
external_session_id (workspace-scope miss), the runner falls back to the
claude_session_id written in state.json by the prior launch. The test
pre-populates state.json before _auto_create_claude_terminal runs and
asserts _ensure_local_claude_resume_transcript is called with the local
sid, proving the read happens before prepare_bridge_dir deletes the file.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* revert(forwarder): remove diagnostic GET on 400 PATCH rejection
The extra snapshot fetch on 400 was purely for logging and adds an
unnecessary round-trip. Restore the original single-line warning.
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
PR #2764 extracted the LLM-runner scaffold (uv + Claude Code CLI + gateway
provider config + agent run + stdout secret-scan) into the composite action
.github/actions/run-omnigent-agent, now shared by draft-release-notes.yml and
publish-changelog.yml. feature-blog.yml still inlined all of it.
Replace the five setup steps + the scout run + its secret-scan with one
`uses: ./.github/actions/run-omnigent-agent` for the tools-less scout (−54
lines). The per-candidate drafter loop still calls `omnigent run` directly —
it interleaves git operations between invocations, which the single-shot
action can't model — and reuses the environment (PATH, ~/.omnigent, .venv)
the action provisions when the scout runs.
Co-authored-by: Isaac
* test(proc): de-flake process_alive nondestructive-probe PID-recycling race
Pin the child via psutil.Process(pid) so the post-teardown liveness
assertion can't be fooled by a recycled PID masquerading as the reaped
child, removing the process_alive(pid) TOCTOU race in the test.
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* test: pin psutil handle in terminate_tree test to kill PID-recycling race
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
---------
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* adjust slack bot behavior so that in channels only @ trigger omnigent, but in DMs, threads strictly map to sessions
streaming text and take advatange of markdown_text support; build towards multi-user support in the slack integration
improve placeholder experience and the ability to handle closed streams
device grant to support accounts-based auth for slack integration
slack integration now supports both accounts and oidc auth
* pre-commit clean-up
* slack socket server security enhancement
* improve security posture
* update uv.lock
* fix test failures: CI builds no web SPA, so the SPA catch-all mount at / is absent
* feat(auth): read the OIDC email identity from a configurable id_token claim
_resolve_oidc_email reads only the email claim and hard-fails when it is
absent. Microsoft Entra ID commonly issues id_tokens that carry the user
identity in preferred_username (the UPN) with no email claim at all, so
native OIDC login against Entra fails with "Could not determine user
email" and nothing actionable in the logs.
Add OMNIGENT_OIDC_EMAIL_CLAIM (default: email), mirroring oauth2-proxy's
--oidc-email-claim: the operator names the id_token claim that carries
the email identity. The default path is unchanged. A custom claim always
requires the existing OMNIGENT_OIDC_SKIP_EMAIL_VERIFICATION opt-out:
email_verified refers to the email claim (OIDC core), so it vouches
nothing about a custom identity claim, and a token carrying
email_verified true for a different address must not smuggle the custom
claim past the gate. The absent-claim rejection now logs the configured
claim and the claim names present.
Only the generic-OIDC path is affected; GitHub OAuth has no id_token.
Tests: a UPN-only token mints a session with the claim configured plus
the opt-out; a custom claim without the opt-out is rejected both with no
verified marker and with email_verified true referring to a different
email claim; a token missing the configured claim is rejected even when
a verified email claim is present (no silent fallback).
Signed-off-by: Robert Dosen <robert.dosen@gmail.com>
* fix(auth): reject malformed OIDC identity claims
Signed-off-by: rdosen <robert.dosen@gmail.com>
---------
Signed-off-by: Robert Dosen <robert.dosen@gmail.com>
Signed-off-by: rdosen <robert.dosen@gmail.com>
A session's selected working folder (snapshot.workspace) was honored by the
Files panel / primary OS environment (see per-session-workspace fix) but NOT by
the spawned harness subprocess. _build_spawn_env_from_spec received the runtime
cwd and forwarded it only to pi/kimi; codex, claude-sdk, cursor, qwen, goose,
and copilot builders never set their HARNESS_<H>_CWD env var, so the harness
subprocess (e.g. codex reading HARNESS_CODEX_CWD) fell back to cwd=None and
inherited the runner's launch directory instead of the session workspace.
Thread cwd into all six builders (set HARNESS_<H>_CWD when provided) and pass
cwd=cwd at the dispatch call sites. Mirrors the existing pi/kimi handling.
Adds a parametrized regression test locking cwd threading for all six.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Co-authored-by: jykim-bagel <jykim@bagel-labs.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* docs(releases): match the real MLflow release-post format
The first pass mirrored the whole release body — every feature bulleted into a
numbered section, a "Fixes & improvements" section, and PR refs carried through.
The actual mlflow.org/releases posts are curated: only the outstanding features
get a section, there is no bug-fixes section, and there are no PR links.
Rework the release-post-formatter prompt to:
- curate down to the ~4-6 outstanding features and drop minor items entirely,
- omit the bug-fixes section (comprehensive changes live behind Full Changelog),
- drop all PR references from the post,
- write each feature as what-it-is + how-to-use-it, and
- emit per-feature demo and docs-link placeholders (literal TODO) for a human to
fill in on the auto-opened PR, since the release body carries no media or URLs.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* docs(releases): pre-fill real docs links, omit when none match
Instead of a blanket TODO "Learn more" placeholder, give the formatter the list
of the site's real /docs pages (URL + title) and have it link each feature to a
matching page — or omit the line entirely when nothing fits.
- publish-changelog.yml builds a docs index from a blobless sparse checkout of
the public omnigent-site app/docs tree (no token) and feeds it to the prompt;
best-effort, so a fetch failure just yields an empty index (links omitted).
- The formatter links only to a verbatim URL from that list, never guesses or
emits a TODO doc link. The demo image stays a TODO placeholder for a human.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* docs(releases): link features to the most specific docs section
Page-level docs links are coarse — an ACP-harness feature should point at
/docs/build/harnesses#custom-acp-agents, not the whole page. Index each doc
page's h2/h3 section anchors alongside the page itself and let the formatter
pick the most specific match.
- The docs-index step now emits indented `url#slug <TAB> title` rows per section,
computing the slug with the same algorithm the site's HeadingAnchors uses so
the anchor resolves. It skips fenced code blocks and reduces `[label](url)`
headings to their label (the site slugs rendered text).
- The formatter prompt prefers a matching #section anchor over the bare page,
and still omits the "Learn more" line when nothing fits.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(policies): wire PolicyStore in Docker entrypoint and thread session owner as actor
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): prefer authenticated caller over session owner as actor
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* fix(policies): skip get_session_owner DB call when user_id is present; add actor fallback tests
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
* revert(policies): remove get_session_owner fallback from actor resolution
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
---------
Signed-off-by: Tomu Hirata <tomu.hirata@gmail.com>
test_control_bridge_burst_then_exit_delivers_full_tail relied on a fixed
sleep(10.0) to let the reader drain the tmux control stream, which was slow
and still racy under load. Add two inert, default-None asyncio.Event hooks
(reader_done / forward_done) to bridge_tmux_control_to_websocket that fire
when the reader and forwarder finish, and switch the test to wait on those
events instead of a wall-clock sleep.
The hooks default to None, so the hot path is unchanged for real callers;
only the test opts in. Target test now completes in ~2s (was ~10s).
Co-authored-by: Isaac
Signed-off-by: Pat Sukprasert <pattara.sk127@gmail.com>
* docs(releases): reformat website release posts in MLflow narrative style
The website /releases/<version> post was a verbatim mechanical mirror of the
GitHub Release body (emoji bullets). Reformat it into the narrative, prose-driven
style of mlflow.org/releases, while leaving the GitHub Release notes untouched.
- New release-post-formatter agent rewrites the curated release body into an
intro summary + numbered prose feature sections (no emoji), preserving every
PR ref and inventing nothing. Same tools-less security posture as
release-notes-drafter.
- publish-changelog.yml gains the LLM machinery to run it, degrading to the raw
release body on any failure, plus a workflow_dispatch dry_run mode that renders
and prints the page (log + job summary) without minting a token or opening a PR.
- release_to_mdx.py adds MLflow-style site chrome the release body can't carry: a
byline (date + read time + author) and a "What's Next" footer. Keeps the exact
_Released <date>_ token the site index reads.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* refactor(ci): extract shared LLM-runner into a composite action
The publish-changelog release-post formatter reused ~150 lines of the
draft-release-notes LLM machinery (uv, venv cache, Claude CLI, provider config,
agent run, output secret-scan) verbatim. Extract it into a
.github/actions/run-omnigent-agent composite action and call it from both
workflows, so the runner scaffold lives in one place.
- The action takes a workdir input so it works whether the repo is checked out
at the workspace root (draft-release-notes) or in an omnigent/ subdir
(publish-changelog), driving the venv path, cache key, and uv --project/agent
paths off it.
- The action now always secret-scans the agent output when it runs (gated by the
caller's creds check), instead of the old outcome=='success' gate that also
skipped the scan when the step was skipped.
- Callers keep their own prompt-build, output-extract/fallback, and artifact
redaction; only the shared scaffold moved.
Co-authored-by: Isaac
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
---------
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
* fix(sandbox): grant the private scratch tmpdir before the spawn-time wrap
A darwin_seatbelt claude-sdk seat booted the sandbox-exec wrap but then
died with `FileNotFoundError: No usable temporary directory` — the
follow-up to the seatbelt cluster (#2743/#2749).
run_launcher runs twice for spawn-wrap backends: the host pass builds the
wrap (baking the seatbelt SBPL profile / bwrap binds) and execvp's into
it; the in-wrap pass activates and runs the target. The private scratch
tmpdir was minted only in the in-wrap pass, via mkdtemp() against $TMPDIR
= the system tempdir root — which the already-baked profile only granted
a subpath of. bwrap masked this via its --tmpfs /tmp fallback, so only
seatbelt (no tmpfs, $TMPDIR always set on macOS) hit it.
Mint + grant the scratch dir on the host BEFORE the wrap (the pattern
_HelperProcessClient._start_locked already uses), re-encode the policy so
both the profile and the in-wrap pass see the granted root, and hand the
path to the in-wrap pass via a marker env var so it adopts that exact dir
and owns cleanup. The marker is retained through the spawn-env prune;
using it (not _scratch_tmpdir re-derivation) for cleanup avoids rmtree'ing
a spec-supplied write root like /tmp.
Verified on a real Mac: the reported FileNotFoundError reproduces pre-fix
and is gone post-fix; a jailed claude-sdk seat boots through to the
provider. Adds macOS-gated (seatbelt) and Linux-gated (bwrap) end-to-end
regression tests driving the full create_exec_launcher -> run_launcher
two-pass re-exec.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
* test(bwrap): allow .venv under the granted project-root read root
The dotfile masker tmpfs-masks hidden dirs under read roots, which hid
the project .venv from the in-wrap re-exec — the inline import of
omnigent.inner.sandbox died with ModuleNotFoundError: yaml before the
tmpdir path ever ran. The seatbelt twin already carries this allowance.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
---------
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
* fix: use a private mode-700 dir for the modal foreground pidfile
exec_foreground recorded the remote pid at a fixed, predictable path in the
world-writable /tmp (/tmp/oa-foreground.pid). A co-tenant process in the
sandbox could pre-seed that path as a symlink (so `echo $$ > ...` writes
through it) or overwrite its contents (so `kill $(cat ...)` signals an
arbitrary pid).
Record the pid in a private, unpredictably-named dir created with
`mkdir -m 700` (no -p, so it fails closed if the path already exists), and
only signal a numeric pid read back from that file before removing the dir.
Update the tests to assert the new structure instead of the fixed path.
Signed-off-by: agharsallah <17379925+agharsallah@users.noreply.github.com>
* fix: resolve symlinks before trusting a SQLite path as a test DB
looks_like_test_db accepted a file-backed path on its 'test' name token or its
temp-dir location without resolving symlinks first. A symlink planted in a
world-writable dir like /tmp (e.g. sqlite:////tmp/test.db) could therefore
point a 'throwaway' test DB at a real database and pass the guardrail.
Resolve the path before the token and temp-dir checks so the resolved target
is what gets classified, and add a regression test covering a test-named
symlink that resolves outside any temp root.
Signed-off-by: agharsallah <17379925+agharsallah@users.noreply.github.com>
* fix: share safe foreground-pidfile helper across sandbox launchers
Extract a single fail-closed foreground-pidfile implementation into
base.py (foreground_pidfile / foreground_record_prefix /
foreground_kill_command) and route Modal, CoreWeave (cwsandbox), and
OpenShell through it, closing the same /tmp symlink-redirect + pid-spoof
vector the Modal-only fix addressed in two other shipped providers.
- cwsandbox: drops the vulnerable fixed /tmp/oa-foreground.pid and
unvalidated 'kill $(cat ...)' — now uses the private mode-700 dir
with a numeric-gated kill. Adds exec_foreground regression tests
(none existed before) and extends the cwsandbox fake to record exec
commands and raise on wait.
- openshell: drops the predictable {sandbox_id} pidfile template and
unvalidated kill for the shared, numeric-gated path.
- modal: drops its inline copy and imports the helper; behavior
unchanged for the security properties.
- All three: clean up the run dir on normal exit too (previously only
on Ctrl-C), so a successful run no longer orphans a mode-700 dir.
- Helper hardening: shlex.quote the derived run_dir/pidfile inside
foreground_record_prefix and foreground_kill_command so the public
API stays injection-safe even if a future caller passes a non-hex
path. Hex paths quote harmlessly.
All 268 tests/onboarding/sandboxes tests pass; ruff check + format clean.
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
---------
Signed-off-by: agharsallah <17379925+agharsallah@users.noreply.github.com>
Signed-off-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
Co-authored-by: Zeyi (Rice) Fan <zeyi.f@databricks.com>
* Support commenting in PDF viewer
Signed-off-by: kevin-lyn <kevin.lin@databricks.com>
* Apply prettier formatting to PDF comment helpers.
* Add e2e coverage for PDF comment selection and highlights.
Exercise the full PdfViewer flow: text-layer drag selection, floating add-
comment button, pending/saved highlight overlays, and PDF geometry anchors
via the comments API.
* e2e test
Signed-off-by: kevin-lyn <kevin.lin@databricks.com>
---------
Signed-off-by: kevin-lyn <kevin.lin@databricks.com>
- Offer the trusted vendor installer from the Hermes setup menu
- Refresh ~/.local/bin so configuration can continue without restarting
Co-authored-by: sabhya-db <sabhya.chhabria@databricks.com>
cursor-sdk's AsyncBridge.launch spawns the bridge subprocess without a
cwd=, so the bridge -- and the shell tools Cursor runs inside it --
inherited the runner daemon's directory instead of the spec's
os_env.cwd. --workspace only routes indexing, not command execution, so
pwd / git / relative paths operated on the wrong tree.
Set the process cwd to the resolved workspace across
AsyncClient.launch_bridge and restore it afterwards, serialised by a
process-global lock so an overlapping launch can't observe a
half-applied cwd. The underlying Popen(cwd=...) fix belongs upstream in
cursor-sdk; this compensates from the executor since the SDK is an
external dependency.
Refs #2111
cursor_policy_hook is the preToolUse gate for the Cursor SDK harness's native tools. On two failure branches it returned {"permission": "allow"}, so a transient Omnigent-server outage (resp is None after the retry budget) or a malformed response silently skipped DENY/ASK policy enforcement.
Fail closed with deny on both, matching hermes_policy_hook and the native hooks' fail_closed_hook_output (PR #163), and honoring post_evaluate_with_retry's documented contract that the caller handles None as fail-closed. The no-server, stdin-parse, and import-error branches keep failing open, exactly as the sibling hooks do.
Signed-off-by: Enes Yilmaz <enesyilmaz5157@gmail.com>
A watchdog-cancelled turn raises asyncio.CancelledError, which is a
BaseException and bypasses run_turn's except-Exception cleanup boundary.
The wedged ClaudeSDKClient stayed cached in _clients, so every resume
reused it, emitted no events, and re-tripped the 240s idle watchdog;
the session was unrecoverable until a daemon restart.
Catch CancelledError at the same boundary, synchronously pop the client
and force-close it in a background task (awaiting a graceful close there
could itself be cancelled), then re-raise. The session is not crash-marked:
the next turn rebuilds a fresh client and replays history through the
text-prefix path.
Closes#2109
Signed-off-by: Enes Yilmaz <115046343+EnesYilmazcode@users.noreply.github.com>
Wrap failures used to kill the seat at connect time: resolve_sandbox
raised straight out of prepare_claude_cli_path, and wrap-time OSErrors
(un-grantable interpreter layout, profile-size cap, cwd-scan overflow)
fired inside run_launcher where they surface as an opaque exit-71 /
60s connect timeout.
Probe the wrap at prepare time — the last point where degrading is
still safe — and on failure return the CLI unwrapped with native tools
disabled plus a WARNING: the same confinement shape as the
OMNIGENT_CLAUDE_SDK_NO_SANDBOX bypass (file/shell access stays on the
independently sandboxed sys_os_* helpers, which fail closed on their
own). run_launcher itself stays fail-closed for every other lane.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
Port the two bwrap visibility behaviours seatbelt never got:
- Walk argv[0]'s symlink chain hop-by-hop and grant a literal read on
every uncovered symlink (uv's version-floating cpython-3.12 dir hop
was denied, EPERM-ing every jailed helper execvp at boot).
- Stop discarding the launcher target: grant its symlink chain plus a
narrow subpath on the resolved binary's own directory so the wrapped
CLI (e.g. claude) is readable inside the sandbox. Never raises —
un-grantable layouts degrade to a literal grant plus a WARNING.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
* perf(policies): remove unused trajectory DB read from policy evaluation
EvaluationContext.trajectory was populated on every POST /policies/evaluate
call via a list_items() query (last 10 conversation items), but no policy
implementation ever read it — FunctionPolicy, PromptPolicy, and LabelPolicy
all ignore ctx.trajectory. The fetch was dead work on every tool call hook.
Remove _populate_trajectory, _TRAJECTORY_WINDOW, EvaluationContext.trajectory,
and the now-unused ConversationItem import. Eliminates one DB read per
policy evaluation, which fires multiple times per turn across all harnesses.
* fix(ci): remove trajectory test, fix hosts_changed e2e health mock
- Delete test_engine_trajectory.py: tested EvaluationContext.trajectory
which no longer exists after removing the trajectory DB read
- Fix test_hosts_changed_frame_updates_host_badge: stub /health to return
empty sessions so liveOnline stays undefined; without this the health
poll sets liveOnline=null (no real host bound), overriding the useHosts
mock and preventing the badge from ever showing "online"
Since #2228 the tunnel route registers hosts under the bare-hex id,
but REST callers can still present the legacy host_<hex> spelling
(pre-migration config.yaml + older CLIs). Every DB path normalizes
via uuid_to_bytes, so GET /v1/hosts reported such hosts online while
the launch path's exact-string registry lookup missed the live
tunnel and 409'd "host is offline" — deterministically, straight
through the CLI's transient-409 retry ladder.
Canonicalize the key inside HostRegistry itself (register / get /
deregister), falling back to the verbatim string for ids that are
not uuid-shaped. One guard at the choke point covers
_host_launch.py, _workspace_validation.py, and any future caller,
and keeps HostConnection.host_id consistent with its storage key
(send_text's replaced-connection check relies on that).
Fixes#2740
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
A bwrap-sandboxed helper became unspawnable when the sandbox cwd was an
ancestor of the helper interpreter and the interpreter lived under a
dotdir (e.g. a `uv tool`-installed omnigent at
`~/.local/share/uv/tools/omnigent/bin/python` with cwd=$HOME). The
dotfile masker `--tmpfs`-masks `.local`, and since the mask is emitted
last to win over broad binds, it hid the interpreter and bwrap died with
`execvp ...: No such file or directory`.
Two interacting causes, both fixed:
- bwrap masker: `_ensure_executable_visible` emitted no explicit binds
for an interpreter that cwd nominally covers, so the `--tmpfs` mask
hid it with nothing to restore it. Now, after the mask, re-expose the
interpreter (and target) chain scoped strictly inside the masked dir,
so it layers over the mask and reaches exactly the interpreter subtree
— `.local` stays masked, only the interpreter dirs poke through.
- claude-sdk cwd: a relative `os_env.cwd` (the default ".") resolved
against `os.getcwd()` landed on the runner daemon's $HOME when no
workspace was selected — rooting the sandbox at the whole home dir and
disagreeing with the tmux terminal. Resolve relative cwds against
OMNIGENT_RUNNER_WORKSPACE (both sandbox-wrapping paths) and fall the
harness CLI cwd back to it, mirroring the kimi/pi/hermes harnesses.
Signed-off-by: Aditya Devarapalli <adityareddyd2@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(seatbelt): allow file-read-metadata globally so Bun's startup fstat() survives the sandbox
The bundled `claude` CLI runs on Bun. Bun's WriteStream constructor calls
fstat(2) on its inherited stdout/stderr pipe file descriptors at startup for
ANSI-color / TTY detection (internal:util/colors, fs/streams:244). Pipe fds
have no filesystem vnode path, so they match no path-scoped
`(allow file-read-metadata "...")` literal. Under the seatbelt profile's
deny-by-default policy the fstat returns EPERM, crashing the Bun process
before it emits any stream-json. The SDK connect handshake then never
completes and dies with "Claude SDK connect timed out after 60s". The failure
presents as a network/timeout bug but is a sandbox denial on a metadata syscall.
Only reproducible on the intersection macOS + darwin_seatbelt + claude-sdk;
with `sandbox.type: none` the same run succeeds, confirming the sandbox (not
the harness/auth) is the cause.
Fix: grant `file-read-metadata` globally (no path filter) in the SBPL
baseline, right after the existing global `(allow file-ioctl)`. This allows
fstat() on any fd including pipes. It grants inode metadata only
(stat/fstat/access/getattrlist) and does NOT grant file data access
(file-read* is unchanged), directly analogous to the baseline's existing
global `(allow file-ioctl)`.
Security note (stated honestly): this widens a metadata oracle — a sandboxed
agent can confirm file existence anywhere on the filesystem (it still cannot
read contents). Acceptable for single-tenant developer/operator use; an inline
caveat flags it for multi-tenant deployments, where maintainers may prefer a
narrower scope (metadata only on the inherited fds, or scoped to the sandbox's
own tree).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(cli): add CLAUDE_CODE_OAUTH_TOKEN to the local daemon env allowlist
CLAUDE_CODE_OAUTH_TOKEN is in HARNESS_CREDENTIAL_ENV_VARS
(omnigent/host/connect.py) so _build_runner_env forwards it host->runner, and
an existing comment there already notes it is needed "for `claude setup-token`
subscription auth". But the daemon env is built earlier by
_build_host_daemon_env (omnigent/cli.py), which admits only
_RUNNER_ENV_ALLOWLIST + _LOCAL_DAEMON_ENV_ALLOWLIST. CLAUDE_CODE_OAUTH_TOKEN
was in neither list, so it was stripped from the daemon's environment at
launch. The daemon then came up without the token, and _build_runner_env had
nothing to forward — the HARNESS_CREDENTIAL_ENV_VARS membership was moot
because the value had already been dropped one layer up.
Net effect: on a local (non-cloud) macOS run with the managed daemon, a
claude-sdk agent authenticated via `claude setup-token` (subscription) behaves
as if it has no credentials. ANTHROPIC_API_KEY does not hit this because it IS
in _LOCAL_DAEMON_ENV_ALLOWLIST — which is exactly why API-key auth works and
subscription auth doesn't.
Fix: add CLAUDE_CODE_OAUTH_TOKEN to _LOCAL_DAEMON_ENV_ALLOWLIST so it survives
the cli->daemon env strip and is then available for _build_runner_env to
forward to the runner.
Security: it's a credential and is treated as one — it joins the same
allowlist that already holds ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN and the
other provider keys. No new class of secret is exposed; a subscription token is
placed on identical footing to the API key alongside it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On signed, packaged macOS builds, registerWebAuthn() called
app.configureWebAuthn(...), enabling the macOS Secure-Enclave platform
authenticator. That routes the whole WebAuthn ceremony through Apple's
provider, which cannot complete a roaming USB security-key request (e.g.
YubiKey) against a third-party SSO relying party (Okta) — the ceremony dies
with an opaque NotAllowedError ("The operation either timed out or was not
allowed").
Remove the platform-authenticator machinery entirely (per review), rather
than gating it. The platform authenticator served no supported Databricks
sign-in path: Touch ID sign-in goes through Okta FastPass (Okta Verify over
the localhost loopback — handled by the LNA-permission code in main.js,
unrelated to WebAuthn), and browser-registered passkeys are invisible to the
Electron keychain access group anyway. With it gone, security keys always
drive Chromium's built-in CTAP path, so YubiKey/opt-out sign-in works.
Removed:
- registerWebAuthn(), the WEBAUTHN_KEYCHAIN_ACCESS_GROUP constant, and the
call site in app.whenReady().
- The now-dead keychain-access-groups entitlement (entitlements.mac.plist)
and its Developer ID provisioning profile (signing/omnigent.provisionprofile
+ the provisioningProfile ref in package.json), which existed solely for
this feature. Removing them also eliminates the documented AMFI-SIGKILL
foot-gun those three coupled pieces created.
- The stale Passkeys (WebAuthn) section in README.md, rewritten to explain
why the platform authenticator is intentionally not enabled.
- The keychain-access-groups example in entitlements.mac.inherit.plist,
replaced with a general restricted-entitlement caution.
Because no restricted entitlements remain, a Developer ID certificate alone
is sufficient for signing — no embedded provisioning profile is needed.
Co-authored-by: Isaac <isaac@omnigent.ai>
The model-setup add menu offered both "Gateway — custom base URL + key
(e.g. OpenRouter)" and a standalone "OpenRouter — API key" option, which
read as two ways to do the same thing and confused users during setup.
Drop OpenRouter from the Gateway label and description; users who want
OpenRouter should pick its dedicated option.
Co-authored-by: Isaac
Signed-off-by: Dhruv Gupta <dhruv.gupta@databricks.com>
N/A
## Summary
- Adds `omnigent://<hostname>/c/<session_id>` deep links to the iOS app, mirroring the Electron desktop shell (`designs/desktop-deep-link.md`): an OS-routed link opens that session on that server.
- Window handling: same-server → navigate in-place via the SPA router (no reload), deferred until the page finishes loading so a cold-start link isn't lost; known server (in recents / saved) → switch + load the conversation directly, no prompt; unknown server → native confirmation (pinning a new origin is a privilege grant), with the workspace-mount probe running ONLY after consent so a link to an attacker-chosen host makes no pre-consent network request.
- The conversation path never enters the saved server URL or recents (only the load URL carries it), so a later deep link resolves against a clean server identity; a new `omnigent:open-path` main→renderer channel (separate from the notification channel) routes in-place.
## Test Plan
- `xcodebuild build -project web/ios/Omnigent.xcodeproj -scheme Omnigent -destination 'platform=iOS Simulator,name=iPhone 17'` → BUILD SUCCEEDED.
- `xcodebuild test -only-testing:OmnigentTests ...` → TEST SUCCEEDED; 21 tests pass (8 new DeepLinkTests, 2 new SettingsStoreTests for knownServerURL, 11 existing), 0 failures.
- swift-format + swift-format lint + prettier pre-commit hooks pass on all changed files.
- Manual (simulator): `xcrun simctl openurl booted 'omnigent://<reachable-https-host>/c/<id>'` — same-server navigates in-place; a known server switches to it; an unknown server shows the consent alert. Requires the web UI rebuilt (`cd web && npm run build`) so the served SPA has the `onOpenPath` subscriber.
## Demo
N/A — no visible UI change beyond in-app navigation / a consent alert triggered by an external link. (QR-code scanning routes through the same `.onOpenURL` path, so a QR encoding the link opens the installed app identically.)
## Type of change
- [ ] Bug fix
- [x] Feature
- [ ] UI / frontend change
- [ ] Refactor / chore
- [ ] Docs
- [ ] Test / CI
- [ ] Breaking change
## Test coverage
- [x] Unit tests added / updated
- [ ] Integration tests added / updated
- [ ] E2E tests added / updated
- [x] Manual verification completed
- [ ] Existing tests cover this change
- [ ] Not applicable
## Coverage notes
Unit tests cover the pure parser (`DeepLinkTests`: scheme inference, port preservation, IPv6, trailing-slash normalization, rejections) and the known-server lookup (`SettingsStoreTests.knownServerURL`). The orchestration (`AppRootView.handleDeepLink`, the SwiftUI `.onOpenURL`/alert wiring, in-place deferral in `WebShellView`) isn't unit-testable without a UI harness, so it was verified by a clean build + simulator `simctl openurl` dispatch on a reachable https server.
## Changelog
`omnigent://<hostname>/c/<session_id>` links open that session in the iOS app, reusing the open window on that server in-place
- Route the provider-neutral composer surface through a generic goal API facade while preserving the Codex backend
- Rename goal components, state, selectors, and tests without changing the Codex-only capability gate
Signed-off-by: sabhya-db <sabhya.chhabria@databricks.com>
Co-authored-by: sabhya-db <sabhya.chhabria@databricks.com>
* Add cross-replica live-state mirror for the session sidebar
Under replica sharding, a session list / WS /v1/sessions/updates request can
land on any replica, but the sidebar's live fields — runner_online, turn
status, and the pending-approval count — historically lived only in the
in-memory caches of the replica holding a session's runner tunnel. This
mirrors them to three nullable columns on omnigent_conversation_metadata,
written by the tunnel-holding replica and readable anywhere:
- runner_last_seen: epoch seconds the bound runner's tunnel was last seen;
runner_online is derived from freshness (90s TTL), so an ungraceful
death self-corrects. Stamped on connect and each runner-tunnel ping-loop
tick (inside the handler's workspace_scope), cleared on graceful disconnect.
- live_status: last relay-observed turn status (enum_codecs.SESSION_LIVE_STATUS).
- pending_elicitation_count: outstanding approval-prompt count.
Writes funnel through one best-effort chokepoint (server/session_live_state.py):
ordered (single-worker executor), deduplicated, off the event loop, and run
inside a copy of the caller's contextvars so the per-request workspace_scope —
which every store query filters on — reaches the worker thread. A bare executor
would run the write at the default workspace, so on a multi-tenant replica every
UPDATE ... WHERE workspace_id == ... would match no rows and the mirror would
silently no-op; the read path (_bulk_session_liveness via asyncio.to_thread)
already propagates the context, so this makes the write path symmetric. A
dropped best-effort write evicts its dedupe entry so the next identical publish
retries rather than being swallowed. Writes never bump conversations.updated_at
(it drives sidebar ordering). The read path checks the in-memory registry first
and falls back to the row's freshness, so a replica that doesn't hold the tunnel
still reports correctly. The unread-dot baseline moves client-side (localStorage
+ server-seed max-merge) so it no longer depends on the serving replica.
Migration d7f1a2b3c4e5 adds the three nullable columns; NULL degrades to
today's behavior. This is the OSS SQLAlchemy path only — the managed EStore
store implements the same abstract methods separately, and host_id slice-key
routing is a separate PR.
Tests: workspace-scoped store round-trip through the chokepoint (fails on a bare
executor, passes with copy_context), contextvar propagation, ping-loop re-stamp,
dedupe stale-on-drop eviction, and cross-replica /health derivation from a
fresh / past-TTL / cleared row.
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
* Drop the drain_for_tests hook; tests poll the observable effect
Remove the test-only drain_for_tests() from the production session_live_state
module — a test seam has no business in the shipped chokepoint. Tests now wait
on the observable effect of each background write (the recording store's
captured writes, the DB row, or the dedupe-map eviction) with a short polling
deadline, mirroring the host-tunnel route tests' _wait_* helpers.
The dedupe stale-on-drop test now gates its retry on the dedupe entry actually
leaving the map (the exact contract under test) rather than on the first store
call, closing a race the drain hook had been masking.
No production behavior change; 225 affected tests pass.
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
* Drop unencodable live statuses before enqueue
persist_live_status forwarded any relay-observed status straight to the
store, but SessionStatusEvent.status permits "launching" (runner-local
sub-agent bookkeeping) which the live-status codec can't encode. Enqueuing
it made the store write raise; the best-effort failure hook then cleared
the dedupe entry, so every republish re-attempted and re-logged rather than
settling.
Guard in persist_live_status: statuses outside the codec's known set
(derived from SESSION_LIVE_STATUS so the two can't drift) are dropped before
the enqueue, warned once (deduped), and never reach the store. Latent today
(no producer emits "launching" as an external session.status), addresses a
Polly non-blocking note.
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
* Update sidebar unread-dot e2e for browser-durable read-state
The mark-unread e2e's docstring asserted the OLD contract — read-state is
server-backed with "no localStorage", so a dot reappearing after reload
proved the server round-trip. This PR inverts that: read-state is now
localStorage-durable, mirrored best-effort to a per-replica server copy.
Rewrite the docstring to the new contract and add a case that pins the
pod-independence: after mark-unread + reload, stub GET /v1/sessions to
return viewer_unread=false / viewer_last_seen=null (a replica whose seed
never saw the PUT), and assert the dot still lights — proving it was
restored from localStorage, not the server seed. Fails on pre-localStorage
code (read-state-less seed → row reads seen → no dot).
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
* Fix flaky live-state chokepoint test: wait for all writes, not the first
test_live_state_writes_via_chokepoint_land_in_scoped_workspace enqueues
three writes on the chokepoint's ordered single-worker executor
(touch_runner_liveness, persist_live_status, persist_pending_count) but
polled only for the first (runner_last_seen) before asserting all three.
On a loaded CI runner (Pytest stores shard, 8-way xdist) the read raced
the later two, so live_status read None -> "assert None == 'running'".
Poll until ALL three fields are observed, and raise the deadline (2s to
10s; a passing predicate returns immediately, so the ceiling only matters
on a real failure). Also raise the _wait_until default in the live-state
unit tests to 10s for the same load-robustness. Verified: 162 passed 3x
under 8-way parallel pytest, and 15x sequentially on the target test.
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
* Gate persisted pending-count fallback on runner binding
_build_session_list_item merged the in-memory elicitation index with the
persisted row via max(index, row). For an UNBOUND session that produced a
load-dependent flake: resolve() drops the index to 0 synchronously, but the
row's 0-write is async on the live-state executor, so a list read that beat
the write saw max(index=0, row=1)=1 — a stale-high badge. Deterministic
locally (fast SQLite), it surfaced under the stores/server-integration
shard's 8-way parallelism as "assert 1 == 0".
The persisted count is a CROSS-REPLICA mirror: only meaningful when a runner
tunnel exists on some replica, whose holder writes the row and whose
non-holders fall back to it. An unbound session (no runner_id) has no tunnel
anywhere, so the local index is authoritative and the lagging row must not
override it. Consult the row only when conv.runner_id is not None; otherwise
use the index directly.
Adds test_list_sessions_pending_count_falls_back_to_row_for_bound_session
pinning the fallback still fires for a bound session (index empty, row set),
complementing the existing unbound/index-authoritative test. Verified: full
server-integration suite 867 passed under -n 4, and the unbound test 20x with
no flake (row column never read on that path -> timing-independent).
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
---------
Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
A slow or unreachable Omnigent server made bind_session_runner leak a raw
httpx transport exception, so the CLI printed a full traceback (e.g. bare
`omnigent` -> run -> bind against a degraded backend) instead of an
actionable message.
Wrap the PATCH call and map each transport failure to a clean
ClickException, distinguishing unreachable (connect error / connect
timeout -> check URL & connection) from reachable-but-slow (read timeout
-> retry shortly). Honors the function's documented contract.
* fix(server): ask the host if a runner is coming before the connect grace
A host-bound session's first message waits up to _HOST_BOUND_RUNNER_CONNECT_GRACE_S
for the pinned runner's tunnel to register before relaunching. That wait is
correct for a booting new-session runner but pure latency for one that will
never connect — a non-sticky Stop dropped it, or the host restarted and lost
it. Neither case writes a host.runner_exited report (Stop pops the runner
before terminating; a dead host never sends the frame), so the old blind wait
burned the full grace every time on restart.
The host is the authoritative owner of runner-process liveness — it holds the
Popen. Add a host.runner_status frame pair so the server can ask: alive
(booting/serving → wait), dead (tracked but exited → relaunch now), or unknown
(stopped, crashed, or lost to a host restart → relaunch now). The dispatch
path races this query against the connect grace: the runner connecting (or a
crash report) always wins if it lands first, and a dead/unknown verdict cuts
the wait short so the relaunch runs immediately. Running the query alongside
the wait — not before it — keeps it strictly a speed-up: a host that is
offline, too old to answer, or slow yields no verdict and the grace runs its
normal course with no added latency.
Host-absent at dispatch skips the grace entirely (there is no one to query)
and falls through to the existing relaunch/503, unchanged.
Co-authored-by: Isaac
* Address code-quality review on the runner-status query
- Drain cancelled tasks via asyncio.gather(..., return_exceptions=True)
instead of `await task` inside contextlib.suppress, in both the race
helper and the integration test. Functionally identical, but avoids the
bare-expression-statement the static analyzer flagged as "no effect"
(it doesn't model `await` as side-effecting).
- Harden _query_host_runner_status: map any unexpected exception (e.g. a
future resolved with an error) to None so the query can only ever speed
up the connect grace, never break the message POST. CancelledError stays
a BaseException and still propagates, so the race helper's cancel/drain
is unaffected. Covered by a new test that resolves the pending future
with an exception.
Co-authored-by: Isaac
* test(e2e): stub /health so the host-badge push test isolates useHosts status
test_hosts_changed_frame_updates_host_badge failed at its first
assertion (before any hosts_changed frame): the badge read "status
unknown" instead of the stubbed "online". The test intercepts the
WS /v1/sessions/updates stream to keep liveOnline undefined, but the
open-session GET /health poll is a second, independent source of
host_online — and the real endpoint emits host_online: null for a
session it finds without a host binding. That null reaches
useSessionHostOnline as a live signal, which HostBadge treats as
authoritative "unknown", overriding the useHosts status the test drives.
Patch /health to drop the seeded session from the batch sessions map so
useSessionHostOnline stays undefined ("not observed yet") and the badge
falls back to the useHosts status field — matching the test's stated
intent and the existing snapshot/list route patches. HostBadge behavior
is unchanged; this only repairs the test's mock world, which had the
snapshot claiming host-bound while /health said otherwise.
Co-authored-by: Isaac
* ci(benchmark): allow dispatching against a specific commit SHA
Add an optional `checkout_sha` workflow_dispatch input wired into the
checkout step's `ref`, so an ad-hoc benchmark run can be pinned to any
commit while the workflow definition still comes from the trusted
dispatch ref. Blank falls back to the ref HEAD (schedule/default).
Also key the concurrency group per run (run_id / pinned sha) so repeated
manual dispatches on the same ref no longer cancel each other — needed
to collect multiple data points per commit for regression A/B testing.
Co-authored-by: Isaac
* ci(benchmark): key dispatch concurrency purely on run_id so repeats never cancel
Co-authored-by: Isaac
* perf(web): reduce GET /v1/sessions calls on session detail page
- useConversations: add staleTime 30s so components that mount in quick
succession (AppShell, Sidebar, ChatPage) share the cache instead of
each triggering a background refetch
- useConversations: bump page limit 20 → 30 to reduce second-page fetches
- useAgents: staleTime Infinity (data is driven by explicit refetch only)
- ChatPage: disable useAgents on session detail page (enabled: !urlConvId)
— useSessionAgent covers the bound agent there; useAgents is only
needed on the landing page agent picker
* ci(benchmarks): add PR and release benchmark gate workflows with compare script
Adds compare.py for detecting performance regressions between benchmark
JSON reports, plus two CI workflows: benchmark-pr.yml (runs on PRs touching
migration files, posts results as a PR comment) and benchmark-release.yml
(runs on release/v* pushes and blocks on regression).
* ci(benchmarks): add PR migration gate and integrate release benchmark into release.yml
- compare.py: compare two benchmark JSON reports, exit 1 on regression
- benchmark-pr.yml: block PRs touching migrations if >20% p50/p99 slowdown vs latest nightly
- release.yml: add benchmark job between plan and cut; compares release commit vs previous stable tag on the same runner, blocks cut on regression; skip_benchmark escape hatch mirrors skip_ci_check
* fix(benchmarks): fix ruff E501 lines and None guard in compare.py
* ci(benchmarks): raise threshold to 100%, add approval gate for release regressions, add stores path trigger
* ci(benchmarks): trigger PR benchmark when benchmark-pr.yml is edited
* ci(benchmarks): match nightly iterations in PR benchmark (100 iter × 3 runs)
* fix: split markdown header string at natural column boundary (ISC warning)
* ci(benchmarks): match nightly seed corpus (5000×200) in PR benchmark for comparable baselines
* ci(benchmarks): seed 5000×200 corpus in release benchmark, match nightly iterations (100×3)
* ci(benchmarks): switch regression metric from P99 to P95
* perf(web): replace GET /v1/hosts 10s poll with WS push
Host connect/disconnect events now flow through the existing
WS /v1/sessions/updates stream as a new hosts_changed frame:
- host_tunnel.py: pass owner to on_host_connect/on_host_disconnect
callbacks (avoids a DB lookup in the callback)
- sessions.py: add announce_hosts_changed(); extend _discovery() to
forward hosts_changed events as WS frames to the client
- app.py: wire on_host_connect/on_host_disconnect to call
announce_hosts_changed so the owner's open tabs invalidate immediately
- sessionUpdatesSocket.ts: add hosts_changed to SessionUpdatesFrame
- SessionUpdatesProvider.tsx: invalidate ["hosts"] on hosts_changed
- useHosts.ts: staleTime 10s→30s, refetchInterval 10s→60s fallback
(WS push handles the common case; poll catches missed events)
* test(e2e): add UI e2e for hosts_changed WS push → host badge update
* feat(files): serve session filesystem from host when runner is offline
When a session's runner process dies but its host is still connected,
the file panel (browse / changed files / diffs / search / file content)
used to go dark — every request 502/503'd and the user had to send a
message to wake a new runner just to look at files.
The server now falls back to reading the workspace over the existing
host tunnel when the pinned runner is offline. A shared, read-only
WorkspaceReader (confined to the workspace root) runs on the host and
returns the same JSON shapes the runner's filesystem endpoints do, so
the resolver (live runner -> host tunnel -> 503) and the frontend can't
tell which side answered. The panel stays live with a passive "Asleep —
files shown live from host" badge; no LLM, no wake-up.
Built as a resolver chain so a future host-death snapshot source drops
in as an additive third link without touching endpoints or the frontend.
- omnigent/workspace_fs.py: read-only WorkspaceReader (list/read/search/
changes/diff), reusing the runner's path-validation, glob, pagination,
and git change-registry helpers.
- host tunnel: host.fs_request / host.fs_result frames + host handler +
server-side proxy and pending-future routing.
- server: _fs_get_with_host_fallback wraps the 5 FS GET endpoints;
offline env-metadata is synthesized from the bound workspace.
- web: useWorkspaceServeable gate (runner-online OR host-online, tri-state
aware) replaces the runner-only gate across the FS hooks; host-served
badge in FilesPanel.
Test Plan: backend unit + integration (real host tunnel, offline runner,
real git workspace), frontend hook unit tests, and e2e_ui (real browser)
covering the file list + content viewer while the runner reads offline.
Co-authored-by: Isaac
* fix(files): address host-served FS review notes (bounded read, parity)
Follow-up to the PR review on the host-served filesystem path:
- WorkspaceReader now reads at most _MAX_READ_BYTES from disk (via a
bounded open().read) in both _read_file and diff's `after`, instead of
slurping the whole file — a multi-GB file opened while the runner is
asleep can no longer OOM the host process. Matches the runner's cap.
- _list_dir falls back to lstat for a broken symlink and lists it as
type="file"/bytes=None instead of silently dropping it — restores the
parity the docstring claims with the runner's list_dir.
- Host FS failures now mirror the runner proxy's status mapping: a
non-404/400 host error (e.g. git_status_failed) surfaces as 502 like
_proxy_get_to_runner, and a 400 stays a 400.
- Log a warning when a host fs op times out (the module's _logger was
previously unused); drop a dead `text = ""` assignment.
Adds tests for the oversize-read cap and the broken-symlink listing.
Co-authored-by: Isaac
* fix(files): keep oversize text as UTF-8 when truncation splits a codepoint
Follow-up to the PR review: WorkspaceReader._file_content_payload sliced
the read at _MAX_READ_BYTES on a raw byte boundary, so a text file larger
than the cap whose cut fell inside a multi-byte UTF-8 codepoint raised
UnicodeDecodeError and was served base64 — diverging from the runner,
which truncates on a valid boundary and keeps encoding="utf-8".
Now, when we truncated and the only invalid bytes are a partial trailing
codepoint (error within the last 3 bytes), drop them and re-decode as
text. A genuinely binary file has invalid bytes earlier in the buffer, so
it still falls through to base64. Adds tests for both.
Co-authored-by: Isaac
On the iOS native app, the file viewer is a `fixed inset-0` overlay, so
the iOS shell-lock (useIOSViewportLock, which only resizes flow content
inside .app-shell) can't lift it above the soft keyboard. When a user
selected text to comment, the auto-focused textarea in the bottom
comments panel sat behind the keyboard with no way to scroll to it.
Pad the mobile overlay's bottom by the keyboard inset (via the existing
useIOSNativeKeyboardInset hook that TerminalsPanel already uses) so the
comments panel and its textarea stay visible. No-op off iOS, on desktop,
and with the keyboard closed.
Co-authored-by: Isaac
* feat(ci): draft feature-blog posts at release cut
Add an automated feature-blog pipeline mirroring the existing doc-sync /
release-notes automation. At release cut (same workflow_run trigger as
draft-release-notes.yml), a scout agent selects the release's blog-worthy
features and a drafter agent writes one post per feature into omnigent-site
as a DRAFT PR — leaving the mandatory demo, hero art, and byline for a human.
- feature-blog-scout: no-tools selector; a >=2-of-4 signal bar, capped at 3,
emits a ranked BLOG_CANDIDATES block (usually empty).
- feature-blog-drafter: writes a short one-screen post following the 5-part
skeleton, marks DEMO REQUIRED, defaults author to "omnigent".
- feature-blog.yml: reuses generate.py's PR-range harvest, runs the two
agents, appends a fixed CTA footer, mints the omnigent-site App token only
after the agents finish, and opens a draft PR per feature. Idempotent;
workflow_dispatch supports dry-run testing against past releases.
Co-authored-by: Isaac
* fix(ci): address Polly review on feature-blog workflow
- Fix nested material-assembly heredoc: the unquoted delimiter let the
markdown code fences be backtick-command-substituted, silently dropping
every PR diff from the drafter's material. Quote the delimiter and pass the
candidate index + repo via env; build fences from a variable.
- Secret-scan the drafter output before it feeds the PR body, and scan the
drafted files (incl. untracked) before commit/push — the drafter runs with
LLM_API_KEY in env and its stdout reaches the PR description.
- Derive the post DATE from the release tag's commit in the omnigent checkout,
not the omnigent-site checkout's last-commit date.
- Warn loudly when posts were drafted but no App token is available, so a
misconfig isn't mistaken for "no candidates".
Co-authored-by: Isaac
* fix(ci): fix no-candidate job failure and harden feature-blog workflow
Address the second Polly review:
- B1: the mint/PR/warn steps gated on `drafted != '0'` fired on the common
no-candidates release, because a SKIPPED draftposts step reports an empty
output and '' != '0' is true — minting an unnecessary token and then failing
the job on a missing drafted_branches.txt. Gate on
`draftposts.outcome == 'success' && drafted not in ('', '0')` instead.
- B2: reset + clean the omnigent-site worktree at the top of each candidate so
a drafter that fails AFTER writing its post can't bleed that untracked file
into the next feature's commit/PR.
- S1: validate the scout's LLM output before it becomes a path/branch/fetch —
require `slug` to be strict kebab-case (blocks ../, slashes, spaces) and
intersect `pr_refs` with the harvested PR set (blocks arbitrary gh pr diff).
- Make the drafter secret-scan fail-closed even when the drafter exits
non-zero (capture rc, scan, then skip) — tee wrote its stdout either way.
Co-authored-by: Isaac
* OMNI-1193: add recurring-task scheduler engine
Add the in-process cron scheduler for Routines (PR2). It decides *when*
each active scheduled task fires and invokes an injected on_fire callback;
creating the agent session is left to a later PR.
- omnigent/server/automations/cron.py: self-contained 5-field POSIX cron
parser, timezone-aware next-fire computation (POSIX DOM/DOW union,
366-day never-fires bail-out), and a validator enforcing a 5-minute
minimum interval and rejecting never-fires / fires-once expressions.
- omnigent/server/automations/scheduler.py: AutomationScheduler holding
one self-rearming timer per active task, loaded on boot from
store.list_active(). SKIP overlap policy (max_instances=1), misfire
grace window, 24-day timer cap with re-arm, and add/update/remove
CRUD-sync methods. Timing seams (now/schedule_call/cancel_call) are
injectable for deterministic tests.
- Wire into the FastAPI _lifespan: start on boot, stop on shutdown,
following the publish_server_metrics_periodically precedent. create_app
takes a scheduled_task_store kwarg; cli.py constructs the store. PR2
supplies a placeholder on_fire seam for PR3 to replace.
Tests: exhaustive cron parsing/next-fire/floor/timezone; scheduler
boot-load/fire/overlap/misfire/CRUD with a fake clock + fake callback;
lifespan wiring against a real store. 52 new tests, all green.
Co-authored-by: Isaac
* OMNI-1193: strip internal phasing from scheduler comments
Reword scheduler/lifespan comments and docstrings to describe what the
code is (an injected on_fire callback whose default is a no-op that
logs) rather than internal PR sequencing. Comment/docstring-only; no
logic change.
Co-authored-by: Isaac
* fix(automations): make cron interval validation deterministic + isolate scheduler boot
The 5-minute minimum-interval floor is the cost-control guarantee for
Routines (each fire spawns a real agent), but validate_cron could be
bypassed two ways: it anchored sampling at datetime.now() (so the same
expression passed or failed depending on the wall-clock minute), and it
only measured the gap between the first two fires (so an irregular
cadence like `0,1 * * * *` hid its 60s pair behind a 3540s first gap).
Anchor the interval check at a fixed UTC instant (a leap year, so
Feb-29 expressions still reach their single fire and are rejected as
"fires only once" rather than "never fires") and take the minimum gap
across every consecutive pair in a bounded 25-hour window. Validation
is now deterministic and DST-agnostic.
Also isolate the scheduler from server boot: wrap
automation_scheduler.start() in log-and-continue so a DB error while
loading the schedule can't take down startup of the whole server.
Drop a false DST-fold comment in get_next_fire_time (the return value
was already timezone-aware; the .replace(tzinfo=tz) was a no-op).
Co-authored-by: Isaac
* feat(automations): raise minimum routine cadence from 5 minutes to 1 hour
Each routine fire spawns a real agent session, so hourly is now the
tightest cadence we allow. Raise MIN_INTERVAL_SECONDS from 300s to
3600s and update the derived error message, DST comment, and floor
tests. The scheduler tests' fixture crons (*/5) and the misfire test's
clock-advance are retuned to a valid hourly cadence, since they are no
longer arm-able under the new floor.
Co-authored-by: Isaac
* fix(automations): use valid uuid agent_id in scheduler lifespan test
The two ScheduledTask fixtures in test_scheduler_lifespan.py hardcoded
agent_id="ag-1", which is not a valid UUID. Local SQLite tolerates the
short string, but the server-integration CI backend validates the id
and rejects anything that isn't a canonical UUID, failing both
test_lifespan_starts_and_stops_scheduler and test_lifespan_skips_paused_task.
Use the file's existing _uid() helper so the agent_id matches the same
UUID form already used for scheduled_task_id.
Co-authored-by: Isaac
* refactor(scheduled): rename automations dir/class to scheduled for consistency with ScheduledTask model
Align the scheduler layer with the already-merged persistence canon
(ScheduledTask / scheduled_tasks / ScheduledTaskStore): move
omnigent/server/automations/ -> omnigent/server/scheduled/ (and the
mirror test dir), rename AutomationScheduler -> ScheduledTaskScheduler,
and the app.state attribute / lifespan var automation_scheduler ->
scheduled_task_scheduler. No behaviour change.
Co-authored-by: Isaac
* docs(scheduled): use "scheduled tasks" naming in comments, drop "Routines"
Omni's canonical name for this feature is "scheduled tasks". Reword the
scheduler docstrings and inline comments to match, dropping the
"(Routines)" parenthetical that referenced another codebase's label.
Comment/docstring text only — no identifiers or behavior changed.
Co-authored-by: Isaac
* feat(scheduled): rewrite scheduler engine to use RRULE via dateutil
Replace the hand-rolled 5-field cron parser with RFC 5545 recurrence
rules evaluated by python-dateutil, matching the product decision to
switch scheduled tasks from cron to RRULE.
- Rename cron.py -> rrule.py; delete the cron parser (parse_cron,
_parse_field, ParsedCron, CronField, _day_matches) and the
minute-by-minute field walk.
- Next-fire now anchors the rule at midnight of the reference day in
the task timezone and uses rrulestr(...).after(); returns None when
a COUNT/UNTIL rule is exhausted.
- validate_cron -> validate_rrule keeps the 1-hour floor, never-fires,
and fires-once rejections, sampled from a fixed 2016 UTC anchor so
the verdict is wall-clock-independent; CronValidationError ->
RRuleValidationError, CronTrigger -> RRuleTrigger.
- Scheduler reads task.rrule (+ task.timezone); timer/overlap/misfire
behavior unchanged.
- Rewrite tests in RRULE terms; scheduler tests use a local fake task
so they don't depend on the entity field rename.
Co-authored-by: Isaac
* refactor(scheduled): unwire cli store; declare python-dateutil dep; note INTERVAL phase drift
PR2 is the pure scheduler engine and must not construct or boot the
scheduler on any entrypoint while on_fire is still a no-op. Remove the
scheduled-task store construction and the create_app kwarg from the CLI
entrypoint (the only entrypoint that was wired); the create_app
dependency-injection seam in server/app.py stays, awaiting the fire-path
PR that wires all entrypoints together.
Also fold in two fixes from the review:
- Declare python-dateutil (>=2.8,<3) as a core dependency. rrule.py
imports it at module top and app.py imports the scheduler at module
level, so dateutil is now on the core server boot path; it was only
present transitively via optional extras, so a base install would
ImportError on boot. Lockfile regenerated (no version churn — the
package was already pinned transitively).
- Document the INTERVAL>1 phase-drift caveat at _anchor_dtstart:
midnight re-anchoring is deterministic for INTERVAL=1 rules, but
biweekly/interval-monthly rules tie phase to the re-arm day and can
slip a period across restarts. Comment only; a proper fix (stable
per-task dtstart) belongs to a later PR.
Co-authored-by: Isaac
* fix(scheduled): make scheduler start() idempotent (guard against duplicate timers)
start() now early-returns when already started instead of re-loading the
store and layering a second set of timers on top of the live jobs. Adds a
regression test proving a second start() arms no new timers and that a
stop() -> start() re-cycle still re-arms cleanly.
Co-authored-by: Isaac
* docs(scheduled): drop internal process verbiage from scheduler comments
Reword two comments to neutral "future work"/"row changes" phrasing so
they don't leak internal process language into the codebase. Comment-only;
no behavior change.
Co-authored-by: Isaac
* perf(web): reduce GET /v1/sessions calls on session detail page
- useConversations: add staleTime 30s so components that mount in quick
succession (AppShell, Sidebar, ChatPage) share the cache instead of
each triggering a background refetch
- useConversations: bump page limit 20 → 30 to reduce second-page fetches
- useAgents: staleTime Infinity (data is driven by explicit refetch only)
- ChatPage: disable useAgents on session detail page (enabled: !urlConvId)
— useSessionAgent covers the bound agent there; useAgents is only
needed on the landing page agent picker
* perf(web): skip list refetch when active session is missing from cache
When opening a session, its updated_at bumps before the initial
conversations fetch returns, causing it to appear in missingIds in
the WS snapshot handler and triggering a second GET /v1/sessions.
The active session's data is covered by useSession and it's pinned
in the sidebar via ActiveChatOverride, so no list refetch is needed.
`session.status: failed` already carries a structured `error` payload
from the server, but the frontend dropped it at every layer: the
`SessionStatusEvent` type had no `error` field, the SSE parser didn't
extract it, and the store handler never synthesized an `ErrorBlock`.
Startup failures (e.g. Databricks OAuth token expiry) never emit a
`response.failed` event, so the transcript stayed blank until the user
reloaded and the server's `lastTaskError` snapshot caught up.
Fix by threading the `error` field through `SessionStatusEvent` →
`sse.ts` parser → `chatStore` `session_status` handler, which now
appends an `ErrorBlock` immediately when `status === "failed"` and no
error block is already visible.
Codex-native sessions emit plan state through `turn/plan/updated`
app-server notifications, which the forwarder previously mirrored only
as an inline assistant message. Map those plan steps to the same
todo-list schema Claude produces via TodoWrite and post them as an
`external_session_todos` event, so the web TodoPanel renders a Codex
plan the same way it renders a Claude todo list. The plan still appears
inline in the transcript as well.
On the web side, the Tasks tab/drawer gate moves from `isClaudeNative`
to a `todosSupported = isClaudeNative || isCodexNative` flag; the panel
itself is already harness-agnostic.
Co-authored-by: Isaac
* fix(policies): show all policies in Add Policy session dialog
Previously, the per-session Add Policy dialog filtered out policies that
were already applied, making it impossible to add a second instance of
the same policy type.
* fix(tests): update AgentInfo test for show-all-policies behavior
* feat(web): add find-in-file to the markdown & notebook preview
Find in file worked in the markdown editor, source view, and Monaco, but did
nothing in Preview mode — the toolbar toggle (and Cmd+F) opened a bar that
nothing consumed on the rendered-preview surface.
The preview is React-owned DOM (react-markdown / notebook output), so matches
can't be wrapped in spans without fighting React's reconciliation. Instead,
locate matches as DOM Ranges and paint them with the CSS Custom Highlight API
(the same approach htmlCommentBridge uses for the HTML preview), which overlays
styling without mutating the node tree.
Matching mirrors the editor's TipTapSearchExtension: text is flattened across
inline nodes so a term split by formatting (e.g. <em>) still matches, while a
block-tag boundary inserts a separator so a match never spans two blocks. Same
length-preserving case-fold so Unicode offsets stay aligned. Where the Highlight
API is unavailable, count/navigation still work and only the paint is skipped.
Co-authored-by: Isaac
* fix(web): recompute preview find ranges post-commit, not during render
findTextRanges ran in a useMemo (during render), so on a content change while
the find bar was open the walker saw the previous render's text nodes and built
Ranges into nodes about to be replaced — leaving stale/misplaced highlights.
Move the computation into useLayoutEffect (post-commit) and hold ranges in
state so the walker always sees the committed preview DOM.
Also import RefObject explicitly in NotebookPreview for consistency with the
sibling preview/search modules.
Co-authored-by: Isaac
A native Codex session routed through a Databricks profile could fail every
turn with a gateway 400 "Invalid Token" even though `databricks auth token
--profile <p>` mints a valid bearer. The gateway base URL was resolved via the
databricks-sdk, which lets a `DATABRICKS_HOST` env var (or a different DEFAULT
section) override the profile host — while the auth command pins `--profile`
and ignores `DATABRICKS_HOST`. On a machine whose environment/DEFAULT points at
another workspace, the base URL and the minted token then targeted two
different workspaces and the gateway rejected the token.
Add `_databricks_gateway_host(profile)`: for an explicit profile, read the host
straight from that profile's config section (env-independent, same source the
token comes from); only fall back to the SDK/ambient chain when the section has
no host (e.g. a Databricks App container authenticating via ambient env/OIDC).
Both Codex gateway call sites now use it.
Co-authored-by: Isaac
* feat(web): add find-in-file to the markdown rich-text editor
Find in file worked in Monaco (code) and the markdown source view, but did
nothing in markdown's default Editor mode — the toolbar toggle wasn't consumed
by the TipTap editor, so clicking Find (or Cmd+F) was a no-op.
Add a ProseMirror search-decoration extension (mirroring the existing comment
extension: matches are Decorations, not marks, so they never touch markdown
serialization and remap through edits) plus a find bar reusing the source-view
UI. Highlights all matches, marks and scrolls the current one, cycles with
Enter / Shift+Enter / arrows, and closes on Escape / ✕ / a second Find click —
syncing the toolbar toggle.
Matching flattens each block's inline nodes into a visible-text map, so a term
split across a formatting boundary (e.g. `Hel**lo**`) is found, while a block
separator prevents matches spanning paragraphs. Editor mode only; preview find
is a follow-up that can reuse this matcher.
Co-authored-by: Isaac
* fix(web): trim the markdown find query in the match count too
The "n / m" count computed matches against the raw query while the plugin
highlighted against the trimmed query, so a query with surrounding whitespace
(e.g. "the ") could show a count that disagreed with the highlighted spans and
threw off the current-match modulo. Trim in the count path so both agree.
Co-authored-by: Isaac
* fix(web): keep markdown find positions aligned across case-fold length changes
findMatches searched a toLowerCase() haystack while mapping match offsets back
through a segment map built in original-text coordinates. For characters whose
lowercase form has a different UTF-16 length (e.g. İ U+0130 → i + combining
U+0307), the two coordinate systems diverge, shifting or invalidating the PM
positions of any match after such a character — producing misplaced or
out-of-range decorations. Fold case without changing length instead, so every
offset stays aligned.
Co-authored-by: Isaac
* Add Electron auto-update main process
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* Add desktop update renderer UI
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* Fix desktop updater review findings
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* Keep updater test compatible with main imports
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* Format desktop updater files
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* test(e2e_ui): cover desktop auto-update UI (banner + settings)
The auto-update work adds a desktop-only UpdateBanner (mounted in AppShell
above the routed Outlet) and a Settings → Updates section, both gated on the
Electron update bridge (window.omnigentDesktop.updates). Only unit tests
covered these, so the E2E UI Required gate flags the web/** change as lacking
Playwright coverage.
Add tests/e2e_ui/desktop/test_desktop_update.py, which injects a scriptable
window.omnigentDesktop stub (with a full updates bridge) via add_init_script —
the same feature-detection stubbing browser/test_browser_tab.py uses — and
drives the real desktop path in a plain Chromium browser:
- banner renders across the available → downloading → downloaded lifecycle,
streamed through the live onStatus subscriber;
- banner actions (Update now, Restart to update, Skip this version) invoke the
matching bridge calls and update the visible state;
- Settings → Updates exposes the mode selector and a working Check button;
- the banner never appears in a plain (non-Electron) browser.
The shell's transparent absolute ChatHeader overlays the banner's band, so
banner-button interactions use dispatch_event("click") to fire the real React
handler; Settings controls sit below the header and use real clicks.
Verified locally: 5/5 e2e pass; tsc -b clean; ruff check/format clean; focused
web unit tests (UpdateBanner, SettingsPage, settingsNav) 71/71 pass.
Signed-off-by: Jackson Zheng <36802691+zhengwin@users.noreply.github.com>
* refactor(desktop): extract auto-updater into desktop_updater module
Desktop auto-update orchestration was ~300 lines of inline state,
electron-updater event wiring, config normalization, manual
check/download/install orchestration, status broadcast/replay, the
consent dialog, and IPC handler registration scattered through
web/electron/src/main.js.
Move all of it into a cohesive web/electron/src/desktop_updater.js
behind a small factory: createDesktopUpdater({ app, BrowserWindow,
ipcMain, dialog, nativeImage, autoUpdater, loadSettings, saveSettings,
isPinnedOriginSender, pinnedOrigin, iconPath, forceDevUpdateConfig }).
Main-process dependencies are injected rather than reaching back into
main.js globals, so there are no circular deps and the module is
directly unit-testable.
main.js now only composes the updater and wires four thin seams:
init() at startup, checkForUpdates/getStatus/installUpdateNow in the
Updates menu, registerIpc() for the update IPC surface, and
quitAndInstallIfPending() in the before-quit handoff. main.js drops
from 3169 to 2912 lines.
No behavior change: every IPC channel name, the consent handshakes,
dev-feed gating, periodic-check cadence, status union, and install
flow are preserved exactly. preload/renderer contracts, Settings UI,
dev-app-update.yml, and the e2e test are untouched.
Tests: add test/desktop_updater.test.js exercising the module API
directly through in-memory fakes (config persistence, event
broadcast/replay, manual-error surfacing, dev-feed gating, IPC sender
trust + consent, install handoff). Retarget the existing
test/update-main.test.js integration harness onto the composed
updater instance, keeping its regression coverage of main.js wiring.
Move the scheduled_tasks recurring trigger from a cron expression to an
RFC 5545 recurrence rule (RRULE) to match the Codex scheduling model.
- db_models.py: rename column cron_expression String(255) -> rrule String(512)
(RRULE strings are longer than cron), update docstrings.
- New Alembic migration a7b3c4d5e6f7 (down_revision z8a2b3c4d5e6): batch-mode
add rrule NOT NULL, drop cron_expression. The table holds zero rows (the
feature is inert — no create endpoint or fire path yet), so this is a pure
DDL swap with no backfill.
- entities/scheduled_task.py: rename field cron_expression -> rrule.
- scheduled_task_store (abstract + SQLAlchemy impl): rename create/update
params and the row<->entity mapping.
- Update store and migration tests to use RRULE strings.
The store does not validate the trigger string (it did not validate cron
either); next-fire/floor validation is owned by the scheduler-engine PR.
Co-authored-by: Isaac
* fix(pi-native): route non-Claude models to correct providers in models.json
Non-Claude Databricks models need different providers depending on their
API compatibility with Pi's openai-completions/responses clients:
1. Newer GPT models (gpt-5-5, gpt-5-6-*, gpt-5-3-codex) reject function
tools via /chat/completions → use openai-responses at /ai-gateway/codex/v1.
2. Kimi, Llama, GLM, older GPT → use openai-completions at /serving-endpoints
with supportsUsageInStreaming:False (Gemini rejects stream_options).
supportsReasoningEffort:False is also required.
3. Gemini 2.5 thinking models return content as an array with thoughtSignature
when tools are present — Pi's openai-completions handler expects a string
and crashes with [object Object]. Excluded from both providers.
Also fixes:
- --provider arg now points to the correct provider for the selected model
(was always 'omnigent', now uses 'omnigent-openai' or 'omnigent-completions')
- model_override from sys_session_create is now respected by the pi-native
launch path (was always using spec.executor.model)
- Non-Claude models are not appended to the Anthropic provider in models.json
* fix(pi-native): suppress defaultThinkingLevel in managed settings for non-Claude models
In TUI mode Pi applies defaultThinkingLevel from settings.json before the
compat supportsReasoningEffort check fires, sending reasoning_effort to the
Databricks gateway which returns 400 for Gemini and other non-Claude models.
Write defaultThinkingLevel: null in the managed settings so Pi's
getDefaultThinkingLevel() returns null (falsy) and no thinking is applied.
* fix(pi-native): don't register unsupported models under Anthropic provider
Gemini 2.5 models excluded from completions/responses providers were
still being appended to the primary Anthropic (omnigent) provider in
to_models_config() as a fallback, causing Pi to call them via
anthropic/v1/messages which Gemini 2.5 doesn't support (400 error).
Also squashes the two recent pi_native_credentials commits into context.
* fix(pi-native): pass --thinking off for non-Claude models to prevent empty turns
Gemini and other Databricks models return reasoning_tokens in their streaming
responses. In TUI mode Pi activates thinking even with defaultThinkingLevel:null
in settings, causing the agent loop to complete without surfacing the text
content to the Omnigent extension (external_session_status running→idle fires
but no external_conversation_item is posted).
Pass --thinking off for any model routed through omnigent-openai or
omnigent-completions providers.
* fix(spawn): remove uniqueItems from file_ids schema
Qwen3, Gemini, and other non-OpenAI models reject JSON schemas with
uniqueItems on array types with 400 'Invalid JSON schema - array types
do not support uniqueItems'. The Omnigent extension registers sys_session_send
as a tool with file_ids having uniqueItems:true, causing all turns to fail.
* fix(pi-native): skip reasoning blocks in textFromContent for o-series models
gpt-oss-120b and similar models return content as a typed array:
[{type:'reasoning',summary:[...]}, {type:'text',text:'Hello!'}]
textFromContent was joining all blocks including reasoning, producing
'[object Object],[object Object]' as the mirrored assistant message.
Skip blocks with type='reasoning' so only actual text blocks are extracted.
* fix(pi-native): exclude gpt-oss models from completions provider
gpt-oss-120b and gpt-oss-20b return content as a typed array
[{type:'reasoning',...},{type:'text',...}] in streaming responses.
Pi's openai-completions handler does block.text += content where
content is an array, producing '[object Object],[object Object]'.
Exclude these models from both providers (same approach as gemini-2-5).
Also bundled the textFromContent reasoning-block fix into this commit
since it's a related improvement.
* fix(tests): update spawn tests for removed uniqueItems on file_ids
uniqueItems was removed from the file_ids schema to avoid breaking
non-OpenAI models that reject JSON schemas with uniqueItems on arrays.
Update tests to match: remove uniqueItems assertion and change the
duplicate-rejection test to confirm duplicates are now allowed.
* perf(web): drop /health bulk poll from NewChatLandingScreen
NewChatLandingScreen was registering up to 200 sessions into the
shared /health fallback poller via useRunnerHealthRegistration, causing
a batched GET /health?session_ids=<100+ ids> every 10 s even while idle
on the home page.
The conflict-occupancy hint only needs runner_online, which is already
present on the Conversation objects returned by useDirectorySessions.
Read it directly from those objects instead of routing through the
health poll.
Also gates useDirectorySessions on selectedHostId != null so no fetch
fires before a host is auto-selected.
* fix(web): restore liveness check for conflict candidates
runner_online is intentionally absent from GET /v1/sessions list rows,
so reading s.runner_online directly always returned undefined (never
true) and silently broke the directory-conflict warning.
Restore useRunnerHealthRegistration for the narrow conflict-candidate
set (host-matched + workspace-bearing sessions only, not all 200) so
liveness comes from the /health poll as before. The bulk poll with 100+
session IDs is still eliminated because candidates are pre-filtered to
the selected host.
* ci: retrigger checks
* style(web): fix prettier formatting in NewChatDialog
* feat(telemetry): propagate host installation ID to SessionCreatedEvent
Adds `installation_id` to `HostHelloFrame` so the host daemon advertises
its local installation ID on connect. The server stores it in the
`HostRegistry` via a new `get_host_installation_id` helper, then passes
it as `host_installation_id` on `SessionCreatedEvent` so hosted sessions
can be correlated back to a specific host machine in telemetry.
* test(telemetry): add tests for host_installation_id telemetry feature
Cover HostHelloFrame encode/decode roundtrip with and without
installation_id, HostRegistry.get_host_installation_id with and
without a registered host, and _build_record promoting
host_installation_id to top-level data rather than params.
Widens the conversation_items primary key to (workspace_id,
conversation_id, id, created_at) and adds created_at to the unique
position index. Nothing is partitioned here: the change makes the
schema partition-ready, so a deployment that needs
PARTITION BY (created_at) can do it with pure DDL — PostgreSQL and
MySQL both require the partition key in the PK and in every unique
index. created_at trails in both keys, so existing per-conversation
prefix scans are unchanged, and it is already NOT NULL and immutable
(items are insert/delete-only), so the rebuild needs no backfill.
Position uniqueness at the DB level becomes per-second; the
next_position counter under _lock_conversation remains the real
allocator. A new test pins created_at immutability, which a future
partitioned deployment depends on.
Co-authored-by: Isaac
The secure repo's validate job red-flagged its first successful publish:
its runners' only index view is the JFrog mirror, whose omnigent
metadata lags weeks behind PyPI, so a just-published version never
becomes visible from CI. The job is removed there; validation is the
manual clean-venv step it always was (run from a network with a fresh
PyPI view — a mirror works, as the rc2 rehearsal proved).
Co-authored-by: Isaac
* ci(homebrew): auto-PR the homebrew-tap formula on release
On a final GitHub Release, regenerate the omnigent Homebrew formula from
the released PyPI sdist closure and open a PR to omnigent-ai/homebrew-tap.
- .github/workflows/homebrew-tap-pr.yml: triggers on release: published
(+ workflow_dispatch for reruns). Polls PyPI for the released sdist,
runs the generator, mints an omnigent-ci App token scoped to homebrew-tap,
and opens a rerun-safe PR (force-push updates an existing one). The tap's
brew test-bot builds the bottles; a maintainer labels pr-pull to merge.
- .github/scripts/homebrew/generate_formula.py: uv pip compile resolves
omnigent[cursor]==<ver> for the macOS arm+intel matrix; each sdist becomes
a resource stanza via the PyPI JSON API. Brewed packages (certifi,
cryptography, pydantic, rpds-py, cffi, pycparser) are excluded — provided
by the formula's depends_on. No-sdist packages (e.g. cel-expr-python) are
skipped with a warning. --proxy routes resolution + metadata through an
internal mirror while rewriting download URLs to files.pythonhosted.org.
- .github/scripts/homebrew/omnigent.rb.template: hand-tuned formula skeleton
(desc, depends_on, install, test) with placeholders for the volatile parts.
No bottle/revision block — brew pr-pull adds those.
* ci(homebrew): add PR dry-run job to iterate on a branch
pull_request runs the workflow from the PR head, so a dry-run job
triggered on PRs touching the homebrew files generates the real formula
against the latest final release on public PyPI (no cross-repo PR),
ruby -c checks it, and it uploads as an artifact. This is the branch
iteration loop — no merge to main needed — mirroring the CI-test-on-PR
pattern in release-omnigent.yml.
* ci(homebrew): label-gated real tap PR from a branch
Add a homebrew-test label trigger to the pr job so a maintainer can
open a REAL PR on omnigent-ai/homebrew-tap from a feature branch
(without merging) — the tap's brew test-bot then builds the bottles.
Deliberate (label-gated) so it doesn't fire on every push; remove +
re-add the label to retrigger. resolve falls back to the latest final
release when there's no event/input tag (the label path). validate
keeps running the no-PR dry-run on code changes.
* ci(homebrew): drop the PR-test scaffolding, production triggers only
The pull_request dry-run + homebrew-test label path were scaffolding to
iterate on a branch before merge. Now that the release path is verified,
strip it: triggers are release: published + workflow_dispatch (reruns)
only, jobs are resolve + pr. Simplifies the resolve tag fallback and the
concurrency group back to the tag-only form.
Both skip mechanisms failed live because the release runners cannot
read the index (no pypi.org egress): the curl probe never matched, and
twine's --skip-existing pre-checks the same JSON API and crashed every
upload. Rewrite the rehearsal's idempotency step as a no-double-publish
check (re-upload must fail with 'File already exists') and mark the
skip-existing decision withdrawn in the design doc. Partial-publish
recovery stays yank + next version, as every release so far has worked.
Co-authored-by: Isaac
The new release.yml derived branch-X.Y names, but every actual release
branch in this repo is named release/vX.Y.0 (release/v0.2.0 through
release/v0.5.0) — the old RELEASING.md's branch-X.Y wording was doc
drift, not practice. Derive release/vX.Y.0, match it in the ci/lint
push triggers, and update the docs.
Also fold the first rehearsal's lesson into the runbook: the throwaway
version must never have touched the destination index (0.0.1rc1 was
spent reserving the PyPI names in June 2026 — colliding with it is what
failed the first secure-repo publish attempt), and real PyPI is the
preferred rehearsal destination since only it exercises the validate
job.
Co-authored-by: Isaac
The sidebar has an "auto-expand the active session's project" effect so
navigating to a filed session reveals it. It fired for pinned sessions too,
even though a pinned session is already reachable from the Pinned section.
A user who manually collapsed the project then clicked its pinned row saw
the folder pop open again, undoing the collapse (issue #2506).
Guard the effect: if the active session is in `pinnedSet`, skip the
auto-expand. The pinned row still navigates; the folder stays collapsed.
Adds a colocated Vitest regression covering both directions (pinned target
keeps the folder collapsed; non-pinned filed target still opens it), and a
Playwright e2e that drives the reporter's flow end-to-end.
Closes#2506
Signed-off-by: wahajmasood <wahajmasood9@gmail.com>
2026-07-15 23:07:34 +00:00
1041 changed files with 202421 additions and 89383 deletions
--body "Automated version bump via \`.github/workflows/bump-version.yml\` (mode: \`${MODE}\`, input: \`${NEW_VERSION}\`).
Rewrote \`[project].version\` and sibling \`==\` pins across all three packages (\`pyproject.toml\`, \`sdks/python-client\`, \`sdks/ui\`), the runtime \`VERSION\` constant in \`omnigent/version.py\`, and regenerated \`uv.lock\`.
Rewrote \`[project].version\` and sibling \`==\` pins across all four packages (\`pyproject.toml\`, \`sdks/python-client\`, \`sdks/ui\`, \`integrations/slack\`), the runtime \`VERSION\` constant in \`omnigent/version.py\`, and regenerated \`uv.lock\`.
Generated by \`scripts/update_versions.py\`. Opened via the omnigent-ci App when configured (CI runs automatically); on the GITHUB_TOKEN fallback, re-open or push to kick CI."
# Fail fast on HTML comments in the MDX: `<!-- ... -->` is invalid in
# MDX (only `{/* ... */}` works) and would break the site's `next build`
# only after the PR is opened. Catch it here so we never ship a red PR.
if [ -n "$post" ] && grep -qF '<!--' "${SITE}/${post}"; then
echo "::error::Drafted ${post} contains an HTML comment (<!-- -->); MDX requires {/* */}. Aborting."
exit 1
fi
if [ -n "$post" ]; then
printf '\n---\n\n**Enjoying Omnigent?** If this is useful to you, [give us a star on GitHub ⭐](https://github.com/omnigent-ai/omnigent). Come say hi on [Discord](https://discord.gg/omnigent), or [check the latest release](https://omnigent.ai/releases).\n' \
>> "${SITE}/${post}"
fi
# Generate the hero illustration from the drafter's IMAGE_PROMPT (the
# per-feature subject) plus a fixed brand style suffix, via the image
# model on the same gateway host. Fail-soft: any error leaves heroArt
# blank (the index falls back to a placeholder card), never blocking
# the draft. The scene is machine-drawn from the prompt, so no secret
# can reach it; the drafted-file secret scan above already ran.
image_prompt="$(sed -n 's/^IMAGE_PROMPT:[[:space:]]*//p' "/tmp/drafter_out_${i}.txt" | head -n1)"
if [ -n "$post" ] && [ -n "$image_prompt" ]; then
# GATEWAY_BASE_URL is scoped to THIS invocation only (not the step
# env), so the unsandboxed drafter run above never sees it and it
body="$(printf 'Drafts a feature-blog post for **%s**, selected by `feature-blog-scout` at the %s release cut.\n\n> **This is a DRAFT.** Before merging, a human must: record the mandatory demo (replace the `DEMO REQUIRED` marker) and do a final voice pass. The hero image and `author: omnigent` byline are auto-generated — review and optionally replace them.\n\n%s\n\nSource release: %s%s\n<sub>Generated by omnigent `.github/workflows/feature-blog.yml`. Review for accuracy before merging.</sub>' "$title" "$TAG" "$summary" "$TAG" "$mention")"
existing="$(gh pr list --repo "$SITE_REPO" --head "$branch" --state open --json url --jq '.[].url' | head -n1)"
if [ -n "$(gh pr list --repo "$TAP_REPO" --head "$BRANCH" --state open --json number --jq '.[].number')" ]; then
echo "Formula PR already open for $BRANCH — force-push updated it." \
| tee -a "$GITHUB_STEP_SUMMARY"
exit 0
fi
body="$(printf 'Bumps the **omnigent** formula to **%s**.\n\nRegenerates the stable `url`/`sha256` and every `resource` stanza from the PyPI dependency tree of `omnigent==%s` (resolved with `uv pip compile` for macOS arm + intel), spliced into the hand-tuned template in `omnigent-ai/omnigent` (`.github/scripts/homebrew/omnigent.rb.template`). The structural parts (`depends_on`, `install`, `test`) are unchanged.\n\nOnce `brew test-bot` builds the bottles, label this PR **`pr-pull`** so the tap'"'"'s `brew pr-pull` workflow commits the `bottle do` block and merges.\n\nGenerated by `omnigent-ai/omnigent` `.github/workflows/homebrew-tap-pr.yml` on the **%s** release.' "$VERSION" "$VERSION" "$TAG")"
gh pr create \
--repo "$TAP_REPO" \
--base main \
--head "$BRANCH" \
--title "omnigent $VERSION" \
--body "$body"
- name:Note skipped (no App token)
if:steps.app-token.outputs.token == ''
run:|
echo "::warning::OMNIGENT_BOT_APP_ID/KEY missing, or the omnigent-ci App isn't installed on $TAP_REPO with contents:write + pull-requests:write. The formula was generated (see the job summary) but the PR was not opened."
echo "### Homebrew tap PR skipped" >> "$GITHUB_STEP_SUMMARY"
echo "The omnigent-ci App token couldn't be minted — install the App on \`$TAP_REPO\` with contents:write + pull-requests:write and rerun." >> "$GITHUB_STEP_SUMMARY"
- name:Open or update the release-post PR (omnigent-site)
if:env.DRY_RUN != 'true'
working-directory:site
env:
GH_TOKEN:${{ steps.app-token.outputs.token }}
@@ -158,7 +353,7 @@ jobs:
echo "Release-post PR already open for ${RELEASES_BRANCH} — force-push updated it."
exit 0
fi
body="$(printf 'Publishes the **%s** release post at `/releases/%s`, mirroring the curated GitHub Release notes.\n\nGenerated by omnigent `.github/workflows/publish-changelog.yml`. Edit the GitHub Release, not this file.' "$TAG" "$VERSION")"
body="$(printf 'Publishes the **%s** release post at `/releases/%s` — the curated GitHub Release notes reformatted into the site'"'"'s narrative, prose-driven style.\n\nGenerated by omnigent `.github/workflows/publish-changelog.yml`. Edit the GitHub Release, not this file.' "$TAG" "$VERSION")"
gh pr create \
--repo "$SITE_REPO" \
--base main \
@@ -173,6 +368,7 @@ jobs:
# when the branch doesn't exist or carries nothing beyond main (e.g. a patch
# release with no staged docs).
- name:Open docs-branch → main PR (omnigent-site)
if:env.DRY_RUN != 'true'
working-directory:site
env:
GH_TOKEN:${{ steps.app-token.outputs.token }}
@@ -206,3 +402,38 @@ jobs:
--head "$DOCS_BRANCH" \
--title "docs: publish ${VERSION%.*} docs to the live site" \
--body "$body"
# ::add-mask:: redacts rendered logs, not artifact files — scrub the key
# from artifacts (incl. the unscanned stderr) before upload.
# Cut or advance a release deterministically (designs/RELEASE-AUTOMATION.md):
#
# dispatch with version=0.6.0rc1 -> create branch-0.6 from `ref`, stamp the
# dispatch with version=0.6.0rc1 -> create release/v0.6.0 from `ref`, stamp the
# lockstep version (scripts/update_versions.py + `uv lock`), tag v0.6.0rc1,
# push branch + tag. Later dispatches (0.6.0rc2, 0.6.0, 0.6.1) reuse the
# existing branch-0.6 head and ignore `ref`.
# existing release/v0.6.0 head and ignore `ref`.
#
# The branch + tag are pushed with the omnigent-ci App token, NOT GITHUB_TOKEN:
# GITHUB_TOKEN-pushed tags trigger no workflows by GitHub policy, and the whole
@@ -28,7 +28,7 @@ on:
required:true
type:string
ref:
description:"Branch/tag/SHA to cut branch-X.Y from. Only consulted when the branch does not exist yet (rc1); later phases build from the existing branch head."
description:"Branch/tag/SHA to cut release/vX.Y.0 from. Only consulted when the branch does not exist yet (rc1); later phases build from the existing branch head."
required:false
default:main
type:string
@@ -42,13 +42,18 @@ on:
required:false
type:boolean
default:false
skip_benchmark:
description:"Skip the pre-cut benchmark regression check (escape hatch — use deliberately)."
required:false
type:boolean
default:false
# Nothing here writes with GITHUB_TOKEN; pushes use the App token.
permissions:
contents:read
# Serialize all release runs: two concurrent cuts (even of different versions)
# could race the same branch-X.Y head.
# could race the same release/vX.Y.0 head.
concurrency:
group:release
cancel-in-progress:false
@@ -98,17 +103,17 @@ jobs:
VERSION:${{ inputs.version }}
run:|
set -euo pipefail
# Final X.Y.Z or a PEP 440 pre-release (a/b/rc). No dev/post here.
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9]+)?$ ]]; then
# Final X.Y.Z or a PEP 440 pre-release (rc). No dev/post/alpha/beta here.
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$ ]]; then
echo "2. Validate the rc from PyPI (see RELEASING.md). The GitHub draft for ${TAG} stays unpublished."
echo "2. Validate the rc from PyPI (see RELEASING.md). No GitHub release is created for rc tags (rcs live on PyPI only) — skip straight to the next rc or the final cut."
else
echo "2. Merge the CHANGELOG PR, curate the ${TAG} draft notes, then dispatch finalize-release.yml (tag=${TAG})."
--body "🔁 \`/rerun\`: no failed CI runs on the current head (\`${SHA:0:7}\`) to re-run. If a check is stuck *pending*, it needs a push or a maintainer, not a re-run."
exit 0
fi
RERAN=""
while IFS=$'\t' read -r id name; do
[ -n "$id" ] || continue
echo "• Re-running failed jobs in '$name' (run $id)"
# --failed: re-run only the failed jobs (cheapest path for a flake).
# --repo is REQUIRED: this job has no checkout, so `gh run rerun`
# cannot infer the repo from a git remote and would fail client-side.
if gh run rerun "$id" --repo "$REPO" --failed; then
RERAN="$RERAN"$'\n'"- $name"
else
echo "::warning::Could not re-run '$name' (run $id) -- may be in progress."
RERAN="$RERAN"$'\n'"- $name ⚠️ (skipped: already running or not re-runnable)"
fi
done < <(printf '%s\n' "${FAILED[@]}")
NOTE="The \`Merge Ready\` gate re-evaluates automatically when these complete."
gh pr comment "$PR_NUMBER" --repo "$REPO" \
--body "🔁 \`/rerun\`: re-running failed jobs on \`${SHA:0:7}\`:${RERAN}"$'\n\n'"$NOTE"
- [UI / Feature] Added a Nord color theme (arctic frost-blue palette) to the Appearance settings palette picker.
- [Feature] Per-harness startup command/args overrides via a polymorphic `harness:` key in `config.yaml`. The `harness:` key now accepts a mapping with a `default` plus per-harness `command`/`args` overrides (e.g. `harness: {default: claude-sdk, codex: {command: /usr/local/bin/codex, args: [--config, approval_policy=on-request]}}`). The legacy scalar form (`harness: claude-sdk`) still works and auto-migrates to the mapping form on the next config write. Harness binary-path precedence: `OMNIGENT_<NAME>_PATH` env var > config `harness.<id>.command` > built-in default; `args` follow the same precedence with config `args` as the base and CLI pass-through args appended. The `OMNIGENT_<NAME>_PATH` env var (base id, `-native` suffix stripped) is the canonical per-binary override, standardizing the headless `HARNESS_<NAME>_PATH` and native `OMNIGENT_*_PATH` conventions into one namespaced name; the legacy `HARNESS_<NAME>_PATH` is still read as a deprecated fallback that logs a one-time warning + a CLI startup notice, and is slated for removal in v0.8.0. The pre-existing `omnigent claude --command` flag is deprecated (warns on use, pointing to `OMNIGENT_CLAUDE_PATH`/config) and will be removed in a future release; no other native command gained a `--command` flag — override via env or config.
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/omnigent-ai/omnigent/blob/main/CONTRIBUTING.md) for how to set up your environment, run the checks, and open a pull request.
@@ -128,15 +128,53 @@ writing nothing to disk — use HTTPS repository URLs. Details by provider match
| Key | Meaning |
|---|---|
| `server_url` | URL the runner Pod's host dials back to (in-cluster service DNS by default). |
| `host_config` | Optional, top-level under `sandbox:` (provider-agnostic, not inside `kubernetes:`): verbatim in-sandbox `~/.omnigent/config.yaml` content installed before `omnigent host` starts — e.g. a `providers:` block routing the `pi` harness through a self-hosted gateway (LiteLLM/vLLM). Server-managed: entries injected by a previous launch are replaced or removed on the next launch/resume; config created inside the sandbox survives. Keep secrets out via `api_key_ref: env:VAR`, resolved inside the runner Pod against the `secret_name` Secret. Validated at server startup. |
| `namespace` | Runner-Pod namespace (defaults to `omnigent-sandboxes`). |
| `secret_name` | Harness-creds Secret projected into every Pod via `envFrom`. |
| `service_account` | ServiceAccount the runner Pods run as (powerless). |
| `image` | Optional runner image override (defaults to the official multi-arch amd64/arm64 host image). |
| `env` | Optional list of SERVER env-var names to inject as literal Pod env (prefer `secret_name` for credentials). |
| `node_selector` | Optional extra node labels, merged with a default `kubernetes.io/arch: amd64` — set that key to `arm64` to schedule runners on arm64 nodes. (arm64 note: the CEL policy module is unavailable there — `cel-expr-python` ships no aarch64 wheel — and degrades gracefully.) |
| `node_selector` | Optional extra node labels, merged with a default `kubernetes.io/arch: amd64` — set that key to `arm64` to schedule runners on arm64 nodes. |
| `in_cluster` | Optional cluster-config source: `true` (in-cluster SA only), `false` (kubeconfig only), omit (try in-cluster, then kubeconfig). |
| `kubeconfig` | Optional kubeconfig path for the out-of-cluster fallback (env: `OMNIGENT_KUBERNETES_KUBECONFIG`). |
| `pvc_mounts` | Optional pre-created PersistentVolumeClaims mounted into every runner Pod — see [Persistent storage mounts](#persistent-storage-mounts-pvc_mounts). |
## Persistent storage mounts (`pvc_mounts`)
Runner Pods are ephemeral by design — the workspace lives on an `emptyDir` and
dies with the Pod. To expose durable data (datasets, model caches, shared
output directories) mount pre-created PersistentVolumeClaims:
1. Create the PV/PVC **in the runner namespace** (`omnigent-sandboxes`) out of
band — via your GitOps repo, with whatever backend your cluster provides
(NFS/SMB CSI drivers, SAN, cloud disks). Omnigent only references the claim;
it never creates volumes, so the server RBAC stays unchanged.
2. List the claims under `sandbox.kubernetes.pvc_mounts` (see
`sandbox-config.yaml`). Mount paths may not overlap `/home/omnigent`, the
OS directories, or their ancestors (e.g. `/home`, `/var`) — the server
rejects such config at startup.
Caveats:
- **Multiple runners share writable claims concurrently** — use a
`ReadWriteMany`-capable backend (NFS/SMB/CephFS) for anything writable, and
prefer `read_only: true` (the default) everywhere else: a writable shared
mount lets one session's agent read and modify what another session wrote,
and anything written there outlives the Pod and its launch token.
- Runner Pods run as uid/gid 1000660000 with `fsGroup`. NFS `root_squash` and
SMB ownership mapping must permit that identity (export to the uid, or use
CSI mount options like `uid=`/`gid=` for SMB); `fsGroupChangePolicy:
OnRootMismatch` avoids re-chowning large exports on every start.
-`ReadWriteOnce` claims pin all runners to one node — combine with
`node_selector` deliberately, or the second Pod sits `Pending`.
- A mount visible in the Pod is not automatically visible to a harness's own
OS-level sandbox (OmniBox path grants are separate).
To verify `host_config` end to end against a live cluster, run
application that obtained the grant so every delegated action is attributable
to it.
- `scope` — set to `DELEGATED_SCOPE` (`"sessions"`). The auth layer's
fail-closed allowlist `delegated_path_allowed` restricts a token carrying
this scope to `/health`, `/v1/agents`, `/v1/hosts`, `/v1/sessions`,
`/v1/runners`, `/oauth/token`, `/oauth/revoke` (exact or `prefix/…`);
everything else — including admin / user-management (`/auth/users*`, invites,
setup) — is rejected.
- `grant_id` — checked against the revoked-grant denylist (`is_revoked`, wired
via `set_grant_revocation_check`) on **every** request for a delegated token,
so revoking the grant kills the token immediately. Delegated tokens carrying
a `grant_id` skip the credential cache (they return before the cache write),
keeping the per-request revocation check honest without making ordinary
(non-delegated) sessions stateful. Fail-closed: an unknown `grant_id` reads
as revoked.
- `jti` — unique token id for audit/log correlation (not a revocation key;
revocation is grant-scoped, not per-token).
## Slack-side changes
- **`oauth.py`** — device-authorize → post ephemeral link → poll token
endpoint (respecting `interval` / `slow_down`) → store tokens.
- **`omnigent.py`** — attach `Authorization: Bearer` per
`(server_url, slack_user_id)`; on 401, refresh once and retry; on refresh
failure, surface a re-login prompt. `OmnigentClientPool` keys clients by
`(server_url, slack_user_id)` instead of `server_url` alone.
- **`store.py`** — new `oauth_tokens` table `(team_id, user_id, server_url)` →
access/refresh **encrypted at rest** (key from env / secret manager, never in
the DB). `/omnigent logout` → `POST /oauth/revoke` + local delete.
- **`setup.py`** — validation uses the user's token, so auth-enabled servers
are supported.
- **`config.py`** — holds the local encryption key for token storage.
## Security analysis
| # | Threat | Mitigation |
|---|--------|-----------|
| 1 | `device_code` leak → token theft | Never transits Slack or the user — only `verification_uri_complete` (a `user_code`) does. Stored hashed; single-use. |
| 2 | Link misdelivery / phishing another user | Link shown to the initiator only (in their own setup modal). **Consent requires a login started FOR this flow: the consent page rejects a session whose `iat` predates the grant and bounces through the login page with `reauth=1`, forcing a fresh password entry even for an already-signed-in user.** So an attacker-initiated flow can't be approved by a single reflexive click — the victim must deliberately re-enter their password against a screen naming the exact Omnigent identity and requesting `client_id`. The gate is enforced on both the consent GET and the approve POST. |
| 3 | Anyone can initiate/poll (public client) | Cheap `pending` state grants nothing until an authenticated user approves. `POST /oauth/device/authorize` is rate-limited per client IP (10/60s → 429 `slow_down`); short (10 min) `device_code` expiry; `slow_down` enforced server-side on aggressive polling; expired grants purged opportunistically. |
| 5 | Compromised Slack server acts as all users (inherent to delegation) | Reduced scope (no admin), short TTL + refresh rotation, per-grant revocation, **absolute grant lifetime (30 d) enforced on refresh** so even an un-revoked grant dies, and an `act`-claim audit trail. |
| 6 | Confused deputy — user A's token used for user B | On the Slack side, token lookup is strictly keyed by acting `slack_user_id`; the thread `owner_user_id` gate drops non-owner follow-ups (`service.py`). |
| 7 | Stale/leaked delegated token can't be revoked | Per-grant `grant_id` revocation denylist (`is_revoked`, checked every request) makes delegated-token revocation immediate — closes today's stateless-JWT gap for these higher-value tokens. |
| 8 | Refresh-token theft | Rotation on every use + **reuse detection**: the just-superseded token's digest is retained in `prev_refresh_token_hash`; presenting it (a replay) is recognised and revokes the whole grant, killing the attacker's freshly-rotated token too. |
| 9 | Transport interception | Require HTTPS for `verification_uri` and all token/bearer traffic; refuse the flow over plaintext except localhost dev. |
| 10 | Open redirect on the consent login bounce | Reuse `_sanitize_return_to` (OIDC, `routes/auth.py`) / `sanitizeReturnTo` (accounts SPA). Verified both providers reject absolute / `//` targets. |
| 11 | CSRF on approve/deny if `SameSite=none` is ever enabled | `_require_browser_origin` rejects a **missing**`Origin` on approve/deny (stricter than the shared `require_trusted_origin`, which fail-opens for non-browser clients). These routes are browser-only, so the CSRF defense no longer depends on the cookie's `SameSite`. |
### Device-code phishing — accepted risk, mitigated in depth
The canonical RFC 8628 risk: a stranger initiates a flow and tricks a victim
Omnigent user into approving the verification link, binding the grant to the
*victim's* identity while the attacker (holding the `device_code`) polls for the
token.
When no client secret is configured the endpoints are **public**, so
initiation is open — the defense is layered, not a gate:
- **Forced re-authentication at consent.** Consent requires a login started for
THIS flow: the consent page (and the approve POST) reject a session whose
`iat` predates the grant's `created_at` and bounce through the login page with
`reauth=1`, which forces a fresh password entry even for an already-signed-in
user. This defeats the reflex-approve variant of the attack — a victim handed a
one-click link (even one with the code prefilled) still can't bind the grant
without deliberately re-entering their password against a screen naming the
exact identity and client. (`device_auth.py``_session_iat` + the
`reauth=1` bounce; `LoginPage.tsx` suppresses its already-signed-in
auto-return under `reauth=1`.) The prefilled one-click link is therefore
retained for convenience — the re-auth step, not code handling, is the gate.
- The consent page prominently **warns** the user to approve only a login they
personally started and to match the code shown by the application.
- The delegated scope excludes admin / user-management endpoints.
- The grant has a 30-day absolute lifetime and is revocable; a leaked/phished
grant self-expires even if never revoked.
- Initiation is rate-limited per IP; nothing is granted until a real user
authenticates and approves in their own browser.
- **Startup warning.** When the grant is mounted on a multi-user (accounts)
server with `OMNIGENT_DEVICE_CLIENT_SECRET` unset, the server logs a loud
warning at startup that the authorize endpoint is public — nudging the
operator to opt into the secret rather than leaving initiation open unknowingly
(`app.py`, at the device-router mount).
Setting `OMNIGENT_DEVICE_CLIENT_SECRET` closes initiation entirely to
unauthorized callers: without the matching `X-Omnigent-Client-Secret` header,
authorize / token / revoke return `401 invalid_client` before anything is
created, so only the operator's own client (which holds the secret) can even
start a flow. This is now shippable to the Slack client because its server
target is a fixed operator config, not a user-supplied URL — the secret only
ever travels to the trusted server. The consent-page warning, short TTL, and
absolute lifetime remain the defenses when the secret is left unset.
### Deliberate deviation from the current model
Ordinary Omnigent session JWTs are stateless and unrevocable today (revocation =
cookie deletion + expiry). Delegated tokens are higher-value — one server acts
for many users — so this design makes **delegated** tokens revocable (persisted
grant + per-`grant_id` revocation check) while leaving normal sessions
stateless. This added invariant is the main thing for reviewers to scrutinize.
## Out of scope / follow-ups
- Admin UI for listing and revoking active Slack delegations.
- Multi-replica rate limiting: the authorize throttle is in-process; a
horizontally-scaled server would want a shared store (the grant table's
single-use/expiry semantics already bound abuse in the meantime).
- Applying the same delegated grant to other non-browser clients (the CLI could
use it too, superseding the in-memory `_cli_tickets` store).
- Per-scope consent granularity beyond the single "session APIs, no admin" scope.
| 1 | **Create empty project** | ✅ | first-class `projects` table (needed for empty) | Always-visible **Projects** section in the sidebar; "New project" creates one with zero sessions |
| 2 | **Move session in / create session in project** | ✅ | `project_id` FK on session | Session-row kebab "Add to / Move / Remove from project"; "New session here" from a project header, pre-filling its defaults |
| 3 | **Rename projects** | ✅ | `PATCH /projects/{id}` on `name` (members untouched) | Inline rename from the project header |
| 4a | **Default working dir / host / harness** | ✅ (soft hints) | default columns on project | "New session here" pre-fills the new-chat dialog; unsatisfiable hints (host offline / not owned) are silently dropped |
| 4b | **Project memory** (owner-private) | ✅ | DB-backed, scoped to project, host-agnostic | Agent accumulates learnings across the project's sessions; never exposed to shared-session recipients |
| 4c | **Project context** (owner-private) | ✅ | curated docs/instructions attached to project | Owner-curated inputs seed each session started in the project |
| 5 | **Project-level sharing / ACL** | ❌ intentional | — | Sharing stays **per-session** (existing ACL). A shared session appears **ungrouped** in the recipient's "Shared with me" — no project, no memory/context |
| opt | **Reorder projects** | 🔵 optional | client-only (localStorage, no DB column) | Drag-to-reorder in the sidebar; nice-to-have, not required for launch — see §7.2 |
| `id` type | `String(64)`, `proj_`-prefixed | Reads as a sibling of `conv_…` ids; lives in the metadata String column. Newest tables use `Uuid16` — diverge here for readability + column symmetry. |
| Membership location | `project_id` on `omnigent_conversation_metadata` | Metadata already holds host/workspace/runner; `list_conversations` can filter it inline. |
| Name uniqueness | per-`(workspace, owner)` unique index | Matches §7.1; case-sensitivity still open (Q3). |
| Ownership | `owner_user_id`**column on the row** | See "Where ownership lives" below — differs from sessions on purpose. |
| Ordering | **no `position` column** | Reorder is deferred and client-only (§7.2); no server state until proven needed. |
| Deferred columns | default host/workspace/harness/model, memory/context refs | Added in Phase 2/3, not now. |
**Where ownership lives (why a column, not the permission table).** The repo has
two ownership conventions, and which is correct depends on whether the entity is
shareable:
- **Sessions** have *no* owner column — ownership is derived from
`session_permissions` as the `LEVEL_OWNER` grantee (`get_session_owner`,
`list_projects(owned_by=...)`). This is required *because sessions are shared*:
ownership is just the top row among many `(user, level)` grants.
- **`scheduled_tasks`** — a personal, non-shareable artifact with no ACL — instead
stamps `owner_user_id` directly on the row (`db_models.py:1298`), indexed
`(workspace_id, owner_user_id, id)`.
Projects follow `scheduled_tasks`, not sessions, **because §9 gives them no
project-level ACL** — they're owner-private, single-owner, never granted to
anyone else. With no `project_permissions` table to derive from, `owner_user_id`
on the row is the correct and consistent choice. (The v1 label-based
`list_projects` derives ownership from `session_permissions` only because a label
has no row of its own to stamp — the first-class table removes that constraint.)
If §9 is ever reversed and projects become shareable, we would drop this column
and derive ownership from a `project_permissions` ACL, mirroring sessions.
**Migration (mirrors `z6…`):** `op.create_table("projects", …)` with the two
indexes; `op.add_column("omnigent_conversation_metadata", project_id)` + its
index. **No backfill needed** for empty-project support — existing sessions stay
`project_id = NULL` (unfiled). The `omni_project`-label → `project_id` backfill
is a **separate, later** step (only when migrating v1 label-projects), kept out
of this migration so Phase 1 stays clean and reversible.
## 6. Priority 2 — Move session in / create session in project
### 6.1 What
Move existing sessions into (or out of) a project, and start new sessions
already filed in a project.
### 6.2 UX — how a session joins a project
We deliberately **do not** add a project picker to the generic new-chat dialog.
That dialog is already dense (agent, host, workspace, git, model, effort,
permission mode); a picker would complicate the most-used "just start a chat"
flow. Sessions join projects from the project surface instead:
| Path | Behavior |
|---|---|
| **New session within a project** (primary) | From a project's header, "New session here" opens the new-chat dialog with the project pre-set and its defaults (host/workspace/harness — §8) pre-filled. This is where "create in project" happens. |
| **After creation** (session-row kebab) | "Add to / Change / Remove from project" submenu, `PATCH /v1/sessions/{id}` — for reorganizing existing sessions. |
| `git_https` | `Authorization: Basic b64(user:<real>)` | swap-on-access | Preset for git-over-HTTPS; nothing in the sandbox. |
| `gh_basic` | Basic for git host, `token` for api host | swap-on-access for git; `GH_TOKEN`/`GITHUB_TOKEN` env for api | Preset for GitHub CLI + git; defaults to `github.com` + `api.github.com`. |
| `databricks_cli` | `Authorization: Bearer <real>` per workspace host | placeholder `.databrickscfg` file (one `oa_cred_*` per profile) | Preset for the Databricks CLI; takes `profiles` (+ optional `default`). See below. |
Common fields: `target`/`targets` (host + optional path glob — only the
host binds the credential; path scoping is delegated to `egress_rules`),
@@ -152,6 +153,54 @@ parser) that rejects unknown keys, enforces exactly one source key, and
checks POSIX env-var names — then converts to the `CredentialSourceSpec`
Built-ins keep living in core but route through the generic seam. The test bar
for every PR here is **"every native harness behaves identically before/after"**
— lean on the split native test suite (#3149) and the native e2e skills. The
validator keeps rejecting community native metadata throughout Phase 1.
| PR | Scope | Key files | Depends on | Risk | Est. |
|---|---|---|---|---|---|
| **1.1 Provider model + resolver** | Add `NativeHarnessProvider` (import-path strings), the `native_providers` field + accessors, and `omnigent/native_dispatch.py` (lazy `importlib` resolver, cached per path). Populate 11 built-in providers pointing at existing `omnigent.<x>_native` functions. Purely additive — no hub rewired yet. | `harness_plugins.py`, new `native_dispatch.py` | — | Low | 1–2d |
| **1.2 Signature normalization** | Give `run_<x>_native` a uniform `extra_args` spelling with a back-compat `<x>_args` alias (one-release deprecation per CLAUDE.md — name the target release). Decide the `**extra` protocol for the four special-kwarg harnesses (claude/codex/antigravity/opencode). | 11 `omnigent/<x>_native.py`, `native_dispatch.py` | 1.1 | Low–Med (mechanical ×11) | 2–3d |
| **1.3 Resume hubs** | Collapse `resume_dispatch._dispatch_wrapper` (10 arms) and the 6 `chat.py``_run_<x>_native_resume_redirect` helpers into one `resolve(provider.run_native)(...)` path. Deletes the redirect helpers and normalizes the 10-vs-6 coverage gap. | `resume_dispatch.py`, `chat.py` | 1.1, 1.2 | Med | 2d |
| **1.4 CLI subcommands** | Replace the 11 hand-written `@cli.command` funcs in `cli_native.py` with a loop over `native_agents()`, registering one Click command each; make `_reject_native_on_windows` a registry-driven guard. Wrinkle: per-command options (`--model`, `--command`) must come off provider/row metadata. | `cli_native.py`, `cli.py` | 1.1, 1.2 | Med | 2–3d |
| **1.5 Runner launch + terminal-route** | The epicenter. Replace spawn-env (22 arms), launch (11 + 3 elif), and terminal-route (11) dispatch in `app.py` with `resolve(provider.auto_create_terminal / spawn_env_builder)(...)`. **Preserve the `_supervise_*_bridges` forward-cursor / restart / double-post invariants exactly.** Likely splits into 1.5a spawn-env and 1.5b launch+route. | `runner/app.py`, `runner/native/orchestration.py` | 1.1, 1.2 | **High** | 4–6d |
| **1.6 Runner interrupt/stop** | Route interrupt/stop through `resolve(provider.interrupt_handler / stop_handler)`; fill the 9/7 coverage gaps so every native has both paths. | `runner/app.py` | 1.1 | Med | 2d |
| **1.7 Seeding loop** | Replace the 26 `_ensure_default_<x>_agent` / `_build_<x>_native_bundle` touchpoints in `server/app.py` with a loop materializing via `provider.materialize_agent_spec`. **`builtin_agent_id` output must stay byte-identical** so redeploy doesn't orphan seeded agents — pin this with a test. | `server/app.py`, `db/utils.py` | 1.1 | Med | 2–3d |
| **1.8 Derive enumerations** | Add a `fork_history: Literal["none","rebuild","preamble"]` axis to `HarnessCapabilities`; derive the §5 frozensets/dicts from `native_agents()` / capabilities (8 files, ~35 sets); delete the dead `_HARNESS_MODULES` literal. | `harness_capabilities.py`, `_omnigent_compat.py`, `harness_readiness.py`, `harness_install.py`, `model_override.py`, `model_catalog.py`, `_sessions/common.py`, `resource_registry.py`, `runtime/harnesses/__init__.py`, `tests/test_harness_capabilities.py` | 1.1 | Med | 2–3d |
After 1.1 + 1.2 land, PRs 1.3–1.8 touch mostly disjoint hubs and can proceed in
Only starts once Phase 1 has every built-in running *through* the seam.
| PR | Scope | Key files | Depends on | Risk | Est. |
|---|---|---|---|---|---|
| **2.1 Validator flip** | Replace the hard reject in `_validate_community_contribution` with positive validation: every `native_agent.key` has a matching `native_provider.key`; provider import paths start with `COMMUNITY_MODULE_PREFIX`; identity values don't collide (`_native_agent_identity_values` already checks this); `run_native` + `auto_create_terminal` are non-empty. | `harness_plugins.py` | 1.1 | Low–Med | 1d |
| **2.2 `/v1/harnesses` native rows** | Extend `harness_catalog()` to emit native-agent rows + capabilities (`agent_name`, `wrapper_label`, `fork_history`, icon/label field), so the web has a server source of truth. | `harness_plugins.py`, `server/routes/harnesses.py` | 1.8 | Low | 2d |
| **2.3 Web off the endpoint** | Delete the `nativeCodingAgents.ts` literals + `HARNESS_ALIASES`, the `forkHarness.ts` sets (`NATIVE_REBUILD_HARNESSES` / `PREAMBLE_FORK_HARNESSES` now come from `fork_history`), the `AgentCard` icon switch, and the wrapper-label literals in `sessionStop.ts` / `sessionCapabilities.ts` / `codexPlanMode.ts` — all driven by `/v1/harnesses`. Needs a **demo (screenshots/recording)** per CLAUDE.md; likely splits into 2.3a fork/capabilities data-plumb and 2.3b icon/label rendering. | `web/src/lib/*`, `web/src/components/AgentCard.tsx` | 2.2 | Med–High (largest FE) | 4–6d |
| **2.4 Docs + example plugin** | Extend `designs/harness-plugin-interface.md` § "Native TUI Harnesses" with the native checklist, and ship an example native plugin (`examples/` or a sibling `omnigent-foo-native`) proving the contract end to end. | `designs/harness-plugin-interface.md`, `examples/` | 2.1, 2.2 | Low–Med | 2–3d |
| `session_cold_start` | Spawn a **fresh runner process**, wait for its tunnel, bind a session, and drive the first turn to `idle` — the full new-conversation cold path |
| `session_cold_start` | Create a new host-bound session and time its fresh runner launch through the first token — the full new-conversation cold path |
| `session_cold_restart` | With an existing session's runner stopped before the sample, post a user message and time the automatic runner relaunch to first token |
| `warm_turn` | Drive a turn on an already-warm session — steady-state dispatch overhead |
| `time_to_first_token` | Post a turn; time to the first streamed `output_text` delta |
| `interrupt` | Interrupt a running (gated) turn; time to cancellation |
**Host:** standalone attended agy in a dedicated tmux session `agy-spike` (no `--dangerously-skip-permissions`), launched with `HOME=/Users/bryanli`. NOT the `:6767` omnigent; fully isolated from the `rdv-*` sessions.
- `step.completedInteractions[].{request, response}` (response echoes the delivered answer)
Status enum observed live: `CORTEX_STEP_STATUS_{DONE, WAITING, ERROR}` (and transient `PENDING/RUNNING/GENERATING` in `metadata.internalMetadata.statusTransitions`).
Step-type enum observed live (9 distinct): `USER_INPUT, CONVERSATION_HISTORY, PLANNER_RESPONSE, CHECKPOINT, RUN_COMMAND, LIST_DIRECTORY, ASK_QUESTION, VIEW_FILE, CODE_ACTION` (VIEW_FILE / CODE_ACTION observed in the trajectory but not all saved as fixtures — the mapper only needs the type/status discriminator + the per-type payload key, which follows the same `camelCase(type)` convention, e.g. `viewFile`, `codeAction`).
### 1.1 ERROR fixture provenance
`run_command_error.json` is the **one synthesized fixture** (all others are verbatim live captures). It was **derived from the live `run_command_waiting.json`** (same conversation `2399249c…`, same real `trajectoryId`/`stepIndex`) by flipping `status``WAITING`→`ERROR` and appending the `WAITING`→`ERROR``statusTransition` — i.e. exactly the timeout flip described in design §2.1. The WAITING shape and the timeout-flip behavior are both live-verified; only this exact ERROR *snapshot* is synthesized. The fixture carries an explicit `_fixtureProvenance` string so it can never be mistaken for a verbatim capture (drop/ignore that key when asserting shape).
Why synthesized rather than captured: I made several honest live attempts and none produced an ERROR within a reasonable window:
- left an `ASK_QUESTION``WAITING` step unanswered for ~3 min → stayed `WAITING` (no timeout);
- left a `RUN_COMMAND` permission `WAITING` step (`echo hello-spike`, index 42) unanswered for >5 min → stayed `WAITING` (no timeout);
- `CancelCascadeSteps {cascadeId}` returned `200 {}` but did **not** flip the `WAITING` step (see §4).
So in agy 1.0.10 the `WAITING`-interaction timeout window is **long (minutes), not seconds** — the §2.1 gotcha is real (the prior memory hit it via slow human delivery) but it is not a quick way to elicit an ERROR step in a spike. Treating ERROR as the labelled-synthesized fallback (per the task brief) was the right call rather than blocking the task.
---
## 2. Step 3 — turn-send verdict
**Verdict: KEEP tmux `send-keys` for user turns. Do NOT use an RPC to send turns.** (Confirms the prior memory + design §2/§7.)
Evidence:
- A turn typed via `tmux send-keys -t agy-spike '<text>' Enter` is recorded as a `CORTEX_STEP_TYPE_USER_INPUT` step with **`metadata.source = CORTEX_STEP_SOURCE_USER_EXPLICIT`** and `userInput.userResponse == "<text>"` (see `user_input.json`). This is exactly what the read path keys on, so send-keys turns are attributed correctly.
- `SendAgentMessage` (the only message-injection RPC on the surface) is documented (memory + design) to record the turn as a `SYSTEM_MESSAGE` ("not actually sent by the user"), which the mapper would then skip/mis-attribute — so it cannot drive user turns. I did **not** re-issue `SendAgentMessage` in this spike (no need to perturb the live session to re-confirm a settled, documented negative; and the mapper already skips USER_INPUT regardless).
- I scanned the live RPC surface for a *proper* user-turn method (a queued-user-input / "send all queued messages" path). The methods exercised/observed on `LanguageServerService` this session were `Heartbeat`, `GetConversationMetadata`, `GetCascadeTrajectorySteps`, `HandleCascadeUserInteraction`, `StreamAgentStateUpdates`. No `SendAllQueuedMessages` / `EnqueueUserInput` / `SubmitUserTurn`-style method was found that records as `USER_INPUT`. **No viable user-turn RPC exists in 1.0.10.**
Implication for the plan: the executor's `run_turn` stays on tmux `send-keys` (design §5/§7 unchanged). Only **interactions** (answers/approvals) and **interrupt** move to RPC.
### 2.1 Important live finding — attended TUI keeps its OWN prompt in parallel with RPC
When agy runs **attended** (auto-exec OFF) and you drive turns by `send-keys`, the **TUI maintains its own permission/question prompt in-process, in parallel with the RPC step state.** Observed live:
- An RPC `HandleCascadeUserInteraction` approval flips the trajectory step to `DONE` and the command runs (verified: `run_command_done.json` has `exitCode:0` + output) — but the **TUI prompt for that same interaction can stay open**, and a subsequent `send-keys` lands in that TUI prompt's filter/amend buffer instead of starting a new turn (observed: a follow-up turn got concatenated into the persist-pattern option text). Pressing `Escape` clears the stale TUI prompt (the TUI then reports "User declined the tool call" for *its* prompt, harmlessly — the RPC-approved command had already run).
Consequences for the production design:
- This is a **non-issue for the real bridge**, which is RPC-driven for interactions and does NOT type interaction answers via the TUI. It is a strong **reason to deliver interactions over RPC, not send-keys**.
- But it means a turn `send-keys`d **while a prior interaction's TUI prompt is still open** can be swallowed. The runner-owned terminal in production should ensure the TUI is at an idle `>` prompt before send-keys'ing a new turn (the read driver already knows the trajectory is idle — no `WAITING`/`RUNNING` step — which is the right gate). Worth a note in Task 11/12.
---
## 3. Step 4 — read-mode verdict
**Verdict: default to `StreamAgentStateUpdates` (server-stream) with `GetCascadeTrajectorySteps` polling as the fallback / reconcile path.** (Matches the memory lean + design §6.)
- Unary `POST {"cascadeId": conv}` → `200 {"steps":[...]}`. Rock-solid every call this session (dozens of calls, 0 failures). Returns the **complete** step list each time (full snapshot), with explicit per-step `status` — trivial to dedup by `stepIndex`/identity. Typical round-trip a few ms on loopback.
- This is the **simplest correct** read path and the natural reconcile-on-reconnect mechanism. The whole point of the RPC rework (design §3) is that these structured snapshots remove the JSONL cursor/gap logic and fix the double-render.
- **Request MUST be connect-enveloped.** This is a correction to the memory note: sending a bare JSON body `{"conversationId": conv}` to `StreamAgentStateUpdates` returns a single connect error frame:
— the server reads the first 5 bytes of the JSON as the connect envelope header. The body must be framed as `[flag:1=0x00][len:BE-uint32][json-bytes]` (same 5-byte envelope as the response frames). Content-Type `application/connect+json`.
- With the **enveloped** request: `200`, the stream **stays open and long-polls**. First frame carrying steps arrived **~0.13 s after a turn was sent** (measured: `first_steps_frame_at = 0.132 s`); the stream then emits a burst of incremental `update` frames as steps progress (`update.mainTrajectoryUpdate.stepsUpdate.steps[]`), each `flag=0`, then blocks (long-poll) when the trajectory goes idle. A trailing `flag=2` frame carries the connect end-of-stream / error envelope.
- **Reliability caveat:** because the stream blocks when idle, a naive reader must use a read timeout / heartbeat and reconnect, and must **reconcile via a `GetCascadeTrajectorySteps` snapshot on (re)connect** to avoid missing a transition that happened during a gap. The connect framing (envelope on both request and response) is fiddly to get exactly right (cost me one iteration), so the client wrapper must own it and be unit-tested against the captured frames.
### 3.3 Recommendation
- **Default: stream** for low-latency detection of `WAITING` interactions and step progress (~130 ms vs a poll interval), **with poll as the fallback**: (a) reconcile snapshot on every (re)connect, (b) fall back to pure polling if the stream errors/regresses. This matches design §6 ("polls `GetCascadeTrajectorySteps`*or* consumes `StreamAgentStateUpdates`").
- **Acceptable de-scope:** if the connect server-stream framing proves too costly to harden in the implementation tasks, **ship poll-first** (a tight `GetCascadeTrajectorySteps` loop, e.g. 250–500 ms while a turn is active) and add the stream as a follow-up. Polling alone is fully correct (full snapshots + explicit status); the only thing lost is sub-second push latency. The interaction bridge's tight detect→deliver loop (design §2.1) already re-reads the freshest `WAITING` step at delivery time, so poll-first does not compromise interaction correctness.
---
## 4. Other live confirmations (for Tasks 2/3/5/8/10)
- **Approval round-trip (Task 3/8):**`HandleCascadeUserInteraction {cascadeId, interaction:{trajectoryId, stepIndex, permission:{allow:true}}}` → `200 {}`; the `RUN_COMMAND` step flipped `WAITING`→`DONE` with `exitCode:0` and real `combinedOutput.full`. `trajectoryId`+`stepIndex` come from the WAITING step's `metadata.sourceTrajectoryStepInfo`. (Exactly the memory shape; `permission.allow`, no `approvalId`.)
- **Answer round-trip (Task 3/8):**`HandleCascadeUserInteraction {... interaction:{trajectoryId, stepIndex, askQuestion:{responses:[{question:"<verbatim>", selectedOptionIds:["4"]}]}}}` → `200 {}`; the `ASK_QUESTION` step flipped to `DONE` and the cascade proceeded autonomously. `selectedOptionIds` uses the option `id` (`"1".."N"`), not the text.
- **Tool cwd:** agy executes `run_command` in its own scratch dir (`combinedOutput.full` for `pwd` = `/Users/bryanli/.gemini/antigravity-cli/scratch`), NOT the agy launch CWD. Benign, but worth knowing for any cwd-sensitive parity check.
- **`GetConversationMetadata` ownership probe** still works as the discovery module expects (`metadata.rootConversationId` echo) — port discovery via `omnigent/antigravity_native_rpc.py` worked first try.
- **`CancelCascadeSteps` (Task 10) — accepts `{cascadeId}` but does NOT cancel a WAITING-for-interaction step.** `POST CancelCascadeSteps {"cascadeId": conv}` → `200 {}` (so, contrary to the old `antigravity_native_rpc.interrupt_turn` worry, the *conversation/cascade id alone is accepted* as the request key — no internal invocation id was needed for a `200`). **However** the live `RUN_COMMAND``WAITING` step did **not** change status after the call (still `WAITING`, no new `statusTransition`). So for Task 10: `CancelCascadeSteps {cascadeId}` is wired-up-able with just the conversation id, but its effect on a step that is `WAITING` on a human interaction is a **no-op** here — it likely targets in-flight `RUNNING`/generating steps, not interaction-pending ones. **Task 10 must verify cancel against a RUNNING step** (e.g. cancel mid-generation, or mid-long-command) to confirm it actually interrupts, and should pair cancel-of-an-interaction with delivering a **deny** (`permission.allow:false` / `askQuestion` skip) to actually unblock a `WAITING` step. Whether `ForceStopCascadeTree` behaves differently was not tested.
---
## 5. Concerns / follow-ups
- **ERROR fixture is synthesized** (the only one) — see §1.1. The `WAITING` timeout window in 1.0.10 is minutes-long, so a real ERROR snapshot wasn't elicitable in the spike window. If Tasks 4/5 want a verbatim ERROR step, capture one opportunistically during the Task 13 live run (let an interaction sit, or hit a real tool error) and replace the fixture.
- **`CancelCascadeSteps` is a no-op on WAITING-for-interaction steps** (§4) — Task 10 must validate the real interrupt against a `RUNNING` step, and unblock `WAITING` steps with a deny rather than a cancel. Don't assume `200 {}` == "interrupted".
- **Connect stream framing** (request envelope, §3.2) is a sharp edge — the Task 2/6 client wrapper must own request+response enveloping and be unit-tested against captured frames; do not hand it to callers. If hardening it slips, ship poll-first (§3.3) — fully correct, only loses sub-second latency.
- **Attended TUI vs RPC interaction** (§2.1): production runner should gate `send-keys` turns on an idle trajectory (no `WAITING`/`RUNNING` step); surface in Task 11/12.
- Step payload key follows `camelCase(type)` (e.g. `RUN_COMMAND`→`runCommand`, `VIEW_FILE`→`viewFile`); the mapper can rely on this convention but should default-skip unknown types rather than assume a payload key exists.
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.