Skip to content

fix(tui): skip malformed custom themes - #44586

Closed
xgbtxy wants to merge 1 commit into
anomalyco:devfrom
xgbtxy:skip-broken-themes
Closed

xgbtxy wants to merge 1 commit into
anomalyco:devfrom
xgbtxy:skip-broken-themes

Conversation

@xgbtxy

@xgbtxy xgbtxy commented Aug 24, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #44263

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Handles custom theme read and parse failures per file. A malformed theme is now skipped with a warning instead of rejecting the entire discovery pass, so valid themes remain available and directory precedence still applies.

How did you verify your code works?

  • bun test test/theme.test.ts in packages/tui: 8 pass
  • bun run test in packages/tui: 193 pass, 1 skip
  • bun run typecheck in packages/tui
  • Repository pre-push typecheck: 30/30 packages passed
  • git diff --check

Screenshots / recordings

Not applicable; this changes theme discovery error handling without changing UI layout.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Copilot AI lite review requested due to automatic review settings August 24, 2026 03:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes TUI custom theme discovery so malformed or unreadable files are skipped with warnings while valid themes remain available.

Changes:

  • Added per-file read and parse error handling.
  • Added tests for malformed themes and directory precedence.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Summary
packages/tui/test/theme.test.ts Tests malformed theme handling and precedence.
packages/tui/src/context/theme.tsx Skips failed custom theme reads and parses with warnings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

Issue author here - confirmed this resolves #44263. The per-file .catch with the file path and error in the warning matches the graceful-skip convention used elsewhere for bad config files, and the updated precedence test proves a malformed project theme no longer masks the global one. Reviewed diff, looks good.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

This PR was closed by the cleanup sweep, but it fixed issue #44263 (tui: skip malformed custom themes) with green checks at the time (check-duplicates, check-standards, check-compliance all passed). The TUI still misbehaves when a theme file is malformed and unquoted; the skip guards I added keep the session usable with broken theme files.

Requesting a reopen. Happy to rebase on current dev if the tree has moved since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tui: one malformed custom theme file silently disables all custom themes

3 participants