Skip to content

Re-apply status scan parallelization from v2026.3.1/v2026.3.2 #2205

@alexey-pelykh

Description

@alexey-pelykh

Context

PR #2191 wholesale-restored src/commands/status.scan.ts, status.command.ts, status.summary.ts, and sessions.ts. This discarded performance and feature improvements from v2026.3.1/v2026.3.2.

Audit report: hq/engineering/notes/post-remediation-audit-b3b4.md

Findings

Performance (HIGH)

  1. DeferredResult<T> pattern (status.scan.ts, v2026.3.1): Generic deferred result for parallelizing async ops — launch early, await later. Reusable utility.

  2. scanStatusJsonFast fast path (status.scan.ts, v2026.3.1): Dedicated optimized path for --json mode that avoids progress spinner overhead and runs operations more efficiently in parallel.

  3. Parallelized async operations (status.scan.ts, v2026.3.1): Launches tailscaleDnsPromise, updatePromise, agentStatusPromise, summaryPromise concurrently before awaiting. Reduces status scan wall time.

  4. Security audit parallelization (status.command.ts, v2026.3.1): JSON mode runs scan + security audit in Promise.all. Non-JSON uses sequential with progress. Reduces status --json latency.

Features (MEDIUM)

  1. installKind, gitTag, gitBranch in status (status.command.ts, v2026.3.1): Shows how the tool was installed and git details in status output.

  2. formatGitInstallLabel (status.command.ts, v2026.3.1): Git install label row in human-readable status table.

  3. Model-aware context token resolution (sessions.ts + status.summary.ts, v2026.3.2): lookupContextTokens(model) replaces hardcoded 200K. Different models have different context windows (128K, 200K, 1M). Fixes incorrect context token display.

  4. Configured model display (status.summary.ts, v2026.3.2): Shows actual configured model name instead of "unknown" in status summary.

Code Quality (LOW)

  1. resolveGatewayProbeSnapshot (status.scan.ts, v2026.3.2): DRY extraction — gateway probe setup logic.

  2. resolveChannelsStatus (status.scan.ts, v2026.3.2): DRY extraction — channel status fetch logic.

  3. groupChannelIssuesByChannel (status.command.ts, v2026.3.2): Extracts inline IIFE grouping logic.

  4. resolveSessionStoreTargetsOrExit (sessions.ts, v2026.3.2): Replaces try/catch pattern with exit-on-failure function.

Exit Criterion

Status scan JSON mode uses parallelized operations. lookupContextTokens resolves per-model. Existing tests pass.

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