Skip to content

Reduce direct-mode recording_session_id repetition with an explicit non-sticky recorder context #574

Closed

Description

@yyjeqhc

Context

Verified against current main at 061bd531.

Code Mode already handles recorder provenance well: nested calls cannot author project, session_id, or recording_session_id; the adapter injects the exact outer context and re-enters canonical ToolRuntime checks.

Direct model-facing calls still commonly repeat:

recording_session_id = wc_sess_...

across many independent tool calls.

The repository correctly rejects an implicit sticky recorder keyed by ClientWindow/transport/recent activity. This issue should preserve that statelessness.

Goal

Provide an explicit request-scoped/direct-mode recorder context carrier that reduces mechanical repetition without creating ambient Session state.

Possible approaches:

  • a short recorder selector returned by work_on_project;
  • a bounded explicit outer wrapper/context field accepted by Host orchestration;
  • another server-issued selector that resolves only recorder provenance.

The implementation should choose the smallest coherent contract.

Required invariants

  • Recorder context remains provenance only; it is never business Session authority.
  • No implicit sticky recorder keyed by Window, MCP session, credential, Project, recent call, or transport connection.
  • Business session_id targeting remains a separate concept.
  • Every ordinary tool still runs its canonical authorization, schema, permission, and effect checks.
  • Context loss must not silently attach later calls to an old recorder.
  • A stale/foreign recorder selector fails closed.
  • Code Mode's existing server-owned nested context behavior remains unchanged.

Acceptance criteria

  • After explicit bootstrap, a normal direct workflow can reuse a compact recorder context without copying the full wc_sess_* on every call.
  • Omission remains valid where recorder provenance is optional.
  • No call can gain business Session authority from the recorder context.
  • A fresh/unrelated model context cannot inherit recorder provenance implicitly.
  • Tests cover same-principal reuse, foreign principal, closed/deleted Session, and explicit business-Session/recorder separation.
  • Documentation continues to state that WebCodex HTTP/MCP requests are stateless unless an exact adapter contract explicitly carries context.

Activity

  1. added
    enhancement
    help wanted
    area:runtime
    priority:P2
    on Sep 20, 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:runtimeenhancementhelp wantedpriority:P2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions