Skip to content

[Bug]: Applying a theme rejects harmless CSS text containing @import #38149

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

packages/contracts or packages/shared

Steps to reproduce

  1. Open a thread in T3 Code with an agent allowed to change the environment theme.
  2. Ask the agent to use the theme tool to apply a theme with id import-label, name Import Label, appearance dark, canvas #101820, accent #7aa2f7, and CSS [data-chat-header]::after { content: "@import"; }.

Expected behavior

The theme is applied and the chat header displays the literal text @import; this CSS loads no files.

Actual behavior

The theme change is refused with an error saying its CSS loads files.

Impact

Minor bug or occasional failure. People asking agents to apply themes with quoted CSS text containing @import are blocked on every attempt, even though the text is harmless.

Version or commit

main at 5842231421. The cause is at packages/shared/src/themeCss.ts:31.

Environment

Linux x64, the repository's own tests.

Logs or stack traces

allows literal import text in generated content without loading files
AssertionError: expected true to be false
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/packages/shared/src/themeCss.test.ts b/packages/shared/src/themeCss.test.ts
index 80656a8207..444973c8fe 100644
--- a/packages/shared/src/themeCss.test.ts
+++ b/packages/shared/src/themeCss.test.ts
@@ -30,6 +30,12 @@ describe("themeCssValueFetches", () => {
 });
 
 describe("themeCssLoadsRemoteFiles", () => {
+  it("allows literal import text in generated content without loading files", () => {
+    expect(
+      themeCssLoadsRemoteFiles('[data-chat-header]::after { content: "@import"; }'),
+    ).toBe(false);
+  });
+
   it("allows a url() inside a data: address", () => {
     expect(
       themeCssLoadsRemoteFiles(`.repro { background-image: url('${SVG_WITH_OWN_GRADIENT}'); }`),
cd packages/shared && pnpm exec vp test run --config ../../vite.config.ts --dir . src/themeCss.test.ts

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions