Skip to content

pi: write the error log without blocking the event loop #90

Closed

Description

@aikins01

The pi integration's default onError is writeErrorLog, which runs statSync, a possible renameSync, and appendFileSync on pi's thread before it returns. A slow agent directory, such as a network mount set through PI_CODING_AGENT_DIR, holds up pi's event loop and TUI for as long as each write takes.

right now:

expected:

  • writes and rotation happen off the calling path, so onError returns without waiting on the disk
  • pending writes are bounded, entries past the bound are dropped, and a failed write never rejects into pi
  • the log file keeps mode 0600, rotates past 5 MB, and holds entries in call order
  • the existing pi test still finds the entry in telemetry-dev.log after the session flushes

relevant files:

  • packages/pi/src/error-log.ts
  • packages/pi/src/extension.ts
  • packages/pi/tests/pi.test.ts
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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions