Skip to content

OMP driver: record an append-only session-to-seat binding receipt at session_start and expose st2 sessions --json #448

Description

@schickling-assistant

Problem

For OMP-driven seats, st2 is the authority for seat identity and session storage, but nothing st2-owned binds an OMP session (sessionId / session file) to the seat that ran it. A downstream usage exporter that reads OMP session JSONL can derive the seat from catalog topology for managed seats (JSONL lives under the seat workspace), but it cannot resolve session-id → seat without scanning files, and harness-context.v1 is replace-in-place and deleted on relaunch claim, so it cannot serve historical attribution.

Proposal (additive)

  1. In the OMP channel session_start handler (hooks/omp-channel.ts), read ctx.sessionManager.getSessionId(), getSessionFile(), getSessionDir() (already in the read-only session API) and send a typed session frame alongside the initial context frame.
  2. Decode it in src/pi_channel.rs; validate the file is absolute, beneath the supplied session dir / workspace, and that its name/header agrees with sessionId.
  3. Persist an append-only receipt under st2 control state keyed by session id:
{"schema":"st2.session-binding.v1","host":"...","identity":"...","persona":"...",
 "launchKind":"managed|hosted","runtimeId":"...","generationId":"...",
 "sessionId":"...","sessionDir":"...","sessionFile":"...","observedAtMs":0}
  1. Expose st2 sessions --json [--id <sessionId> | --path <file>] reading those receipts. Add the record to the replicated driver-record allowlist / catalog watch ignore rules as needed.

Persona and host come from the declaration/receipt, not from the session title. Direct (non-catalog) launches stay outside this contract by design.

Consumer

The dotfiles omp-usage-exporter (VRS: context/coding-agents/19-token-efficiency/12-omp-usage/02-session-binding/ in schickling/dotfiles) resolves identity via: receipt → title fallback → unattributed.

Posted on behalf of @schickling
field value
agent_identity dev3.direct.omp.6yyfzdb5
session dev3.6yyfzdb5
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.1.2
agent_runtime OMP 18.1.2
tooling_profile dotfiles@7534055

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions