You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(cli): --no-keep discards the sandbox audit logs; OCSF lines also flush 1-2 s after exit #4295
Observed. After a sandbox created with --no-keep exits, openshell logs <name> answers "sandbox not found" and the sandbox's OCSF lines are gone. Separately, OCSF lines arrive 1–2 s after the sandboxed process exits, so a logs call issued immediately after exit misses the tail even on a kept sandbox.
Why it matters.--no-keep is the natural setting for an ephemeral agent run, and the audit log is the one artefact a security review needs from that run. As shipped, the convenient flag and the audit trail are mutually exclusive, and nothing warns about it.
Repro.
openshell sandbox create --no-keep --name t1 -- sh -c 'echo hello'
openshell logs t1 # sandbox not found
Ask.
Retain logs for a configurable period after a --no-keep sandbox is deleted, or at minimum print a warning on --no-keep that logs will not be retrievable.
A logs --wait (or documented flush latency) so a caller can collect the complete stream before teardown.
Related: #4297 asks for the retention and on-disk location of sandbox/OCSF logs to be documented.
This issue has had no activity for 14 days and is now marked stale. It may be closed in 14 days if there is no further activity. Comment or remove the state:stale label to keep it open.
Thanks for the report. We're treating this as a feature request rather than a bug, with the scope reframed as follows.
Retaining logs after a sandbox exits.--no-keep deleting the sandbox and its gateway-side log buffer is expected today, but we think the gateway should retain, or at least be able to retain, a sandbox's logs for some period after it exits. The gateway already holds the human-readable OCSF shorthand for the sandbox in memory, so serving it for a while after the sandbox is gone is a natural extension of what openshell logs already does. How long to retain is not clear yet (a fixed default, a configurable period, size caps) and needs a design decision.
Why not just a collector. Configuring [openshell.gateway.otlp.ocsf] is the supported way to keep a durable audit trail, and the supervisor flushes the exporter on exit. But a collector receives the OCSF JSONL, not the shorthand, so it does not give the readable view this issue asks for.
The 1-2 s tail. Retention depends on this. The OTLP exporter flushes on shutdown, so the late lines are most likely on the gateway log-stream path that openshell logs reads. If the tail is lost there, retained logs will be incomplete, so the flush-on-exit behavior needs to be investigated and fixed as part of this work. Until then, a logs call right after exit can miss the last lines.
Smaller pieces that can land independently:
A notice on --no-keep (or documentation) that logs are not retrievable after the sandbox is deleted.
Activity
github-actions commentedon Oct 22, 2026
This issue has had no activity for 14 days and is now marked stale. It may be closed in 14 days if there is no further activity. Comment or remove the state:stale label to keep it open.
krishicks commentedon Oct 23, 2026
Thanks for the report. We're treating this as a feature request rather than a bug, with the scope reframed as follows.
Retaining logs after a sandbox exits.
--no-keepdeleting the sandbox and its gateway-side log buffer is expected today, but we think the gateway should retain, or at least be able to retain, a sandbox's logs for some period after it exits. The gateway already holds the human-readable OCSF shorthand for the sandbox in memory, so serving it for a while after the sandbox is gone is a natural extension of whatopenshell logsalready does. How long to retain is not clear yet (a fixed default, a configurable period, size caps) and needs a design decision.Why not just a collector. Configuring
[openshell.gateway.otlp.ocsf]is the supported way to keep a durable audit trail, and the supervisor flushes the exporter on exit. But a collector receives the OCSF JSONL, not the shorthand, so it does not give the readable view this issue asks for.The 1-2 s tail. Retention depends on this. The OTLP exporter flushes on shutdown, so the late lines are most likely on the gateway log-stream path that
openshell logsreads. If the tail is lost there, retained logs will be incomplete, so the flush-on-exit behavior needs to be investigated and fixed as part of this work. Until then, alogscall right after exit can miss the last lines.Smaller pieces that can land independently:
--no-keep(or documentation) that logs are not retrievable after the sandbox is deleted.Open question: what retention period and limits make sense for retained logs?