Skip to content

Per-instance logger routing for worker log-bridge attribution #1236

Description

@pdogra1299

Follow-up from #1235 (tracked in RFC §6c of docs/plans/2026-07-27-isolated-agent-runner-rfc.md).

The NeuroLink logger is process-global with a single active emitter, so a worker instance's log bridge (WorkerInstanceOptions.onLog) receives ALL NeuroLink log events emitted in the process — host, other workers, MCP — each stamped with the forwarding bridge's tag. The tag identifies which bridge forwarded an event, not which instance emitted it.

Real fix: per-instance logger routing — log calls carry (or derive, e.g. via AsyncLocalStorage) the emitting instance so each instance's emitter receives only its own events. Then createWorkerInstance can bridge the worker's own emitter and logTag becomes true attribution.

Current interim state (shipped in #1235): the limitation is documented on WorkerInstanceOptions.onLog; createWorkerInstance restores the host as the active sink after construction; dispose()/voice-agent shutdown clear the sink only when they own it (logger.clearEventEmitter(ifEmitter)).

🤖 Generated with Claude Code

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