AI Agents SDE Task Viewer
      • Pr description
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-496
  5. changes
  6. pr_description.md
pr_description.md(1.5 KB)· Apr 14, 2026· 1 min read
  • Title
  • Problem
  • Task / Link
  • Changes
  • Notes
  • Testing

Title#

Restore agent-runner.log in agent-worker InvocationProcessor

Problem#

After the fire-and-forget BullMQ refactor, InvocationProcessor stopped creating meta/agent-runner.log, leaving the viewer returning 404 and removing the human-readable audit trail for pipeline runs.

Task / Link#

Closes AgentSDE/agent-core#496

Changes#

  • Switch stdio from fd-based (['ignore', stdoutFd, stderrFd]) to pipe mode (['ignore', 'pipe', 'pipe'])
  • Add cetTs() helper returning CET/CEST timestamps in sv-SE locale format
  • Open agent-runner.log in append mode and write timestamped start header, per-chunk entries, and completion footer
  • Parse stdout JSON lines: tool_use → [tool:X], text → [text]; malformed lines are silently skipped
  • Write stderr chunks to log with stderr: prefix
  • Add logEnded boolean guard to prevent write-after-end errors
  • Accumulate stdout in memory buffer (avoids file-read race after WriteStream close)
  • Add unit tests covering: log creation/format, JSON line parsing, logEnded guard, error path

Notes#

  • process() is fire-and-forget — result is pushed to phase-result queue asynchronously in the close handler
  • Pipe mode keeps the worker's event loop alive while the child runs, which is correct for a long-running BullMQ worker

Testing#

  • Unit tests: 7 passing — log creation, start header format, footer format, [tool:X]/[text] parsing, malformed JSON resilience, logEnded guard, error entry on spawn failure
  • Verified with npm run lint (zero warnings/errors) and npm run test
PrdAi-done