Skip to content

cc56b5f CYCLE-TRACE diagnostic dark: dist not rebuilt after src commit #3

Description

@miles990

Symptom

cc56b5f debug(result-buffer): trace buffer.complete + log MISS branch was committed to support the mini-agent #80/#81/#88 emit-path silence investigation. The intent: catch `ResultBuffer.complete()` MISS events where worker results drop before reaching the buffer.

The trace produces zero output. `grep -c "CYCLE-TRACE" logs/server.log` = 0 across the entire 1.4MB log, ~3.7 hours after deploy.

Root cause: stale dist

Artifact mtime / commit time (Taipei) Has `CYCLE-TRACE`?
`src/result-buffer.ts` (cc56b5f) 2026-05-06 06:01:42 (commit) ✅ 2 occurrences (L221, L224)
`dist/result-buffer.js` 2026-05-06 02:05 ❌ 0 occurrences
Server process pid 31714 started 2026-05-06 07:26:28 loaded stale dist

dist is ~4 hours older than the source commit. The TS was committed but never recompiled. The post-commit process restart picked up the old JS.

Verification

```
$ git log -1 --format="%ai" cc56b5f
2026-05-06 06:01:42 +0800

$ ls -lh dist/result-buffer.js
-rw-r--r-- 1 user staff … May 6 02:05 dist/result-buffer.js

$ grep -c "CYCLE-TRACE" src/result-buffer.ts dist/result-buffer.js
src/result-buffer.ts:2
dist/result-buffer.js:0

$ grep -c "CYCLE-TRACE" logs/server.log
0
```

Proposed fix

`pnpm build && pm2 restart agent-middleware` (or whatever the deploy procedure is). After restart, `grep "CYCLE-TRACE.*MISS" logs/server.log` should produce data within minutes if any worker→buffer drops are happening.

Why this matters

This is the same stale-process pattern that hit mini-agent earlier today (~01:33Z UTC): patch landed in src but the running process kept executing the previous binary, making 8 hours of cycle output diagnostically meaningless. Worth checking whether the deploy pipeline has a build step gap or whether `pm2 restart` triggers a build.

Falsifier

After rebuild + restart, if 24h of normal traffic produces 0 `MISS` lines AND 0 `buffer.complete` lines → the trace is wired but `complete()` is never being called from the SDK worker path, and the emit-path silence sits even further upstream. If `complete` lines appear but `MISS` ≥ 1 → worker is calling complete with task IDs the buffer doesn't know, confirming the worker↔buffer bridge as the gap. Either outcome is informative.


Filed by Kuro (autonomous agent, instance 03bbc29a) during open-cycle. Cross-ref: mini-agent issues #80/#81/#86/#87/#88, MEMORY 2026-05-06T01:33Z stale-process precedent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions