Commit Graph
265 Commits
Author SHA1 Message Date
Drew Newberry 6c3015a9a1 ci(canary): switch to single-command sandbox create canary
Now that OPENSHELL_GATEWAY_HOST is supported in auto-bootstrap,
remove the explicit `gateway start` step. The canary now tests the
real zero-to-sandbox user path: a single `sandbox create` that
auto-bootstraps the gateway, creates a sandbox, and runs a command.
2026-03-15 00:40:39 -07:00
Drew Newberry 0a7ffe1669 ci(release): gate python wheels on e2e for tagged releases (#319) 2026-03-15 00:39:00 -07:00
John T. Myers b0026fbd0e fix(router): stop dropping client-sent default headers like anthropic-version (#320)
The strip_headers list in send_backend_request included default_headers
names (e.g. anthropic-version), which removed the client's value. The
already_sent check then saw the original input still contained the header
and skipped injecting the route default. Neither value reached upstream.

Remove default_headers names from strip_headers so client values pass
through. The existing already_sent guard still injects defaults only when
the client omits them.
2026-03-14 23:53:36 -07:00
Drew Newberry d34491a3f3 ci(release): use native GitHub release notes and add e2e gate (#318) 2026-03-14 22:44:12 -07:00
Drew Newberry 847bf4438c fix(cli): check port availability before starting SSH forward (#309) 2026-03-14 21:27:17 -07:00
Drew Newberry 8b9192f8f8 fix(ci): trigger release-tag workflow via workflow_dispatch from auto-tag (#315) 2026-03-14 20:12:48 -07:00
Piotr Mlocek 49d8aa42f3 test(e2e): run host alias checks from docker (#314) 2026-03-14 20:09:58 -07:00
Piotr Mlocek bda8b7481e chore(ci): upload Python wheels to release assets (#300) v0.0.4 2026-03-14 18:58:12 -07:00
Drew Newberry c58049cf2e ci: various CI improvements (#312) 2026-03-14 18:31:50 -07:00
Drew NewberryandPiotr Mlocek 83af7a245b feat(sandbox): inject host gateway hostAliases into sandbox pods (#306)
* feat(sandbox): inject host gateway hostAliases into sandbox pods

Sandbox pods running in the k3s cluster cannot resolve host.docker.internal
by default, preventing them from reaching services on the Docker host.

Detect the host gateway IP (default route) in the cluster entrypoint,
thread it through the Helm chart to the gateway server, and inject
hostAliases entries (host.docker.internal, host.openshell.internal)
into every sandbox pod spec. The injection is conditional -- when the
IP is empty (non-Docker deployments), no hostAliases are added.

---------

Co-authored-by: Piotr Mlocek <pmlocek@nvidia.com>
2026-03-14 16:54:03 -07:00
Miyoung Choi ed3c44550e docs: improve the docs more (#308)
* improve docs

* save
2026-03-14 16:34:37 -07:00
Miyoung Choi 9bd111718f remove docs switcher (#310) 2026-03-14 16:26:33 -07:00
John T. Myers 97bad8b7d0 chore: derive build version from git tags for all components (#305)
Compute version strings from git describe in openshell-core's build.rs
using the guess-next-dev scheme (e.g. 0.0.4-dev.6+g2bf9969). All binary
crates and the TUI splash screen now use the shared openshell_core::VERSION
constant instead of CARGO_PKG_VERSION.

In Docker/CI builds where .git is absent, falls back to CARGO_PKG_VERSION
which is already set correctly by the sed-patch pipeline. Also adds
OPENSHELL_CARGO_VERSION support to the cluster image and fast-deploy
supervisor builds for parity with the gateway.
2026-03-14 14:58:33 -07:00
Drew Newberry 2e0550a596 ci(release): add auto-tag workflow for patch version bumping (#307) 2026-03-14 14:44:33 -07:00
Piotr Mlocek 05eade959c feat(cli): add no-verify inference flag (#302) 2026-03-14 14:02:36 -07:00
Drew Newberry 4b23a7e242 feat(bootstrap): restore per-gateway Docker bridge networks (#303)
PR #281 removed the shared openshell-cluster Docker network in favor of
the default bridge. This restores custom bridge networking but makes each
gateway use its own isolated network named openshell-cluster-{name},
matching the existing container/volume naming convention.

Changes:
- Add network_name() to constants.rs for per-gateway network naming
- Add ensure_network() with retry/backoff and force_remove_network()
  parameterized by network name instead of a global constant
- Attach containers to their per-gateway network via network_mode
- Disconnect and remove the network during gateway destroy
- Wire ensure_network() into the deploy flow before ensure_volume()
- Update architecture docs to reflect per-gateway network isolation
2026-03-14 13:36:06 -07:00
Miyoung Choi 7746c77c35 chore: add docs contributing guides and skills (#301)
* add docs contributing guides and skills

* add section
2026-03-14 10:28:59 -07:00
Miyoung ChoiandKirit93 c420109a6a docs: add dedicated gateway docs, network policy tutorial, and license page (#294)
* Added gateway and tutorial

* add new content and polish, add license terms

* small fix

* tiny fix

* polish bit more

* change warning to important

* fix support matrix

* small fix

* add a note about example script

* fix link

* fix link

* improve

* fix links

* unclutter sandbax index more

* improve titles

* tiny style fix

* style guide on inferences, release notes link to gh

* polish

* nit

* switch version to 0.0.3

* incorporate feedback

---------

Co-authored-by: Kirit93 <kthadaka@nvidia.com>
2026-03-14 09:53:01 -07:00
Piotr Mlocek 26e540d8d6 fix(cli): show startup feedback for foreground forwards (#296) 2026-03-13 21:51:08 -07:00
Drew Newberry 1a35265d8e fix(canary): use curl instead of gh CLI for release download (#299) 2026-03-13 21:47:36 -07:00
John T. Myers 6ddb6aef83 chore: establish agent-first development ethos across project (#293)
* docs: enhance AGENTS.md as primary agent entrypoint

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: add opencode agent definitions for sub-agent workflows

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* docs: overhaul CONTRIBUTING.md for agent-first workflow

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* docs: reframe README.md with agent-first identity

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: add bug report and feature request issue templates

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: add issue template config with agent-first contact links

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: add pull request template

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: add CODEOWNERS

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: update .claude/ README to document skill symlink and consolidation

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* chore: remove github-rest-api skill

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* feat: add triage-issue skill for community issue assessment

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* refactor: update create-github-issue skill for template conformance

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* refactor: update create-github-pr skill for template conformance

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* refactor: update build-from-issue skill for template conformance and triage awareness

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* ci: add issue triage gate workflow

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

* feat: add sync-agent-infra skill to detect and fix infrastructure drift

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>

---------

Signed-off-by: John Myers <9696606+johntmyers@users.noreply.github.com>
2026-03-13 21:13:24 -07:00
Drew Newberry 3bcbd93401 ci(release): add canary triggered after release workflow (#298) 2026-03-13 20:22:38 -07:00
Drew Newberry 1ba798f0fb ci(release): pin OPENSHELL_IMAGE_TAG to version for tagged releases (#297) v0.0.3 2026-03-13 19:28:35 -07:00
Drew Newberry 19c3230267 feat(ci): add automated release workflow with patch version bumping (#284) v0.0.1 2026-03-13 17:44:22 -07:00
Drew Newberry 2858bd662f fix(cli): use line-based stdin read for gateway recreate prompt (#292) 2026-03-13 15:51:09 -07:00
Piotr Mlocek 50ea7495c1 fix(sandbox): bypass proxy for localhost traffic (#290) 2026-03-13 15:30:08 -07:00
Drew Newberry 20c32716ad fix(bootstrap): detect missing sandbox supervisor binary during gateway health check (#281) 2026-03-13 15:07:50 -07:00
Miyoung Choi 468b02e74b docs: set the version to match the release version, add Adobe Launch tracking script, minor edits (#287)
* set version and minor edits

* adobe launch tracking script
2026-03-13 12:05:46 -07:00
Drew Newberry 6b9ac05bab fix(install): use gh CLI for release downloads instead of HTTP (#285) 2026-03-13 11:58:34 -07:00
Piotr Mlocek 72e0268028 feat(sandbox): add gpu sandbox scheduling support (#257)
* feat(sandbox): add gpu sandbox scheduling support

Allow sandbox creation to request GPU resources explicitly or infer them from GPU image names. This wires GPU intent through bootstrap, validates gateway support, and adds dedicated GPU E2E coverage for follow-up cluster testing.
2026-03-13 11:32:43 -07:00
Alexander Watson 158c925342 docs(examples): add sandbox policy quickstart walkthrough (#266)
* docs(examples): add sandbox policy quickstart walkthrough

Add an interactive getting-started example that demonstrates OpenShell's
network policy system end-to-end: default-deny, L7 read-only access,
and audit logging — all with a single YAML policy file.

- examples/sandbox-policy-quickstart/policy.yaml: policy with default
  static fields (filesystem, landlock, process) so it works out of the
  box with `openshell policy set`
- examples/sandbox-policy-quickstart/demo.sh: automated demo script
  using printf (portable) and openshell ssh-proxy for sandbox exec
- examples/sandbox-policy-quickstart/README.md: step-by-step manual
  walkthrough
- README.md: add "See network policy in action" section linking to the
  quickstart

Signed-off-by: Alexander Watson <zredlined@gmail.com>
Made-with: Cursor
Signed-off-by: Alexander Watson <zredlined@gmail.com>
Made-with: Cursor

* docs: soften default-deny wording to minimal outbound access

Sandbox defaults vary by type and community configs, so
"all outbound traffic is blocked" is too absolute.

Made-with: Cursor

* docs: use curl -sS so L4 deny errors are visible

curl -s suppresses stderr, hiding the 403 from the CONNECT
proxy. Adding -S ensures the error message is always shown.

Made-with: Cursor

---------

Signed-off-by: Alexander Watson <zredlined@gmail.com>
2026-03-13 11:32:32 -07:00
Kirit Thadaka 35037465c7 docs: Add brev link to readme (#282)
* Updated readme with brev link

* Updated readme with brev link

* Updated readme with brev link
2026-03-13 10:04:38 -07:00
John T. Myers 764fac79aa feat(tui): add log copy and visual selection mode (#276)
* feat(tui): add log copy and visual selection mode

Add clipboard support for the TUI log viewer using OSC 52 escape
sequences. Users can copy individual log lines (y), the visible
viewport (Y), or enter visual selection mode (v) to select a range
of lines with j/k and yank with y.

- Add clipboard module with OSC 52 base64 encoding
- Add format_log_line_plain() for plain-text log rendering
- Add visual selection mode with highlight styling and status bar
- Context-switch nav bar hints between normal and visual modes
- Add 7 unit tests for plain-text log formatting

Closes #274

* fix(tui): write OSC 52 to /dev/tty instead of stdout

ratatui owns stdout via the alternate screen buffer, so OSC 52
escape sequences written to stdout are swallowed by the backend.
Write directly to /dev/tty to bypass the buffer and reach the
terminal emulator.
2026-03-13 09:34:54 -07:00
Drew Newberry 06a62ddfaf ci: speed up E2E pipeline by running on arm64 runners and skipping redundant cluster rebuild (#278) 2026-03-13 02:06:47 -07:00
Drew Newberry fbd93a4632 refactor: rename navigator- crate prefix to openshell- (#277) 2026-03-13 02:02:18 -07:00
Drew Newberry 7b0a243304 ci: remove sandbox docker build from publish and e2e workflows (#275) 2026-03-13 00:56:07 -07:00
Miyoung Choi 7430c75438 remove manully generated cli reference (#272) 2026-03-12 22:08:17 -07:00
Drew Newberry 89d21d7852 refactor(sandbox): sandboxes are managed as separate community images (#267) 2026-03-12 22:06:52 -07:00
Piotr Mlocek b241237bde fix(sandbox): opt Node clients into proxy env support (#269) 2026-03-12 17:43:07 -07:00
Piotr Mlocek 14e296d318 fix(cli): add --no-keep for ephemeral sandbox create cleanup (#258) 2026-03-12 17:18:39 -07:00
Drew Newberry 6a40f2bed8 feat(gateway): support adding remote and local gateways (#262) 2026-03-12 16:19:47 -07:00
John T. Myers fcf12dff62 feat(tui): support light terminal backgrounds with adaptive theme (#265)
* feat(tui): support light terminal backgrounds with adaptive theme

Replace the hardcoded dark-only color constants in theme.rs with a
runtime Theme struct that has dark() and light() factory constructors.
The active theme is stored on App and threaded through all draw
functions, enabling the TUI to render correctly on both dark and light
terminal backgrounds.

- Add Theme struct with 16 semantic style fields and ThemeMode enum
- Detect terminal background via COLORFGBG env var at startup
- Add --theme dark|light|auto CLI flag and OPENSHELL_THEME env var
- Migrate all 499 styles:: references across 11 UI files to app.theme
- Clean up 9 inline Style constructions that bypassed the theme system
- Add unit tests verifying dark/light palettes and legacy regression

Closes #264

* fix(tui): use OSC 11 query for reliable light/dark terminal detection

Replace COLORFGBG env var heuristic with terminal-colorsaurus crate,
which sends an OSC 11 query to read the actual background color. This
fixes auto-detection in iTerm2 and other terminals that don't set
COLORFGBG.
2026-03-12 13:15:57 -07:00
John T. Myers 2e4c2fcc84 fix(proxy): stream inference responses instead of buffering entire body (#261)
* fix(proxy): stream inference responses instead of buffering entire body

The inference.local proxy path called response.bytes().await which
buffered the entire upstream response before sending anything to the
client. For streaming SSE responses this inflated TTFB from sub-second
to the full generation time, causing clients with TTFB timeouts to abort.

Add a streaming proxy variant that returns response headers immediately
and forwards body chunks incrementally using HTTP chunked transfer
encoding. Non-streaming responses and mock routes continue to work
through the existing buffered path.

Closes #260

* docs: update architecture docs and example for inference streaming

* test(example): add direct NVIDIA endpoint tests via L7 TLS intercept

Expand inference example to 4 test cases: inference.local and direct
endpoint, each streaming and non-streaming. The direct path exercises
the L7 REST relay (relay_chunked) to verify it already streams
correctly. NVIDIA_API_KEY is picked up from the sandbox env when
started with --provider nvidia.
2026-03-12 10:36:41 -07:00
Drew Newberry b9d10861b6 refactor(sandbox): move secrets to supervisor placeholders (#192) 2026-03-12 10:30:46 -07:00
Miyoung Choi a453aa7a4e docs: improve tutorial and edit per nv style guide (#240)
* edit tutorial per nv style guide

* few more edits

* iron out a bit more

* rephrase prereqs

* iron out policy update section

* improve update policy section

* nit

* rebase and improve

* merge the new policy update steps finalized with Kirit

* Kirit's change requests
2026-03-12 08:49:00 -07:00
John T. Myers 454327d890 feat(policy): add policy recommendation plumbing (#204) (#222)
* feat(policy): add policy recommendation plumbing — denial aggregation, transport, approval pipeline, and mechanistic recommendations

Implement the infrastructure layer for automated policy recommendations (#204):

- Proto: 9 new RPCs and messages for draft policy lifecycle (submit, get, approve, reject, approve-all, edit, undo, clear, history)
- Persistence: SQLite/Postgres migrations and store methods for draft_policy_chunks and denial_summaries tables
- Server: Full gRPC handler implementations with mechanistic mapper that auto-generates NetworkPolicyRule proposals from denial summaries
- Sandbox: DenialAggregator with MPSC channel, deduplication, periodic flush to gateway via SubmitPolicyAnalysis
- CLI: 'openshell draft' subcommand with get/approve/reject/approve-all/undo/clear/history operations
- TUI: Draft recommendations panel accessible from sandbox policy view
- Docs: Architecture documentation in architecture/policy-advisor.md

* feat(policy): add L7-aware mechanistic mapper and policy advisor CTF example

Add L7 rule generation to mechanistic mapper (build_l7_rules,
generalise_path, looks_like_id) with 3 new unit tests. Add
examples/policy-advisor/ with a 7-gate CTF script, restrictive
sandbox policy, and walkthrough README.

* fix(policy): use sandbox name for denial flush and add TUI draft badges

Fix denial aggregator passing sandbox UUID instead of name to
SubmitPolicyAnalysis, which caused 'sandbox not found' errors on
flush. Add notification badges to the TUI sandbox list and detail
header showing pending draft recommendation counts.

* fix(policy): deduplicate draft chunks and tolerate overlapping OPA rules

Skip draft chunk creation when a pending/approved chunk already covers
the same host:port endpoint, preventing duplicate rules across denial
aggregator flush cycles.

Rewrite three OPA complete rules (network_policy_for_request,
matched_network_policy, matched_endpoint_config) to tolerate multiple
matching policies without triggering a "complete rule conflict" error.
network_policy_for_request becomes a boolean, matched_network_policy
uses a set comprehension with min(), and matched_endpoint_config uses
an array comprehension with index-0 selection.

* feat(tui): interactive draft actions, highlight bar, and detail popup

Rework the draft recommendations panel to match the logs UX:
- Highlight bar (green accent + background) instead of arrow marker
- Viewport-aware j/k scrolling with g/G for top/bottom
- Enter opens a full-screen detail popup showing endpoints, binaries,
  rationale, security notes, and action hints

Add approve/reject/approve-all draft actions:
- [a] approve selected chunk, [x] reject, [A] approve all pending
- Actions work from both the list view and the detail popup
- gRPC calls run async; result updates status bar and refreshes data
- Nav bar shows all available keybindings

Fix draft count refresh: sandbox_draft_counts now refreshes on every
tick (not just Dashboard), so the detail header badge updates in
real time.

Improve badge labels: show 'N pending' instead of a bare number in
both the dashboard sandbox list and sandbox detail header.

* refactor(policy): DB-level draft chunk dedup with hit counter and timestamps

Replace the in-memory HashSet dedup in SubmitPolicyAnalysis with a
database-level upsert. New denormalized columns on draft_policy_chunks:
- host, port: extracted from proposed_rule at insert time
- hit_count: incremented on conflict (same sandbox + host + port)
- first_seen_ms, last_seen_ms: track when the endpoint was first and
  most recently proposed

A partial unique index (WHERE status IN ('pending','approved')) ensures
only one active chunk per endpoint per sandbox; rejected/superseded
chunks don't block new proposals.

Surface hit_count and first/last_seen in:
- CLI: 'openshell draft get' shows 'Hits: N (first ..., last ...)'
- TUI: detail popup shows hits row; list view shows 'Nx' suffix

* fix(policy): optimistic retry on policy version conflicts + structured logging

merge_chunk_into_policy and remove_chunk_from_policy now retry up to 5
times on UNIQUE constraint violations (version conflicts from concurrent
approvals). Each attempt re-reads the latest policy, re-merges the rule,
and increments the version. This eliminates the race condition where
rapid successive approvals would fail with a DB error.

Add structured tracing to all draft action handlers:
- ApproveDraftChunk: logs rule_name, host, port, hit_count before merge
  and version + policy_hash after success
- RejectDraftChunk: logs rule_name, host, port, reason
- ApproveAllDraftChunks: logs pending_count at start, per-chunk merge
  progress, and final summary with chunks_approved/skipped
- UndoDraftChunk: logs before/after with rule_name and version
- Retry attempts log as warnings with attempt number and conflicting
  version

* wip: forward proxy fix, mapper allowed_ips, TUI polish, CTF rewrite

* fix(tui): use correct --gateway flag for ssh-proxy ProxyCommand

* chore: add Docker cleanup script for stale images, volumes, and build cache

* feat(tui): approve-all confirmation modal and CTF cleanup

Add [A] confirmation popup that snapshots pending chunks, shows a
scrollable list, and approves each chunk individually on confirm.
This prevents approving chunks that arrived after the modal opened.

Remove transient issue #205 reference from CTF victory banner.

* fix(tui): correct import ordering for rustfmt

* wip: stateful toggle model, rename to network rules

Draft chunks now follow a toggle state machine:
  pending -> approved | rejected (initial decision)
  approved <-> rejected (toggle)

One row per (sandbox_id, host, port) via expanded unique index.
Rejecting an approved rule removes it from the active policy.
Re-approving a rejected rule merges it back.

Rename CLI from 'draft' to 'rule', TUI from 'Draft Recommendations'
to 'Network Rules'. State-aware keybindings: approved shows [x] Revoke,
rejected shows [a] Approve. Fix sandbox detail hiding delete confirmation
behind pending message.

* refactor(policy): move mapper sandbox-side, slim schema, per-binary granularity

Move mechanistic mapper from gateway to sandbox so all analysis runs
sandbox-side (N sandboxes = N independent pipelines). Gateway is now a
thin validate + persist + approval layer.

Architectural changes:
- Move mechanistic_mapper.rs from navigator-server to navigator-sandbox
- Sandbox flush flow: aggregator drains -> mapper runs -> proposals sent
- Gateway SubmitPolicyAnalysis: validate + persist only, no mapper
- Drop denial_summaries table (write-only, zero readers)
- Consolidate migrations 003+004+005 into single 003

Schema slimming:
- Drop 5 unused columns from draft_policy_chunks (stage, denial_refs,
  supersedes_chunk_id, analysis_mode, decided_by)
- Add per-binary granularity: binary column, widen unique index to
  (sandbox_id, host, port, binary)
- Mapper groups by (host, port, binary), one proposal per triple
- Merge appends binary to existing rule; revoke removes just that binary

CTF & UX:
- 7-gate CTF: add Gate 3 (curl -> ifconfig.me:80) for per-binary demo
- TUI shows binary short name in list, full path in detail popup
- CLI output shows binary field
- Idempotent rule names, hit_count accumulates real denial counts
- Rationale text no longer bakes in stale denial count
2026-03-12 08:28:26 -07:00
Piotr Mlocek 0ad0614651 docs(inference): update the output for inference get (#231) 2026-03-12 00:32:52 -07:00
Drew Newberry 1535f806af feat(sandbox): add configurable imagePullPolicy for sandbox pods (#256)
Add OPENSHELL_SANDBOX_IMAGE_PULL_POLICY env/CLI flag that propagates
through Config -> SandboxClient -> pod spec generation. When set, the
policy is applied to both inline and pod-template sandbox containers.

Helm chart exposes server.sandboxImagePullPolicy (default empty = K8s
default behavior). cluster-deploy-fast sets it to Always so dev
clusters always pull fresh sandbox images.
2026-03-12 00:00:53 -07:00
Drew Newberry 59335ec852 fix(cluster): run helm/kubectl inside container via docker exec (#255)
cluster-deploy-fast.sh ran helm and kubectl directly on the host,
which requires a local kubeconfig pointing at the k3s API server.
Since the cluster container does not expose port 6443, these commands
always fail with 'connection refused'.

Install helm in the cluster container image and run all helm/kubectl
commands via docker exec with KUBECONFIG pre-configured. The local
chart directory is copied into the container before helm upgrade.
2026-03-11 23:00:48 -07:00
Drew Newberry db63d9fd30 fix(cluster): add missing k9s build stage to Dockerfile.cluster (#254)
The k9s COPY instruction was added without a corresponding build stage,
causing Docker to look for a nonexistent docker.io/library/k9s image.
Add a multi-arch stage that downloads the k9s binary from GitHub releases.
2026-03-11 22:06:31 -07:00