Skip to content

perf: every v2 socket command blocks on an O(application) main-thread scan, nullifying the off-main telemetry policy #184

Description

@arzafran

From the gpt-5.6-sol eval (P1). Risk: touches every command's dispatch, so it needs care.

processV2Command unconditionally calls v2MainSync before dispatch (Sources/TerminalController.swift:1494), and that refresh walks every window/workspace/pane/surface (:2161). The individual telemetry handlers correctly parse off-main and use main.async (Sources/TerminalController+Telemetry.swift:9), so this shared prelude undoes the stated socket threading policy under telemetry bursts. Separately, concurrent client threads share one process-global LIFO focus-policy stack (TerminalController.swift:261,305), so interleaved requests can observe another request's focus allowance.

First step: allocate refs on lifecycle changes or only for commands that need them; pass focus intent explicitly instead of through global stack state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions