feat: #201 pino JSONL logging framework
Apra Fleet is an open-source MCP server
Brought to you by:
apralabs
Originally created by: kumaakh
console.error logging with a pino-based JSONL framework writing to APRA_FLEET_DATA_DIR/logs/fleet-<pid>.log<pid> file naming eliminates cross-process contentionfs.createWriteStream (replaces pino-roll worker-thread transport for SEA binary compatibility): 10 MB cap, 3 retained filesconsole.* audit — all 8 server-side call sites migrated; CLI scripts (install.ts, auth.ts, smoke-test.ts) remain exempt (no member context)console.error retained alongside structured log (MCP stdio spec compliance; Claude Desktop captures stderr)maskSecrets() applied to all log output — credentials never leak to diskwriteLog wrapped in top-level try/catch; logging failures never throw or crash the serverLogScope class in log-helpers.ts: generates a random inv ID shared across entry/intermediate/exit log lines for a single tool invocationscope.ok(), scope.fail(), scope.abort() exit methods record outcome + elapsed mslogWarn / logError severity levels added; fatal paths in index.ts upgraded to logErrorexecute-command, execute-prompt, send-files, receive-filesexecute-prompt scope exit for all outcomesmemberId threaded through all member-context tool handlers: execute-prompt, execute-command, stop-prompt, provision-vcs-auth, revoke-vcs-auth, send-files, receive-files, ssh, strategymember_id for per-member log filteringstopped flag (isAgentStopped / setAgentStopped / clearAgentStopped): after stop_prompt the PM previously had to call execute_prompt once to clear the gate before doing real work — eliminated; stop_prompt now kills the PID and returns immediatelystop_prompt must be called before TaskStop — if TaskStop fires first it breaks the MCP connection, fleet clears the PID, and the member process becomes an orphansrc/index.ts tool description, docs/api/stop-prompt.md, docs/features/session-lifecycle.md, and skills/fleet/SKILL.md to document correct ordertimeout_ms renamed to timeout_s and max_total_ms to max_total_s across all tools, docs, skills, and READMEagent to member for consistency with the public API namingmember-helpers.js and update-member-cli.js references correctedtests/unit/pid-extraction.test.ts (tested extractAndStorePid removed from strategy.ts)CreateNoWindow=$true added to pidWrapWindows ProcessStartInfo — suppresses flashing console windows on Windows memberswindowsHide: true added to getCleanEnv execSync callskills/pm/context-file.md: guidance replaced with cleanup.md reference and recovery steps for accidentally committed context filesskills/pm/SKILL.md: project sandboxing added as Core Rule 2; deploy description improvedskills/fleet/SKILL.md and troubleshooting.md: Fleet Logs section added (log location, filtering by member_id)docs/api/stop-prompt.md, docs/features/session-lifecycle.md: updated to reflect kill-only behavior and correct stop/TaskStop orderfeedback-skills.md from repo root (accidentally slipped into main via PR [#183])extractAndStorePid dead code from strategy.tsllms-full.txt regeneratednpm run build — 0 errors, 0 type errorsnpm test — all tests pass (1017+)npm run build:binary — SEA binary builds and starts cleanly (verifies fs.createWriteStream is SEA-compatible, unlike pino worker-thread transport)logLine(): directory creation, JSONL field shape, member_id inclusion/exclusion, maskSecrets(), rotation config, console.error parityLogScope: inv propagation, ok/fail/abort exit methods, elapsed msstop_prompt tests: assert kill-only behavior, no stopped-gate, immediate re-dispatch after stopstop_prompt without a dummy execute_prompt calltimeout_s / max_total_s parameter validation: ensure old timeout_ms names are rejectedCloses [#201]
Ticket changed by: kumaakh