Skip to content

Move the Codex Goal card into the Codex plugin - #6613

Merged
ymichael merged 4 commits into
mainfrom
bb/clearing-a-codex-goal-on-a-stopped-thread-starts-thr_7csui6fdj4
Nov 6, 2026
Merged

ymichael merged 4 commits into
mainfrom
bb/clearing-a-codex-goal-on-a-stopped-thread-starts-thr_7csui6fdj4

Conversation

@ymichael

@ymichael ymichael commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

A Codex Goal is the Codex plugin's own extension kind, but core drew its UI and tracked it.

  • The Goal card (ThreadGoalCard) was a core component.
  • Core counted goals: it computed activeGoalCount for every thread list, which cost one goal-state query per list.
  • The sidebar showed a Goal glyph that outranked bb's working indicator.
  • The plugin was locked out: it had no way to read its own extension state from its app, so it couldn't draw any of this itself.

This is phase 1 of moving goal into the plugin. Phases 2 and 3 cover the clear-goal plumbing and the timeline's typed goal field.

What changed

New plugin APIs (experimental, with docs/api_to_audit.md entries)

  • experimental_useThreadExtensionState(threadId, kind) returns the latest state the calling plugin's bridge emitted for one of its own declared kinds, or null. Its source is a new extensionStates field in the timeline window, which the existing timeline push already diffs and delivers:
    • the server fills it on the latest timeline page with the latest state of each kind the thread's provider declares with a state schema;
    • older stored goal events decode into the same shape.
  • experimental_CollapsibleStackCard is bb's collapsible card for the stack above the composer. Props are label, title, icon, active or muted, an optional async dismiss (bb shows the spinner and an error toast), and the body. bb's Plan mode card renders through it, so core and plugins draw the card the same way.

Codex plugin

  • Shows the Goal card as a thread-scoped composer banner (chrome: "bare"), the same pattern the Workflows plugin uses.
  • Reads its state with the new hook and clears through useSdk().threads.clearGoal.
  • Shows "Goal", "Goal paused", "Goal blocked" or "Goal usage limited", with the objective, token usage and time.

Core

  • Deletes ThreadGoalCard (with its test and stories), the core Goal clear mutation and its optimistic cache update.
  • Removes the goal sidebar indicator, as decided: goal threads show the normal working indicator.
  • Removes ThreadActivityState.activeGoalCount from the thread list API, and with it the per-list goal-state query.
  • Removes the timeline response's typed goal field, its per-build Goal query and the ThreadTimelineGoal schema; nothing reads it now that the card uses extensionStates. The clear-Goal route only checks whether the latest Goal state is non-null.
  • For plugins:
    • goals leaves the PluginSidebarThreadActivity type, but the host still sends goals: 0 at runtime, so already-built plugins that read it keep running;
    • "goal" leaves PluginSidebarThreadIndicator;
    • the bundled thread-list plugin drops its copy of the goal indicator logic.
  • ThreadPromptModeCard now uses the shared component, owns its expanded state and takes an async onExitPlanMode.
  • Plugin composer banners no longer render on threads without a composer (archived, or environment gone), matching where core hid its own Goal card.

Other

  • Plugin SDK bumped to 0.6.128.
  • No HOST_DAEMON_PROTOCOL_VERSION change.
  • The Plugin Guide surfaces, plugin-authoring references (including the new frontend-collapsible-stack-card.md) and docs/provider-plugin-api.md are updated.

Visible differences

  • Sidebar: goal threads no longer show the Target glyph.
  • Card position: the Goal card sits with the other plugin banners at the top of the composer stack, instead of just below the Plan card. That only shows when another stacked card is present at the same time.
  • Accessible names: the Plan card's label changes from "Prompt mode" to "Plan", and its controls from "Plan mode controls" to "Plan controls". It looks the same.

How you verified

Tests

  • Codex goal-card.test.tsx:
    • paused and active cards with usage, clearing through the SDK;
    • no card for complete, budget-limited, cleared or malformed state.
  • ThreadPromptModeCard.test.tsx, covering the shared component: expansion, a pending dismiss staying disabled, and a failed dismiss showing the toast and re-enabling the button.
  • A server test that the timeline serves the Codex goal state in extensionStates. It fails without the server change.
  • Sidebar, thread-list and activity tests updated for the removed indicator.

Commands

  • pnpm exec turbo run typecheck lint --filter='...[origin/main]': 153/153, after rebasing on current main.
  • turbo run test passes, run on the commit before the final rebase:
Suite Test files passed
@bb/app 644
@bb/server 365
@bb/cli 75
@bb/domain 43
Codex plugin 45
thread-list plugin 38
@get-bb/plugin-sdk 34
@bb/thread-view 32
@bb/client-core 25
Plugin Guide 12
@bb/server-contract 7
@bb/demo-server 2
  • After the rebase I re-ran the SDK, Codex, thread-list, Plugin Guide and client-core suites, plus the server doc, skill and banner tests. All pass.

Manual, real app (pnpm start:worktree, Codex 0.164, gpt-6-luna, headless browser and source bb CLI)

Check Result
Running goal thread Plugin-drawn "Goal" card, same look as the old core card; expanded body shows the objective, tokens and time with correct styles
Sidebar Running goal thread shows the normal working spinner
Stop Card shows "Goal paused" in the muted style
✕ on the paused card Goal cleared through the plugin's SDK call: events go paused → null, no turn, files unchanged (15 → 15)
Plan mode (--plan) Plan card renders through the shared component, expands to the prompt, and "Exit plan mode" ends the plan turn

🤖 Generated with Claude Code

AGENT GENERATED

ymichael added a commit that referenced this pull request Oct 30, 2026
#6684)

## Human comments

## What was wrong

Since #6143, the GitHub PR Status plugin saves a link from each
environment to its PR and re-reads that URL on later loads. It only
looks up the branch again when the branch name changes. When a PR merged
and the thread opened a second PR from the same branch, the environment
stayed linked to the merged PR forever. For example, a thread whose
branch carried merged #6596 and then open #6613 kept showing #6596.
Before #6143 every load ran `gh pr view` on the current branch, which
prefers an open PR.

## What changed

- `plugins/github-pr-status/store.ts`: adds `isSettled(environmentId)`,
which says whether the environment's linked PR is merged or closed.
`staleAfterMs` now uses it.
- `plugins/github-pr-status/server.ts`: `prepareLoad` looks up the
branch (`url: null`) instead of reading the saved URL when the linked PR
is settled, just as it already does after a branch change. The branch
lookup prefers an open PR and otherwise returns the same settled PR, so
this takes one GitHub request per load, not two.

There are no wire, CLI or SDK changes.

Performance, measured against GitHub on the affected branch: a settled
link's reload goes from a URL read (~760 ms, 1 rate-limit point) to a
branch read (~990 ms, 3 points). Settled PRs are never polled. They
reload only when a viewer sees one over an hour old, when a CLI read
finds one more than 10 s old, on push, or after a turn that ran `gh`.
App viewers are served the cached row immediately and refreshed in the
background.

## How you verified

- A new `server.test.ts` case checks that a link to a merged PR switches
to the branch's newer open PR, with exactly one host read per load. It
fails before this change and passes after.
- `pnpm exec turbo run test typecheck lint
--filter=bb-plugin-bb--github-pr-status` passes (182 tests).
- On the real affected branch, the GitHub branch lookup returns #6613
(open) ahead of #6596 (merged).

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
@dillonzq

dillonzq commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

@ymichael Thanks for this! The PR currently has merge conflicts with main — could you rebase it when you get a chance? We'd love to see it land soon.

The new APIs unblock more than the Codex Goal card:

  • experimental_useThreadExtensionState(threadId, kind) gives a provider plugin a supported way to read the latest extension.state snapshot its own bridge emitted. Today the only extension state with a UI is the Codex goal, and that only works because core special-cases LEGACY_CODEX_GOAL_EXTENSION_KIND. With this hook, any provider can declare a state kind and render it from its own app bundle, without adding another core special case or a new wire field.
  • experimental_CollapsibleStackCard lets plugin cards in the stack above the composer look and behave like bb's own Plan mode card, instead of each plugin building its own.

A concrete follow-up this would enable: provider-pi currently drops Pi's fire-and-forget extension UI (notify, setStatus, setWidget). #3228 left these as follow-ups, and #2446/#2447 tried to carry them through new core plumbing before they were auto-closed as stale. With this PR, provider-pi could publish Pi extension statuses and widgets as its own state kind and render them above the composer, with changes only in the plugin.

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/clearing-a-codex-goal-on-a-stopped-thread-starts-thr_7csui6fdj4 branch 2 times, most recently from c613efa to 17425c8 Compare November 6, 2026 00:05
ymichael and others added 4 commits November 6, 2026 09:21
Core drew the Codex Goal card, counted active Goals per thread, and
showed a Goal glyph in the sidebar, although a Goal is a Codex extension
kind. The Codex plugin now draws its own card, and core stops tracking
Goals.

- experimental_useThreadExtensionState(threadId, kind) reads the latest
  state a plugin's bridge emitted for one of its declared extension
  kinds. The timeline's new extensionStates field carries the latest
  state of each kind the thread's provider declares.
- experimental_CollapsibleStackCard is bb's collapsible stack card, with
  an async dismiss that shows bb's spinner and error toast. bb's Plan
  mode card renders through it.
- The Codex plugin shows its Goal card as a thread-scoped composer
  banner that renders that component, and clears through
  useSdk().threads.clearGoal.
- Core deletes its Goal card, the goal sidebar indicator, and
  activeGoalCount. PluginSidebarThreadActivity.goals is deprecated and
  always 0; the thread-list plugin drops its copy of the Goal indicator.

Plugin SDK 0.6.128.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Core hid the Goal card on archived threads and threads whose environment
is gone, because those threads have no composer. Now that the Codex
plugin draws the card as a composer banner, the stack-only prompt box
still mounted plugin banners, so the Goal card and its clear button
showed under "Thread is archived". The stack-only box no longer mounts
plugin composer banners.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PluginSidebarThreadActivity no longer declares goals. The host still
sends goals: 0 in every thread's activity, so already-built plugins that
read it keep running.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Nothing reads the timeline response's goal field since the Codex plugin
draws its card from extensionStates, yet every latest-page build ran a
dedicated query to fill it. The field, its query, the thread-view
extractor and the ThreadTimelineGoal schema are gone. The clear-Goal
route now only asks whether the latest Goal state is non-null.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael force-pushed the bb/clearing-a-codex-goal-on-a-stopped-thread-starts-thr_7csui6fdj4 branch from 4bf21d2 to 53c393e Compare November 6, 2026 17:24
@ymichael
ymichael merged commit 14b3293 into main Nov 6, 2026
51 checks passed
@ymichael
ymichael deleted the bb/clearing-a-codex-goal-on-a-stopped-thread-starts-thr_7csui6fdj4 branch November 6, 2026 17:37
salemsayed added a commit to salemsayed/bb-plugin-radar-sidebar that referenced this pull request Nov 7, 2026
…ved Codex goals into the Codex plugin, get-bb/bb#6613) still shows threads with background work as running

On 0.49 the sidebar thread activity has no goals field; the old sum became NaN and isRunningThread returned false for an idle thread with a running background command, agent, workflow or plan mode. Works on 0.48.2 (goals present) and 0.49 (absent).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gpambrozio added a commit to gpambrozio/bb-menubar that referenced this pull request Nov 13, 2026
…an offline machine (#4)

* fix(pairing): point machine codes at Settings → Mobile

bb 0.45 (get-bb/bb#4513) removed the `mobileApp` experiment and moved
"Add mobile device" from Settings → Remote access to Settings → Mobile.
The pairing window and the README still told the user to run
`bb settings experiment mobileApp true`, which bb 0.49 rejects with
"Unknown experiment 'mobileApp'". Keep the plain `bb connect
machine-code` and amend the remote design's quoted copy to match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* feat(core): re-pin to bb 0.49.0 and mark threads waiting on an offline machine

Since bb 0.45 (get-bb/bb#4271) a thread whose machine goes offline keeps
`status: "active"` until it reconnects, and bb reports
`runtime.displayStatus: "waiting-for-host"` for it. bb Icon read only
`status`, so a turn on a sleeping laptop spun the Working glyph all night
while bb itself showed nothing running.

- Decode `runtime.displayStatus` leniently: absent or unknown changes
  nothing.
- Such a thread stays in Working (it resumes when the machine is back),
  and its row says `machine offline`.
- It no longer draws the Working glyph by itself. Following bb 0.49.0's
  `RUNNING_RUNTIME_STATUSES`, `waiting-for-host` is not running, while
  background activity still is. Working draws the glyph only while one of
  its threads, past the cap included, runs now.
- Drop `activity.activeGoalCount`, which bb 0.49 removed
  (get-bb/bb#6613).
- Bring the thread page and the one thread-carrying /ws frame to 0.49.0's
  shape, checked against this Mac's bb 0.49.0 with GET requests only.
- Move the "pinned to bb 0.44.0" citations to 0.49.0 where 0.49.0 was
  checked, and amend the design spec's bucket rule 4, icon rule, and menu
  rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chore(release): 0.2.0

Bump the version (package.json feeds the bundle's
CFBundleShortVersionString and CFBundleVersion), date the changelog
entry, and point the README's download and AGENTS.md's release note at
v0.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: marvin-ambrozio <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

2 participants