Skip to content

Attribute every harness/worker log line to its subject and session #359

Closed

Description

@pdettori

Problem

No log line in the harness or the P6 worker carries the subject (the user) or the session it was written for. P5 requires per-session attribution per log line: docs/specs/2026-09-06-p5-session-isolation-design.md, in the paragraph on TurnConfig.subject, says that in a process multiplexing S sessions it is "the only route to per-session attribution, per log line, on a hot path". MI1 S1 (#350) makes several users in one worker the normal case, and none of the ~50 console.* sites in packages/knative-server/src and harness/src says whose turn it was. An operator investigating an incident, or answering "what did user X's session do?", has to correlate by timing.

What closing it needs

  • A per-turn logger (or AsyncLocalStorage-scoped context) carrying subject and sessionId, set where resolveTurnAuth resolves the caller. The error, auth-refusal and turn-lifecycle log lines use it.
  • The subject is an identifier, never a credential. Log lines must never include tokens, and a test should plant a token and assert it appears in no output.
  • A test: two concurrent turns for different subjects produce log lines each attributed to the right subject.

Context

docs/specs/2026-09-28-moca-multi-user-isolation-design.md §13 ("Subject on every log line") defers this to the first slice that multiplexes users (S2). It was raised in round 1 of #350's review as a regression against P5's requirement.

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. added
    enhancement
    on Sep 29, 2026
  2. evaline-ju commented on Oct 20, 2026

    @evaline-ju
    Contributor

    Confirmed running in moca version edge-12536a6: tailed kubectl logs on all five server components (supervisor, control plane, context-service, both sandbox pods) through a full dispatch cycle. Zero bytes of new output on four of them; supervisor emits 1 pool-admission line, no sessionId. The subject/sessionId attribution in this issue scopes assumes those console.* sites fire during request handling — on edge-12536a6 they don't appear to.

    Worth broadening the scope here (or opening a sibling) to cover emitting any per-request lines in the first place. The information exists in Redis's sh:cp:audit stream (session_created, credential_issued, session_deleted keyed by sessionId) — mirroring those writes to the component logger at INFO would surface them and attribution work has something to label.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions