Skip to content

chore(diagnostics): Add logging to debug missing agent responses#2726

Open
charlesvien wants to merge 2 commits into
mainfrom
chore/agent-no-response-diagnostics
Open

chore(diagnostics): Add logging to debug missing agent responses#2726
charlesvien wants to merge 2 commits into
mainfrom
chore/agent-no-response-diagnostics

Conversation

@charlesvien

Copy link
Copy Markdown
Member

Problem

Users intermittently get no response from the agent: the turn shows "Generated in Xs" but no text appears, on both local and cloud tasks. Logs point at cloud SSE streams being terminated on a ~120s cadence with content lost on reconnect or at the terminal transition, but we lack the targeted signals to confirm it in prod. This adds diagnostics so the next log dump can pinpoint the failure.

Changes

  1. Cloud SSE diagnostics (cloud-task.ts): log connection response headers (to identify what cuts the stream at ~120s), Last-Event-ID resume verification, per-connection delivery counts, a terminal-stop signal, and watcher failure.
  2. Empty-turn detector (sessionService.ts): warn when a turn completes with zero assistant text and zero tool output, for both local and cloud.
  3. ACP write-drop counter (streams.ts): quantify agent-to-client chunks dropped when a stream closes mid-turn.
  4. Mid-turn teardown warning (agent.ts): warn when a session is cleaned up while a prompt or tool call is in flight.
  5. Structured undici error serialization (shared/errors.ts) plus proxy forward and stream diagnostics (auth-proxy.ts, proxy-stream.ts) to capture socket-level causes (ECONNRESET, UND_ERR_SOCKET) behind "terminated".

How did you test this?

Manually

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 24284c8.

@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/workspace-server/src/services/auth-proxy/auth-proxy.ts:235-236
Both `err` and `errorDetail: serializeError(err)` are included in the same log call. The `errorDetail` already captures the full cause chain that `serializeError` was added to surface; the raw `err` field is redundant unless the logging framework uses it specifically for stack-trace extraction. Consider dropping `err` to keep the payload clean, or rename it to `stack: err instanceof Error ? err.stack : undefined` if the stack is the only extra signal you want.

```suggestion
          errorDetail: serializeError(err),
```

Reviews (1): Last reviewed commit: "add diagnostics for missing agent respon..." | Re-trigger Greptile

Comment thread packages/workspace-server/src/services/auth-proxy/auth-proxy.ts Outdated
@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jun 17, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The automated gates denied this PR because it touches auth-proxy code and exceeds the T1-auto threshold. While the changes are purely diagnostic logging (no auth logic modified, no security risk), the deny-list match and T2-never classification require human review rather than auto-approval.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant