Repository navigation
Description
User Story
I use OpenShell in single-host and distributed deployments. I need single-host users to keep the convenience of openshell logs, including live tailing, without continuously pushing supervisor logs to the gateway. For larger distributed deployments, I need logs to integrate with the enterprise log collectors already operating on the nodes so logging volume does not become a control-plane scaling cost.
Problem Statement
The current built-in logging UX depends on supervisors continuously pushing logs to the gateway, which buffers them for CLI, TUI, and API/watch consumers. Log production therefore drives gateway traffic and storage even when no user is reading the logs and an external collector already collects them.
We need a logging architecture that preserves convenient single-host access while allowing distributed deployments to collect and ship logs through standard enterprise infrastructure without continuous supervisor-to-gateway log forwarding.
This follows #5418, which proposed a disable switch and was closed in favor of reconsidering how the gateway fetches logs. It should address the underlying retrieval and collection workflow rather than stop at disabling the current stream.
Impact / Why This Matters
Continuous forwarding adds serialization, network traffic, buffering, and gateway processing costs proportional to fleet activity. External collection does not currently remove those costs. Gateway-local buffers also complicate log access across replicas.
Operators should be able to scale the control plane independently of diagnostic log volume. Single-host users should retain built-in troubleshooting without installing a separate observability stack. Distributed operators should be able to use their existing collection, retention, and query infrastructure without paying for a duplicate gateway ingestion path.
Related scaling reports include #5400 (per-sandbox log-tail memory) and #5462 (partial histories and buffer fan-out across gateway replicas). Those fixes are complementary to this architecture proposal.
Proposed Design
Single-host logging workflow
Preserve the existing openshell logs experience for non-distributed deployments and single-host drivers, including recent-log access, live tailing, and applicable source/level/time filters. Users should not need to discover container names, log paths, or configure an external collector for routine troubleshooting.
Make that experience available without continuously pushing logs into the gateway. Log production alone should not create a standing stream of log records into the control plane. Retrieval may perform work when a user requests logs; the proposal leaves the retrieval mechanism and any gateway mediation to design review.
Account for other consumers of the existing log path, including TUI views and API/watch streams. Define their supported behavior and migration explicitly, including which supervisor, gateway, runtime, and platform-event sources each view includes.
Distributed logging workflow
Integrate supervisor and workload log output with common enterprise collection routines, such as Kubernetes DaemonSet/node-level collectors and equivalent host/container-runtime collectors. Operators should be able to collect, attribute, and ship logs to their chosen backend without continuously routing those records through the OpenShell gateway.
Reuse standard platform log interfaces and existing collectors where they satisfy the workflow. Do not require a new OpenShell-specific aggregation service or a collector sidecar per sandbox as the default approach. Preserve trustworthy sandbox/workspace attribution across dedicated and shared supervisors so operators can find a sandbox's records in their backend.
Define what openshell logs, the TUI, and API/watch consumers offer in a distributed deployment using external collection. Any unavailable sources or partial coverage must be explicit, with actionable guidance to the configured collection workflow. Transparent querying of arbitrary external log backends is not a prerequisite for this proposal.
Documentation sub-story
Audit existing observability documentation before adding new material. Document the supported collection sources, required configuration, identity fields, and how to collect and ship supervisor logs, structured OCSF records, and workload/runtime logs. Include a validated Kubernetes node-level/DaemonSet collector example using a common collector and explain equivalent collection for supported single-host drivers.
Describe rotation, teardown, restart, buffering, loss, and retention limits. Local files and container output are collection sources, not automatically durable archives. Keep the single-host quick-start workflow simple and link distributed operators to collection guidance.
Suggested UX
Existing single-host command spelling remains usable, for example:
openshell logs demo
openshell logs demo --tail
openshell logs demo --source sandboxThese commands provide recent/live logs without requiring background supervisor log pushes to the gateway. A distributed operator instead configures their existing node-level collector to collect OpenShell supervisor and workload output and queries the destination by sandbox identity. Exact distributed configuration and CLI guidance should be settled during design.
Acceptance Criteria
- Single-host deployments retain recent-log access and live tailing through the existing CLI UX without continuous supervisor-to-gateway log pushes or an external collector requirement.
- A distributed deployment can collect and ship supervisor, OCSF, and workload/runtime logs through a standard node-level collection pipeline while avoiding continuous gateway log ingestion.
- Dedicated and shared supervisor collection preserves trustworthy sandbox/workspace attribution and identifies the source of each record.
- CLI, TUI, and API/watch behavior is defined for both deployment models, including filters, available sources, partial coverage, and migration from current behavior.
- Log collection/retrieval remains separate from sandbox execution and control operations; slow or unavailable consumers do not stall lifecycle operations or policy enforcement.
- Representative fleet/load validation compares current and proposed gateway-bound log traffic, gateway resource use, and control-plane performance, including idle readers and active tailing. Report measured results without assuming a particular improvement.
- Existing docs are audited and updated only where needed, with a validated node-level collector collection-and-shipping example, driver-specific guidance, and explicit delivery/retention limits.
Alternatives Considered
- Only add a disable switch (feat(observability): allow disabling supervisor log pushes to the gateway #5418). Removes forwarding costs for external-collection users but does not preserve built-in single-host log access without pushes or define the broader UX.
- Optimize gateway buffers and route everything to the owner (bug(gateway): per-sandbox log tail holds up to ~3.7 MiB #5400, bug: sandbox logs and watch streams ignore gateway ownership in multi-replica mode #5462). Addresses immediate memory/correctness problems while retaining continuous log transport through the control plane.
- Require external collection for every deployment. Fits distributed operations but adds setup to single-host troubleshooting and loses the existing convenience.
- Require a collector sidecar per sandbox. May remain useful for specialized collection, but node-level collectors already deployed in enterprises should be a supported primary workflow.
- Filter logs in gateway interceptors or downstream exporters. Filtering after arrival retains transport and ingestion costs. Network middleware and credential providers do not own the log retrieval/collection workflow.
Existing Documentation and Related Work
- Accessing Logs: the repository source already describes gateway buffering, platform log access, separate supervisor/workload collection, and retention limits. Verify and extend that guidance rather than duplicate it.
- feat(observability): allow disabling supervisor log pushes to the gateway #5418 — disable supervisor log pushes; closed with the direction to rework log fetching.
- feat(observability): investigate portable sandbox log collection #1922 — earlier portable log collection investigation (closed); useful background, but its file/sidecar assumptions need review against the current architecture.
- bug(gateway): per-sandbox log tail holds up to ~3.7 MiB #5400 and bug: sandbox logs and watch streams ignore gateway ownership in multi-replica mode #5462 — gateway log memory and multi-replica correctness.
- Enterprise Observability #1055 — Enterprise Observability umbrella.
Checklist
- I've reviewed existing issues and the repository's published-docs source.
- This is a design proposal, not an implementation request.
Activity
TaylorMutch commentedon Nov 24, 2026
Recommended direction
Keep the gateway as the authorization and discovery boundary. Replace continuous supervisor log ingestion with on-demand retrieval owned by the compute driver for built-in log access. In distributed deployments, collect supervisor and workload output through the existing node-level logging pipeline independently of OpenShell log readers.
An active
openshell logs --tailmay still relay requested records through the gateway. The target is no continuous supervisor log transport or retry loop and no gateway-maintained per-sandbox log history/replay buffers, including gateway-originated sandbox logs. Only bounded transport buffers for active readers are permitted. Status and platform-event replay remain an explicit separate concern. This is a starting recommendation; the first milestone validates the retrieval source and stream semantics before fixing the contract.Planning baseline:
mainat527b91f78. No assignee, plan comment, or matching open PR was present on #5948 when inspected. Implementation of an exploratory Docker slice was subsequently authorized; its findings are recorded below.Current code findings
crates/openshell-supervisor-process/src/log_push.rsconverts tracing events to structuredSandboxLogLinerecords, places them in a 1,024-line queue, and continuously batches/reconnects throughPushSandboxLogs. Dedicated setup is inopenshell-supervisor/src/main.rs; shared instances create their own sink and push task insandbox_instance_host.rs.openshell-server/src/grpc/policy.rs::handle_get_sandbox_logsauthorizes workspace/sandbox access and readsTracingLogBus.grpc/sandbox.rsimplements the watch path. Gateway-originated sandbox logs and platform events must still be accounted for after removing supervisor ingestion.sandbox_logsusesGetSandboxLogsfor history andWatchSandboxfor tailing. The TUI also uses both, andopenshell sandbox createfollows logs. SDK watch consumers and testkit log polling are additional compatibility surfaces.proto/compute_driver.protohas no log-read service. Its optional extension-service pattern provides a precedent for adding capability-negotiated retrieval without requiring every external driver to implement it.supervisor.err.log. These are starting points, not proof of filter/replay equivalence.docs/observability/accessing-logs.mdxalready covers platform log access, separate supervisor/workload sources, and retention limits. Human shorthand drops structured fields present inSandboxLogLine, so parsing existing text alone cannot be assumed to preserve the current API.Milestone 1: settle the source and retrieval contract
Produce a source/behavior matrix for Docker, Podman, VM, and Kubernetes dedicated/shared supervisors, covering history, follow, filtering, identity, restart/stop/delete, and rotation. Keep Windows MXC as an explicit coordination item for its maintained branch.
Prototype Docker history plus follow with gateway pushes absent. Compare two approaches:
The prototype must establish a bounded history-to-live handoff, cancellation, limits, and field fidelity. Do not add a new permanent gateway cache or a polling loop per sandbox to approximate demand-driven access.
Decisions required before implementation:
WatchSandboxstatus/event/log replay? Evaluate a versioned composite cursor versus an additive log-stream API and compatibility adapter. Do not change existing cursor meaning in place.Milestone 2: smallest complete implementation slice
Start with Docker dedicated supervisors and the existing CLI commands:
Add a capability-negotiated internal driver extension for bounded history/follow, using the optional service pattern. Requests use trusted internal sandbox/runtime identity, not arbitrary caller-supplied container IDs or file paths. Keep public workspace authorization at the gateway. Follow
proto/README.mdfor additive public evolution if required by milestone 1.Route CLI, TUI, create-time diagnostics, and supported API/watch log access through a common retrieval path. Preserve source, level, time, line-limit, and ordering behavior deliberately. Merge gateway-originated records only with explicitly defined coverage and cursor semantics. Release resources when the last reader leaves; share readers where practical without creating fleet-wide background streams.
Once the replacement path works, disable the legacy push task and its queue for this supported configuration as part of the same coherent slice. Keep older/external drivers on an explicit compatibility path until they support retrieval. Do not silently remove log access from unsupported drivers or claim that a partial rollout completes #5948.
Milestone 3: remaining local drivers and distributed collection
Milestone 4: compatibility, documentation, and removal
Finish the SDK/watch migration and older-driver/version behavior before removing the legacy push protocol. Preserve status and platform-event observation independently of log availability. Remove gateway-maintained per-sandbox log history for gateway-originated records as well as supervisor records. Provide a separate on-demand source for gateway history before claiming full UX compatibility; do not retain a gateway cache to fill that gap.
Update the existing accessing-logs and OCSF pages with supported source/collection behavior and a validated collector recipe. Cover permissions, sandbox/workspace queries, shared-supervisor attribution, collector failure, rotation, teardown, and retention. Update gateway configuration documentation with any TOML/Helm changes, plus relevant crate READMEs. Review
skills/openshell-cli,skills/debug-openshell-cluster, and contributor Helm/TUI skills using the sync-agent-infra maintenance map.Verification and performance gates
PushSandboxLogsstreams; active-reader cost should depend on requested streams rather than total fleet log production.How to begin
Start with milestone 1 and a Docker-only experimental slice that proves recent logs and live tailing with pushes absent. Use those results to finalize the source/cursor contract before expanding across drivers. Split implementation milestones into closable child issues before opening their PRs; retain #5948 as the umbrella until its local UX and distributed collection requirements are met.
Initial prototype findings
Local branch:
feat/5948-on-demand-log-prototype/TaylorMutch.[openshell.drivers.docker] experimental_log_retrieval = true. The built-in Docker factory registers an in-process reader; this is not yet a stable external-driver protocol.Next design work: restore gateway-source history through an on-demand source; settle cursor/history-to-live semantics and native runtime tail limits; define a stable driver extension; expand to other drivers and enterprise node collectors. The prototype does not complete #5948.