fix: surface ConnectRPC errors instead of silently swallowing them#14
fix: surface ConnectRPC errors instead of silently swallowing them#14
Conversation
- backend.IngestEvent: propagate Receive() errors instead of discarding - sidecar.ingestEvent: surface first failure and periodic reminders to stderr so the user knows telemetry is broken - sidecar.heartbeatLoop: surface persistent heartbeat failures - run.Start teardown: report EndSession failure instead of printing success unconditionally Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f35ceb2 to
7383268
Compare
| // Use /tmp (not $TMPDIR) with a short ID to keep the Unix socket path | ||
| // under macOS's 104-byte sun_path limit. $TMPDIR on macOS is a long | ||
| // path like /var/folders/.../T/ which pushes the socket path over. | ||
| sessionDir := filepath.Join("/tmp", "kontext", truncateID(sessionID)) |
There was a problem hiding this comment.
🔴 Session directory uses truncated 8-char ID, creating collision risk between concurrent sessions
The session directory is now derived from truncateID(sessionID) which uses only the first 8 characters of the session ID (internal/run/run.go:100). If two concurrent kontext start instances receive session IDs sharing the same 8-character prefix, they will share the same directory. This causes:
- The second session's
sidecar.Start()removes the first session's socket (internal/sidecar/sidecar.go:49) - Either session ending calls
os.RemoveAll(sessionDir)(internal/run/run.go:138), deleting the other's socket and settings mid-operation
Critically, the truncation is unnecessary for the stated goal of staying under macOS's 104-byte sun_path limit. Switching from os.TempDir() to /tmp already saves ~35+ characters. Using the full session ID gives a path of ~62 bytes (/tmp/kontext/<UUID>/kontext.sock), well under the 104-byte limit. The old code used the full sessionID, which guaranteed uniqueness.
| sessionDir := filepath.Join("/tmp", "kontext", truncateID(sessionID)) | |
| sessionDir := filepath.Join("/tmp", "kontext", sessionID) |
Was this helpful? React with 👍 or 👎 to provide feedback.

Summary
Receive()errors instead of discarding the responseEndSessionfailure instead of printing "session ended" unconditionallyContext
Sessions show up in the dashboard but events/traces don't appear. The entire hook → sidecar → ConnectRPC → API pipeline was silently swallowing all errors, making it impossible to diagnose where events were being lost.
Test plan
kontext start --agent claude, trigger tool calls, verify events appear in traces🤖 Generated with Claude Code