Skip to content

feat(ocsf): add opt-in Traffic events for active sandbox connections #5921

Backlog

Description

@pimlock

User Story

I use OpenShell to monitor egress from long-running agent sandboxes. I need periodic byte counts while connections are active so an external detector can flag unusual traffic before a transfer finishes.

Problem Statement

Connection decisions do not show how much data is moving through an allowed connection. A Close record can account for a completed transfer, but it arrives too late to detect a spike during a long-lived connection.

Impact / Why This Matters

Operators need to see changes in traffic volume on allowed paths. Periodic measurements let a collector or detector track usage over time across sandboxes. OpenShell Research dev note

Proposed Design

Emit periodic OCSF Network Activity Traffic events for active proxied connections that moved bytes during the reporting interval. Include per-direction interval and cumulative counts, plus the connection identifier used by the lifecycle events. Keep periodic reporting off by default and give operators an explicit setting to enable it.

Use the existing OCSF outputs. Bound reporting volume and make dropped or suppressed records visible to operators. Document safe intervals, how consumers reconcile Traffic with Close without double-counting, and which gaps can be recovered from later cumulative totals. Policy enforcement continues when telemetry or a collector is unavailable. External detection and response depend on the events a consumer receives.

Suggested UX

Example setting name for review. Existing OCSF output configuration applies.

openshell settings set my-sandbox --key ocsf_network_traffic_enabled --value true

Acceptance Criteria

  • With the setting off or unset, OpenShell emits no periodic Traffic events. Enabling it produces periodic reports during a sustained transfer, independently of Close emission (feat(ocsf): emit a Close event for proxied sandbox connections #5919).
  • A consumer can join Traffic and Close by connection identifier and interpret bytes in both directions without double-counting. Tests validate the supported OCSF schema.
  • A high-volume workload produces bounded reporting and observable loss or suppression. Telemetry backpressure does not stall proxied traffic.
  • The documentation explains how to enable reporting, its coverage, and what a collector can infer when reports are missing.

Alternatives Considered

  • Close-only reporting gives final totals after a connection ends. It cannot signal a rise during an active transfer.
  • Request middleware can make inline decisions for inspected HTTP traffic. Periodic connection telemetry also covers proxied paths where there is no inspected HTTP request.

Agent Investigation

#5253 is prior art for opt-in OCSF event generation and reporting suppressed events. It covers Process Activity. The OCSF egress spike illustrates connection accounting and the collector workflow.

Checklist

  • I've reviewed existing issues and the published docs
  • This is a design proposal, not a "please build this" request

Activity

  1. added theissue type on Nov 23, 2026
  2. added
    area:runtime
    topic:observability
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:runtimetopic:observability

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions