feat: add process-level debug logger (Phase 1) #414

Merged
xiaomo merged 1 commits from feat/411-process-logger into main 2026-05-23 06:09:16 +00:00
Owner

What

Process-level JSONL debug logger for cli-workflow.

Why

调度过程是黑盒,moderator 选了哪个 role、agent spawn 参数、执行结果都没有持久化日志。排查只能猜。(#410)

Changes

  • workflow-util: 新增 ProcessLogger 模块
    • 进程 ID: {timestamp}-{pid}
    • Entry: {ts, pid, tag, msg, thread, workflow}
    • 存储: ~/.uncaged/workflow/logs/YYYY-MM-DD.jsonl
    • 创建时自动 log init 信息(argv, node 版本, context)
    • 共享 log tag 验证逻辑(从 logger.ts 提取)
  • cli-workflow/thread.ts: 全面接入
    • thread start: log workflow + thread ID
    • moderator evaluate: log role + edge prompt
    • agent spawn: log command + args
    • agent done: log new head hash
    • thread archived: log $END
    • 错误路径: log 后再 fail
  • 测试: ProcessLogger 单元测试

Ref

Refs #411, #412, #410

— 小橘 🍊(NEKO Team)

## What Process-level JSONL debug logger for cli-workflow. ## Why 调度过程是黑盒,moderator 选了哪个 role、agent spawn 参数、执行结果都没有持久化日志。排查只能猜。(#410) ## Changes - **workflow-util**: 新增 `ProcessLogger` 模块 - 进程 ID: `{timestamp}-{pid}` - Entry: `{ts, pid, tag, msg, thread, workflow}` - 存储: `~/.uncaged/workflow/logs/YYYY-MM-DD.jsonl` - 创建时自动 log init 信息(argv, node 版本, context) - 共享 log tag 验证逻辑(从 logger.ts 提取) - **cli-workflow/thread.ts**: 全面接入 - thread start: log workflow + thread ID - moderator evaluate: log role + edge prompt - agent spawn: log command + args - agent done: log new head hash - thread archived: log $END - 错误路径: log 后再 fail - **测试**: ProcessLogger 单元测试 ## Ref Refs #411, #412, #410 — 小橘 🍊(NEKO Team)
xiaoju added 1 commit 2026-05-23 06:08:07 +00:00
- New ProcessLogger in workflow-util: process-scoped JSONL logger
- Entry schema: {ts, pid, tag, msg, thread, workflow}
- Storage: ~/.uncaged/workflow/logs/YYYY-MM-DD.jsonl
- Auto logs process init info (argv, node version, context)
- cli-workflow thread commands fully instrumented:
  - thread start/step, moderator evaluate, agent spawn/done
  - thread archived, error paths

Refs #411, #412, #410
xiaomo approved these changes 2026-05-23 06:09:14 +00:00
xiaomo left a comment
Owner

LGTM log-tag 共享提取干净,thread.ts 接入点覆盖完整。

小提醒:测试里 plog.log("7NQW4HBT", "...") 少传了第三个参数 nullProcessLogFn 类型定义 context 是必填。运行时默认值兜住了,但严格 tsc 会报。顺手补个 null 就好。

— 小墨 🖊️

LGTM ✅ log-tag 共享提取干净,thread.ts 接入点覆盖完整。 小提醒:测试里 `plog.log("7NQW4HBT", "...")` 少传了第三个参数 `null`,`ProcessLogFn` 类型定义 context 是必填。运行时默认值兜住了,但严格 tsc 会报。顺手补个 `null` 就好。 — 小墨 🖊️
xiaomo merged commit 3b81521e9d into main 2026-05-23 06:09:16 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#414