Skip to content

studiobench: delete through the reply's More menu, where #12735 moved it - #12748

Merged
danielhanchen merged 3 commits into
mainfrom
ci-studiobench-delete-menu
Oct 5, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
ci-studiobench-delete-menu

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Real-path session, every action ran is red on main and on unrelated PRs (for example #12736, #12744 and #12746), always with:

delete_message: NOT RUN -- no Delete button after waiting 1520.4ms
1 cell(s), 1 scene problem(s), 0 missed slot(s) against a slack of 2, 1 action(s) allowed not to run

Cause

#12735 (tidy the message action bars) moved Delete off the reply's action bar into its More menu, as the last item in red. That is an intended product change. The studiobench scene was not updated: DELETE_JS still waits for a Delete message button on the bar, which no longer exists, so the action never runs and the liveness gate fails. STOP_CLEANUP_JS (removing the throwaway turn after stop) used the same lookup and was silently skipping its cleanup.

Changes

  • dom.js: menuItem(name) and openMenuAndFind(trigger, name, waitMs). The latter opens a More menu with pointerdown/up (Radix opens on pointerdown, as MENU_JS already notes) and waits, bounded, for the item.
  • DELETE_JS: waits for the More trigger, opens the menu and finds Delete before the clock starts, then times from selecting Delete to the reply leaving the document, as before. The menu open time is reported separately as menu_open_ms, so delete_ms keeps measuring the delete. If the menu has no Delete item it is closed and the action reports why.
  • STOP_CLEANUP_JS: the same route.
  • New test_studiobench_delete_through_more_menu.py:
    • runs the shipped DELETE_JS and dom.js in node against a small DOM shim, covering the delete through the menu, and the "no Delete item" case closing the menu;
    • checks that every control the scene asks for (bar buttons by tooltip, menu items by label) is still rendered in thread.tsx, so the next move fails here with the control's name instead of as a NOT RUN in a browser job.

Verification

  • tests/studio/studiobench/scene/selftest: all pass.
  • With main's actions.py, all three new tests fail. Renaming the menu item's Delete label in thread.tsx fails the rendered-controls check.
  • The real-path session job on this PR runs the scene end to end in a browser.

#12735 took Delete off the assistant action bar and made it the last item of the More
menu. delete_message still waited for a 'Delete message' button, so the real-path
session reported 'delete_message: NOT RUN -- no Delete button' and failed its liveness
gate on every pull request. The stop action's cleanup had the same lookup.

Open the More menu before the clock starts and select its Delete item; close the menu
when the item is missing. Add a node selftest that runs the shipped DELETE_JS through
the menu, and a check that every control name the scene asks for is still rendered by
thread.tsx.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T18:01:07.740941Z bb1c09b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 5, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc6ab6b41f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// Delete is the More menu's last item since #12735; see DELETE_JS.
const trigger = D.actionButton("More");
if (!trigger) return false;
const button = (await D.openMenuAndFind(trigger, "Delete", 1000)).item;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reserve time for opening the cleanup menu

When the preceding reply drains near OWN_TURN_RESERVE_MS, stop_generation commits to its throwaway turn using a reserve calculated for the old direct-delete path, but cleanup now adds this menu-open phase, which can wait up to 1,000 ms. That unreserved work can carry the action past its slot and into the following scroll_after window (the fast film leaves only a 300 ms gap), causing a missed slot or contaminating that measurement. Include the menu-open bound in the reserve or constrain this wait to the remaining slot budget.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, the reserve never priced the menu open. Fixed in 696f25b: the cleanup's menu wait is now bounded by what is left of the slot after the settle and the delete (floor 100 ms, cap 1000 ms). The slot-budget test sweeps a menu that never opens over every drain time on all three films, and fails on fast and quick with a fixed 1000 ms wait.

Comment thread tests/studio/studiobench/scene/dom.js Outdated
await (window.__sbNextPaint
? window.__sbNextPaint()
: new Promise((r) => setTimeout(r, 16)));
item = D.menuItem(name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid scanning the full DOM in the menu wait loop

When the portaled menu takes one or more paints to mount, every iteration calls D.menuItem(), which calls D.openMenu() and therefore performs a document-wide selector query inside the measured action window. On the large-thread rungs this adds main-thread work proportional to the DOM and biases delete_message frame/jank readings; MENU_JS already uses a MutationObserver specifically to avoid this measurement defect. Observe the body for the portal once, or otherwise avoid repeating a full-document lookup on each paint.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 696f25b: openMenuAndFind now looks for the portal only when a MutationObserver reports body's children changed, then for the item inside the menu. The node selftest mounts the menu three paints late and asserts at most two document-wide lookups; a per-paint lookup fails it.

… by the slot

Look for the portaled More menu only when body's children change, then for the item
inside it, instead of a document-wide query every paint inside the measured window.

The stop action's cleanup now waits for that menu, which OWN_TURN_RESERVE_MS never
priced. Bound the wait by what is left of the slot (floor 100 ms, cap 1000 ms) and
sweep a menu that never opens over every drain time in the slot-budget test.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 696f25b43f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +210 to +212
for body in re.findall(
r"<ActionBarMorePrimitive\.Item\b([\s\S]*?)</ActionBarMorePrimitive\.Item>", tsx
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Scope the control check to the assistant menu

If the assistant action bar drops its DeleteMessageMenuItem invocation, this test still passes because the global regex collects Delete from the reusable component's definition, even when that component is no longer rendered there; similarly, More also exists in UserMoreMenu. The scene targets the last assistant message, so this check must verify the assistant bar/menu composition (or rendered DOM) rather than mere label occurrences anywhere in thread.tsx, otherwise the exact regression it is intended to catch remains undetected.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, a whole-file search still found Delete in the component definition and More in the user menu. Fixed in bb1c09b: the check now reads AssistantActionBar and the thread.tsx components it renders, transitively. Removing from the assistant bar now fails it with ['Delete'].

…nders

The check collected tooltips and More-menu labels from all of thread.tsx, so it still
passed if the assistant bar dropped DeleteMessageMenuItem, because the component's own
definition and the user message menu still carried the names. Walk AssistantActionBar
and the thread.tsx components it renders instead.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: bb1c09b7d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit f423a8b into main Oct 5, 2026
@danielhanchen
danielhanchen deleted the ci-studiobench-delete-menu branch October 5, 2026 18:37
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.

1 participant