Skip to content

Log tab not displaying messages due to incorrect JSON field parsing - #259

Merged
jbrinkman merged 1 commit into
mainfrom
spec/issue-257-67240
Jul 15, 2026
Merged

Log tab not displaying messages due to incorrect JSON field parsing#259
jbrinkman merged 1 commit into
mainfrom
spec/issue-257-67240

Conversation

@jbrinkman

@jbrinkman jbrinkman commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

This PR fixes a bug where the log tab in the TUI was showing empty messages despite logs being correctly written to files. The issue was a JSON field name mismatch in the log parsing logic.

Problem

The loggingMultiWriter.Write() function in internal/tui/tui.go was looking for a JSON field named "message", but charmbracelet/log's JSONFormatter actually uses "msg". This caused all log messages to be extracted as empty strings, resulting in an empty log tab viewport.

Solution

Updated two lines in internal/tui/tui.go:

  • Line 1337: Changed rawEntry["message"] to rawEntry["msg"]
  • Line 1346: Changed metadata exclusion from k != "message" to k != "msg"

Files Modified

  • internal/tui/tui.go - Fixed JSON field name parsing
  • .kiro-krew/specs/issue-257-log-tab-json-field-fix.md - Design specification

Testing

All QA checks passed:

  • ✅ Format check: task fmt:check
  • ✅ Template sync: task sync:check
  • ✅ Lint: task lint
  • ✅ TUI Tests: 51/51 passed
  • ✅ Build: task build

Verification

  • Log tab now displays messages that match log file content
  • Timestamps, log levels, and metadata are preserved
  • File logging functionality remains unchanged
  • No regressions in existing functionality

Closes #257

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where logs could fail to appear in the TUI log tab.
    • Log messages now display correctly with their timestamps, levels, and metadata.
    • Preserved existing log file output, color coding, and automatic scrolling behavior.
  • Documentation

    • Added implementation and validation guidance for the log display fix.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5461e93c-17a8-4b09-af55-258548d93c7f

📥 Commits

Reviewing files that changed from the base of the PR and between e17a8d0 and 800d610.

📒 Files selected for processing (2)
  • .kiro-krew/specs/issue-257-log-tab-json-field-fix.md
  • internal/tui/tui.go

📝 Walkthrough

Walkthrough

The log writer now reads messages from the JSON formatter’s msg field and excludes that field from metadata. A design specification documents the root cause, acceptance criteria, validation steps, rollout, and success metrics.

Changes

Log tab message parsing

Layer / File(s) Summary
Align log parsing with JSON output
.kiro-krew/specs/issue-257-log-tab-json-field-fix.md, internal/tui/tui.go
loggingMultiWriter.Write extracts message text from msg and excludes msg from additional structured fields while preserving file writes and other parsing behavior.
Document acceptance and validation
.kiro-krew/specs/issue-257-log-tab-json-field-fix.md
The specification defines acceptance criteria, manual and automated validation options, rollout details, dependencies, and success metrics.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

  • jbrinkman/kiro-krew#240 — Introduced the structured logging, multi-writer, ring buffer, and log viewer flow that this parsing fix updates.
  • jbrinkman/kiro-krew#254 — Contains the same loggingMultiWriter.Write JSON field parsing logic targeted by this change.

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main fix: the log tab's messages were missing due to JSON field parsing.
Linked Issues check ✅ Passed The fix updates loggingMultiWriter.Write() to read msg, matching the reported root cause while leaving file logging unchanged.
Out of Scope Changes check ✅ Passed The added spec document is directly related to the issue and no unrelated code changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch spec/issue-257-67240

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.

@jbrinkman
jbrinkman merged commit a020f92 into main Jul 15, 2026
2 checks passed
@jbrinkman
jbrinkman deleted the spec/issue-257-67240 branch July 15, 2026 16:22
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.

Log tab not displaying messages due to incorrect JSON field parsing

1 participant