#7498 · Panel width inheritance invalidation
Trusted base: 070bf3df0aae0f009488f29d8941f5fec8532a93. Verdict: REPRODUCED · Root-cause confidence: high.
1. TL;DR
The right panel has a width custom property that is intended for the panel itself, but that value also propagates into its entire content tree. A focused Chrome trace with 2,400 descendants shows every one of those descendants restyled after each width write: 2,401 elements including the panel. An otherwise identical non-inherited control changes the same panel width while restyling just one element. This happens in both clean trusted checkouts. The reproduction verifies the style-invalidation mechanism, not the full app's reported toggle frame times.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| Panel-only width changes restyle the whole panel tree. | Verified | Forty of forty Chrome UpdateLayoutTree events report 2,401 elements in each checkout. Descendants inherit 40cqw. |
| A non-inherited registration confines invalidation to the panel. | Verified mechanism | Control with identical panel width changes reports one element on all forty writes; descendants have no inherited value. |
| The existing container-width fallback can be preserved. | Verified | Unset baseline and non-inherited control both compute to 350px in a 1,000px container; a 40cqw assignment computes to 400px. |
| The packaged app has particular open/close/drag frame-time spikes. | Unverified | No packaged-app or full GitButler interaction was run. Our Chrome version, DPR, tree and timing metric differ. Do not compare these milliseconds directly with the issue's frame-time table. |
| The earlier resize mitigation does not remove the remaining invalidation. | Verified in current source | The dragging guard suppresses intermediate writes, but drag completion and non-drag resize still call the inherited writer. |
3. Environment
- Public repository get-bb/bb; trusted origin/main at 070bf3df0aae0f009488f29d8941f5fec8532a93, fetched again before publication with no newer main commit.
- Checkout runner: Linux x86_64 (gVisor), Node v22.19.0, pnpm frozen-lockfile installs. Both checkouts completed the normal 73-task Turbo build. The first broad build initially hit an unbuilt SDK runtime; building the SDK's existing build/build:types tasks first resolved it without source changes.
- Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/149.0.0.0 Safari/537.36; viewport 1440×1000, DPR 1, no CPU throttling. Explicit BB Browser Automation headless session on an explicitly selected connected browser host.
- First checkout
/tmp/bb-7498-base, second clean worktree/tmp/bb-7498-second; separate fixture data directoriesdata-first/data-second, localhost ports 49231/49232. - The browser and checkout runner are different hosts. The local harness HTML is transferred explicitly through the BB Browser Automation script; the browser never attaches to the user's app. No real runtime data, account, provider turn, or project is used.
4. Minimal reproduction
- Download
harness.mjsandbrowser-repro.jsfrom the complete inline listings below. Prepare trusted source using the commands below. Replace HOST_ID and SESSION_ID with identifiers returned by the BB commands. - The harness derives the custom-property name from the source resize writer, confirms its consumer, and uses the trusted theme's actual @property blocks. It creates a 1,000px container with an aside and 2,400 children, without loading the rest of the app.
- The browser test alternates width between 40cqw and 41cqw, then forces a descendant style read. It records Chrome trace element counts for 40 writes. It repeats with a separate, non-inherited control property on the same aside. No production file is patched.
- Expect the panel-local invariant to fail on this base (child value should be empty, and only the owner should need style recomputation). The reproduction returns success when it detects that failure and its control passes. This is a bug-detection harness, not a passing product regression suite.
git clone https://github.com/get-bb/bb.git bb-7498-base
cd bb-7498-base
git checkout --detach 070bf3df0aae0f009488f29d8941f5fec8532a93
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
node /path/to/harness.mjs "$PWD" /tmp/bb-7498-first-data 49231
# In another terminal, use an explicit connected browser host from bb machine list:
bb browser-automation open --backend local --headless --machine HOST_ID --json
bb browser-automation run SESSION_ID --script "globalThis.fixtureHtml = $(curl --fail --silent http://127.0.0.1:49231/ | node -e 'let data=""; process.stdin.on("data",chunk=>data+=chunk).on("end",()=>console.log(JSON.stringify(data)))'); $(cat /path/to/browser-repro.js)" --timeout-ms 120000 --json
# Repeat with a second clean checkout, fresh browser session, data directory and port:
git worktree add --detach ../bb-7498-second 070bf3df0aae0f009488f29d8941f5fec8532a93
node /path/to/harness.mjs ../bb-7498-second /tmp/bb-7498-second-data 49232
# Repeat the browser command against port 49232, with the new session ID.
Observed result in both checkouts:
expected panel-local invariant: childProperty="", restyles per write=1 actual trusted main: childProperty="40cqw", restyles per write=2401 (40/40 writes) non-inherited control: childProperty="", restyles per write=1 (40/40 writes) invariantPass=false; controlPass=true
| Run | Baseline median write + forced read | Control median | Restyled elements | Unset fallback |
|---|---|---|---|---|
| 1 | 3.10 ms | 1.30 ms | 2,401 → 1 on all 40 writes | 350 px → 350 px |
| 2 | 3.10 ms | 1.40 ms | 2,401 → 1 on all 40 writes | 350 px → 350 px |
These are synchronous write-plus-forced-read samples, not animation frame times; each sample includes remaining layout cost. The direct restyle counts are the primary evidence, not timing.

Reproduction scripts
harness.mjs (complete)
import { readFileSync, mkdirSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { execFileSync } from "node:child_process";
import { createServer } from "node:http";
const [checkout, dataDirectory, portArgument] = process.argv.slice(2);
if (!checkout || !dataDirectory || !/^\d+$/.test(portArgument ?? "")) {
throw new Error("Usage: node harness.mjs CHECKOUT TEMP_DATA PORT");
}
const port = Number(portArgument);
if (port < 40000 || port > 60000) throw new Error("Use a temporary QA port");
const base = resolve(checkout);
const css = readFileSync(resolve(base, "apps/app/src/components/ui/theme.css"), "utf8");
const hook = readFileSync(resolve(base, "apps/app/src/components/secondary-panel/useSecondaryPanelResize.ts"), "utf8");
const component = readFileSync(resolve(base, "apps/app/src/components/secondary-panel/ThreadSecondaryPanel.tsx"), "utf8");
const property = hook.match(/const applySwipeWidth[\s\S]*?setProperty\(\s*"([^"]+)"/)?.[1];
if (!property || !component.includes(`var(${property},`)) {
throw new Error("The resize writer and width consumer no longer match this reproduction");
}
const registrations = Array.from(css.matchAll(/@property\s+[\w-]+\s*\{[^}]*\}/g), match => match[0]).join("\n");
const commit = execFileSync("git", ["-C", base, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
const metadata = { commit, property, registrationCount: Array.from(css.matchAll(/@property\s/g)).length };
const page = `<!doctype html><html><head><meta charset="utf-8"><title>7498: browser invalidation fixture</title><style>${registrations}
body { font: 16px system-ui; margin: 24px; background: #fafaf8; color: #222; }
main { container-type: inline-size; width: 1000px; }
aside { width: var(${property}, 35cqw); height: 400px; overflow: hidden; border: 1px solid; }
aside div { height: 1px; }
pre { white-space: pre-wrap; }
</style></head><body><h1>Right-panel custom-property invalidation</h1><p>Isolated browser fixture using trusted source registrations, not the full app.</p><main><aside></aside></main><pre id="result">Ready</pre><script>window.fixtureMetadata = ${JSON.stringify(metadata)}; const surface = document.querySelector("aside"); for (let index = 0; index < 2400; index++) { surface.append(document.createElement("div")); }</script></body></html>`;
mkdirSync(dataDirectory, { recursive: true });
writeFileSync(resolve(dataDirectory, "metadata.json"), JSON.stringify(metadata, null, 2));
createServer((request, response) => {
if (request.url !== "/") { response.writeHead(404); response.end(); return; }
response.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" });
response.end(page);
}).listen(port, "127.0.0.1", () => console.log(JSON.stringify({ port, ...metadata })));
browser-repro.js (complete)
const page = await browser.getPage("main");
await page.setViewport({ width: 1440, height: 1000, deviceScaleFactor: 1 });
if (globalThis.fixtureHtml) {
await page.setContent(globalThis.fixtureHtml);
} else {
await page.goto(globalThis.harnessUrl ?? "http://127.0.0.1:49231/");
}
const metadata = await page.evaluate(() => window.fixtureMetadata);
const session = await page.createCDPSession();
async function measure(label, property) {
await page.evaluate(propertyName => {
const surface = document.querySelector("aside");
surface.style.setProperty(propertyName, "40cqw");
getComputedStyle(surface.lastElementChild).width;
}, property);
const completed = new Promise(resolve => session.once("Tracing.tracingComplete", resolve));
await session.send("Tracing.start", { categories: "devtools.timeline", transferMode: "ReturnAsStream" });
const observation = await page.evaluate(propertyName => {
const surface = document.querySelector("aside");
const child = surface.lastElementChild;
const durations = [];
for (let sample = 0; sample < 40; sample++) {
const started = performance.now();
surface.style.setProperty(propertyName, `${sample % 2 === 0 ? 41 : 40}cqw`);
getComputedStyle(child).width;
durations.push(performance.now() - started);
}
return {
descendants: surface.querySelectorAll("*").length,
childProperty: getComputedStyle(child).getPropertyValue(propertyName).trim(),
ownerProperty: getComputedStyle(surface).getPropertyValue(propertyName).trim(),
ownerWidth: getComputedStyle(surface).width,
durations,
};
}, property);
await session.send("Tracing.end");
const { stream } = await completed;
let trace = "";
for (;;) {
const chunk = await session.send("IO.read", { handle: stream });
trace += chunk.base64Encoded ? Buffer.from(chunk.data, "base64").toString() : chunk.data;
if (chunk.eof) break;
}
await session.send("IO.close", { handle: stream });
const events = JSON.parse(trace).traceEvents.filter(event => event.name === "UpdateLayoutTree");
const elementCounts = events.map(event => event.args?.elementCount ?? event.args?.data?.elementCount).filter(count => typeof count === "number");
const sorted = [...observation.durations].sort((left, right) => left - right);
return { label, ...observation, medianMilliseconds: sorted[Math.floor(sorted.length / 2)], restyledElementCounts: elementCounts, styleUpdateCount: events.length };
}
const fallbackWidth = await page.evaluate(() => getComputedStyle(document.querySelector("aside")).width);
const baseline = await measure("trusted-main", metadata.property);
const controlProperty = "--qa-contained-width";
await page.evaluate(propertyName => {
const registration = document.createElement("style");
registration.textContent = `@property ${propertyName} { syntax: "*"; inherits: false; }`;
document.head.append(registration);
const surface = document.querySelector("aside");
surface.style.removeProperty(window.fixtureMetadata.property);
surface.style.width = `var(${propertyName}, 35cqw)`;
}, controlProperty);
const controlFallbackWidth = await page.evaluate(() => getComputedStyle(document.querySelector("aside")).width);
const control = await measure("non-inherited-control", controlProperty);
const results = {
...metadata,
userAgent: await page.evaluate(() => navigator.userAgent),
fallbackWidth,
controlFallbackWidth,
baseline,
control,
invariantPass: baseline.childProperty === "" && baseline.restyledElementCounts.every(count => count <= 1),
controlPass: control.childProperty === "" && control.ownerWidth === "400px" && controlFallbackWidth === fallbackWidth && control.restyledElementCounts.length === 40 && control.restyledElementCounts.every(count => count === 1),
};
await session.detach();
await page.evaluate(value => { document.querySelector("#result").textContent = JSON.stringify(value, null, 2); }, results);
console.log(JSON.stringify(results, null, 2));
if (!results.controlPass) throw new Error("Non-inherited control failed");
if (results.invariantPass) throw new Error("The trusted-main defect did not reproduce");
5. Root cause
The panel writes an unregistered custom property on its aside, so the value inherits into every descendant and each write invalidates their computed styles.
- apps/app/src/components/secondary-panel/useSecondaryPanelResize.ts:39 assigns the property directly on the panel element.
- apps/app/src/components/secondary-panel/ThreadSecondaryPanel.tsx:956 reads that property in the aside's width expression. There is no intended descendant consumer.
- apps/app/src/components/ui/theme.css:959 registers the analogous sidebar width as non-inherited, but does not register this secondary-panel property. The trusted theme contains only that one @property declaration.
- apps/app/src/components/secondary-panel/useSecondaryPanelResize.ts:52 writes at drag completion; apps/app/src/components/secondary-panel/useSecondaryPanelResize.ts:99 still writes for non-drag resizes. Reducing write frequency does not change inheritance invalidation per remaining write.
secondaryPanelRef.current?.style.setProperty(
"--secondary-swipe-width",
`${size}cqw`,
);
width: `var(--secondary-swipe-width, ${persistedWidthPercent}cqw)`
Changing the width can still require descendant layout even when style invalidation is contained. A registration removes this measured style-inheritance overhead; it does not guarantee zero layout or a particular frame budget.
6. Proposed fix
Register the panel-only width property as non-inherited, leaving its unset state without a concrete initial value so the existing container-width fallback remains effective. The separate control demonstrates both unchanged sizing and the removal of inherited invalidation. Test actual descendant computed values and invalidation in a real browser, and retain fallback coverage. No production fix branch was created because an open linked PR already owns this issue.
7. PR review
#7499 — static review only
GitHub metadata confirms this open PR closes #7498. Its head was 4a0db7d06e766f05720a1ba31b867345e85cec4c when reviewed. Its two-file diff adds a non-inherited registration and source-level CSS assertions. This directly targets the verified cause and intentionally preserves the var() fallback. No blocking static finding was identified. The source-text assertions are weaker than a real-browser behavioral check; the report's Chrome control adds that separate evidence.
Only GitHub metadata and diff were read as untrusted data. The PR branch, tests and build were not checked out or executed. Its own benchmark and CI claims are not independently certified here. The control was designed from the trusted writer, consumer and existing sidebar registration.
8. Related issues
#6511 is a merged resize-write-frequency mitigation. Current source retains its dragging guard; this report concerns the inheritance cost of writes that remain.
9. Verification
The same agent repeated the reproduction directly, without a workflow or verification subagent, in a second clean worktree at 070bf3df0aae0f009488f29d8941f5fec8532a93. Both source checkouts were clean after restoring an unrelated generated web route file produced by the first build. The second frozen install, existing SDK build and full Turbo build succeeded (73 tasks, 71 cached). The second harness used port 49232, a new data directory and a newly opened browser session. It produced the same 40 baseline counts of 2,401 and 40 control counts of one, the same inherited child value, and the same 350px fallback. No verdict correction was necessary. This is a repeated clean run by the same agent, not independent verification.
10. Appendix and limits
- First-run results and all sample arrays are embedded below.
- Second-run results and all sample arrays are embedded below.
- Browser tracing used
devtools.timeline; counts come directly fromUpdateLayoutTree.args.elementCount. Traces were read in memory; the saved artifacts retain every extracted count and sample, not the complete Chrome trace. - No full app/server/daemon was booted. No claim is made about the exact product open/close animation path, packaged version, Chrome 156, iOS Safari, or the issue's numerical frame timings.
- Issue and linked-PR contents were untrusted evidence only. No issue command, script, patch, branch, attachment, or external URL was executed or fetched.
- Classification rationale: visible but bounded UI latency, no data loss or full work block; one contained existing styling owner. Applied Bug / Low / Low and ui + perf; no pre-existing classifications were replaced.
First run: complete measurement results
{
"commit": "070bf3df0aae0f009488f29d8941f5fec8532a93",
"property": "--secondary-swipe-width",
"registrationCount": 1,
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/149.0.0.0 Safari/537.36",
"fallbackWidth": "350px",
"controlFallbackWidth": "350px",
"baseline": {
"label": "trusted-main",
"descendants": 2400,
"childProperty": "40cqw",
"ownerProperty": "40cqw",
"ownerWidth": "400px",
"durations": [
3.8000000715255737,
3.100000023841858,
3.0999999046325684,
3.100000023841858,
3.100000023841858,
3.200000047683716,
3.0999999046325684,
3.100000023841858,
3.100000023841858,
3.200000047683716,
3.0999999046325684,
3.100000023841858,
3.200000047683716,
3.1999999284744263,
3.100000023841858,
3.100000023841858,
3.200000047683716,
3.0999999046325684,
3.100000023841858,
3.100000023841858,
3.100000023841858,
3.1999999284744263,
3.200000047683716,
3.100000023841858,
3.1999999284744263,
3.200000047683716,
3.200000047683716,
3.0999999046325684,
3.3000000715255737,
3.100000023841858,
3.0999999046325684,
3.200000047683716,
3.200000047683716,
3.299999952316284,
3.100000023841858,
3.1999999284744263,
3.200000047683716,
3,
3.5,
3
],
"medianMilliseconds": 3.100000023841858,
"restyledElementCounts": [
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401
],
"styleUpdateCount": 40
},
"control": {
"label": "non-inherited-control",
"descendants": 2400,
"childProperty": "",
"ownerProperty": "40cqw",
"ownerWidth": "400px",
"durations": [
2.200000047683716,
1.399999976158142,
1.5,
1.2999999523162842,
1.3000000715255737,
1.399999976158142,
1.399999976158142,
1.2999999523162842,
1.3000000715255737,
1.2999999523162842,
1.399999976158142,
1.5,
1.5,
1.3000000715255737,
1.2999999523162842,
1.3000000715255737,
1.399999976158142,
1.2999999523162842,
1.399999976158142,
1.4000000953674316,
1.1999999284744263,
1.399999976158142,
1.3000000715255737,
1.2999999523162842,
1.399999976158142,
1.3000000715255737,
1.2999999523162842,
1.5,
1.2000000476837158,
1.5,
1.5,
1.2999999523162842,
1.3000000715255737,
1.399999976158142,
1.2999999523162842,
1.3000000715255737,
1.399999976158142,
1.2999999523162842,
1.399999976158142,
1.3000000715255737
],
"medianMilliseconds": 1.3000000715255737,
"restyledElementCounts": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"styleUpdateCount": 40
},
"invariantPass": false,
"controlPass": true
}Second run: complete measurement results
{
"commit": "070bf3df0aae0f009488f29d8941f5fec8532a93",
"property": "--secondary-swipe-width",
"registrationCount": 1,
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/149.0.0.0 Safari/537.36",
"fallbackWidth": "350px",
"controlFallbackWidth": "350px",
"baseline": {
"label": "trusted-main",
"descendants": 2400,
"childProperty": "40cqw",
"ownerProperty": "40cqw",
"ownerWidth": "400px",
"durations": [
3.399999976158142,
3.200000047683716,
3.100000023841858,
3.100000023841858,
3.0999999046325684,
3.100000023841858,
3.100000023841858,
3.200000047683716,
3.0999999046325684,
3.200000047683716,
3.100000023841858,
3.299999952316284,
3.100000023841858,
3.100000023841858,
3.5,
3.1999999284744263,
3.100000023841858,
3.8000000715255737,
3.1999999284744263,
3.100000023841858,
3.100000023841858,
3.100000023841858,
3.0999999046325684,
3.200000047683716,
3,
3.100000023841858,
3.100000023841858,
3.299999952316284,
3.100000023841858,
3.1999999284744263,
3.100000023841858,
3.100000023841858,
3.100000023841858,
3.100000023841858,
3.0999999046325684,
3.200000047683716,
3.100000023841858,
3.1999999284744263,
3.100000023841858,
3.100000023841858
],
"medianMilliseconds": 3.100000023841858,
"restyledElementCounts": [
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401,
2401
],
"styleUpdateCount": 40
},
"control": {
"label": "non-inherited-control",
"descendants": 2400,
"childProperty": "",
"ownerProperty": "40cqw",
"ownerWidth": "400px",
"durations": [
1.5,
1.3000000715255737,
1.399999976158142,
1.5,
1.5,
2.600000023841858,
1.399999976158142,
1.2999999523162842,
1.3000000715255737,
1.5999999046325684,
1.4000000953674316,
1.2999999523162842,
1.399999976158142,
1.399999976158142,
1.4000000953674316,
1.399999976158142,
1.2999999523162842,
1.3000000715255737,
1.399999976158142,
1.600000023841858,
1.399999976158142,
1.399999976158142,
1.399999976158142,
1.3000000715255737,
1.399999976158142,
1.5,
1.399999976158142,
2.200000047683716,
1.2999999523162842,
1.399999976158142,
1.399999976158142,
1.3000000715255737,
1.399999976158142,
1.2999999523162842,
1.4000000953674316,
1.5,
1.5,
1.2999999523162842,
1.2999999523162842,
1.3000000715255737
],
"medianMilliseconds": 1.399999976158142,
"restyledElementCounts": [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
"styleUpdateCount": 40
},
"invariantPass": false,
"controlPass": true
}Reproduction files and raw CLI envelopes are retained locally, not committed to this public reports repository. All required scripts and numerical evidence are inline above.
> AGENT GENERATED