You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Applying a theme rejects harmless CSS text containing @import #38149
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
Open a thread in T3 Code with an agent allowed to change the environment theme.
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
Activity