Skip to content

fix(tunnel): stop double-wrapping credentials-server JSON logs - #1083

Merged
skevetter merged 1 commit into
mainfrom
fix/credentials-server-nested-json-log
Aug 17, 2026
Merged

fix(tunnel): stop double-wrapping credentials-server JSON logs#1083
skevetter merged 1 commit into
mainfrom
fix/credentials-server-nested-json-log

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Problem

The credentials-server SSH command's stderr showed nested log lines:

```
2026-08-17T05:58:22.088Z DEBUG {"level":"debug","ts":"2026-08-17T05:58:22.087Z","msg":"Wrote docker credentials helper to /usr/local/bin/docker-credential-devsy"}
```

`devsy internal agent container credentials-server` (run remotely over SSH,
see `pkg/tunnel/services.go`) always logs structured JSON on stderr, like every
`devsy internal agent ...` subcommand (`cmd/internal/agent.go` forces
`Format: "json"`). Its stderr was wired to `log.Writer(log.LevelDebug)`,
which treats each captured line as an opaque string and wraps it under the
local logger's own line — nesting one log record inside another.

Fix

Switch `runServicesIteration`'s `Stderr` to `log.PipeJSONStream()`. This
already exists in `pkg/log/jsonstream.go` for exactly this shape of problem
(a devsy subprocess logging its own JSON) and is already used the same way
for `ssh-server` and `container-tunnel` (`pkg/tunnel/container.go`,
`cmd/workspace/ssh.go`). It parses each JSON line from the child process and
re-emits it at its original level and message instead of double-wrapping it.

No new logging component added — this is a one-caller fix to use the
existing pattern consistently.

Verification

  • `go build ./...` clean
  • `go vet ./pkg/tunnel/...` clean
  • `go test ./pkg/tunnel/...` passes

The credentials-server command run over SSH (devsy internal agent
container credentials-server) always logs structured JSON on stderr,
like other devsy internal agent subcommands. Its stderr was wired to
log.Writer(log.LevelDebug), which wraps each captured line as an
opaque string under the local logger's own format, nesting one log
record inside another.

Switch to log.PipeJSONStream(), the existing mechanism already used
for the same shape of problem in ssh-server and container-tunnel
(pkg/tunnel/container.go, cmd/workspace/ssh.go): it parses each JSON
line and re-emits it at its original level and message.
@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 2fd0880
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a82a6d865dece00085798f8

@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 2fd0880
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a82a6d87213d9000829ac09

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 330bfbad-4710-41d4-9d08-de699ecf3991

📥 Commits

Reviewing files that changed from the base of the PR and between 9b02e3e and 2fd0880.

📒 Files selected for processing (1)
  • pkg/tunnel/services.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@skevetter
skevetter marked this pull request as ready for review August 17, 2026 17:27
@skevetter
skevetter merged commit ee31e61 into main Aug 17, 2026
130 of 133 checks passed
@skevetter
skevetter deleted the fix/credentials-server-nested-json-log branch August 17, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant