Skip to content

session-workspace misattribution: per-container session-id correlation needed (shared provider dirs) #103

Description

@kordless

Symptom

A session created in workspace X gets recorded under a DIFFERENT concurrent instance's workspace Y. Confirmed 2026-08-05: antigravity session 708b3926 — agy's own transcript references /workspace/dspy 20x, zero to research, yet session-workspaces.json recorded C:...\Code\research. Resuming it then mounted research and (with the pre-fix binary) crashed the agent.

Root cause

Provider session dirs are SHARED across all concurrent n8 instances (.gemini/antigravity-cli/conversations, .codex/sessions under the one mounted data home). run_interactive_recording/record_new_sessions (main.rs) poll the shared dir and stamp ANY newly-appeared session with the polling instance's own host_ws → last writer wins. With many concurrent panes, a sibling routinely claims another's session.

Mitigation shipped (00fa0ed)

record_session_workspace is now write-once for real paths (won't overwrite an existing real host path). Stops the post-hoc clobber but NOT a tight creation-race — the first writer can still be a sibling.

Why a full host-side fix is hard

No reliable host signal maps a shared-dir session to the container that created it: verified agy does NOT hold its conversation file open (/proc/<pid>/fd shows nothing), so fd-correlation is out. mtime-diff can't distinguish siblings creating sessions in the same window.

Proposed complete fixes (pick one)

  1. Agent-reported id → per-container marker (preferred). agy prints Resume: agy --conversation=<id> on its own stdout; codex writes a rollout with a known id. Provider TOML declares a session_id_pattern; entry captures its child agent's id from output (or a provider hook) and writes ~/.nemesis8/home/.session-workspaces.d/<agent_id>.json = {id: NEMESIS8_HOST_WORKSPACE}. Host merges markers — unambiguous (one container per marker). Container-side (Channel C).
  2. Container-scoped session storage. Bind each provider's session dir per-workspace so dirs aren't shared; picker/resume aggregate across them. More invasive (breaks resume-by-id-across-workspaces assumptions).

Prereq already shipped: build_env now sets NEMESIS8_HOST_WORKSPACE from the mounted workspace (00fa0ed), so a marker written by entry carries the correct workspace.

Also seen while investigating (verify separately)

NEMESIS8_HOST_WORKSPACE displayed corrupted for a Windows path containing \research (Dynamicsesearch\dspy) in a live container — likely a docker-exec echo/display artifact of a backslash path, but worth a byte-level confirm that host paths with \r/\n/\t segments survive the env round-trip intact.

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