Skip to content

fix(native-chat): name structured Codex chat tabs from their own session - #17092

Closed
brennanb2025 wants to merge 3 commits into
mainfrom
sta-5861-structured-codex-title
Closed

brennanb2025 wants to merge 3 commits into
mainfrom
sta-5861-structured-codex-title

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​737 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​736
Prod 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​292 $\color{#cf222e}{\Huge{\mathbf{−}}}$​25 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​267

Fixes STA-5861.

ELI5

Every chat with Codex has a name that Codex itself writes down. Orca's older,
terminal-based Codex tabs already read that name and put it on the tab. The new
structured chat tabs never did — every one of them was just called "Codex Chat".
This teaches the new tabs to read the same name from the same place, instead of
inventing a second way to name a tab.

User-facing before / after

Before — every structured Codex chat tab was called the same generic thing.
With three chats open you could not tell which was which without clicking into
each one. Renaming a tab yourself did not stick: the next update from the host
put the generic name back.

After — each tab carries the name of the conversation it holds, and updates
when Codex renames the thread. If you rename a tab yourself, it stays renamed —
the provider name never overwrites yours.

Which pipeline this reuses

The existing AI Vault tab-title / session-name pipeline, unchanged:

agent identity → collectAiVaultTitleRequests → aiVault.resolveSessionTitles (routed to the host that owns the session) → setAiVaultTabTitle → tab.aiVaultTitle → resolveUnifiedTabLabel

That is the same path a terminal-backed Codex tab takes. The only thing
structured chats were missing was the provider session identity in the renderer,
so this adds that and nothing else:

  • Host — RuntimeMobileSessionAgentTab.providerSessionId, a new optional
    wire field carrying the Codex thread the session writes to (the head of the
    record's provider-handle chain, so a fork is never presented as its origin).
    It is identity, not a title.
  • Renderer — the structured chat tab becomes a fourth candidate source for
    collectAiVaultTitleRequests, and setAiVaultTabTitle learns to write the
    unified chat row (structured chats have no terminal tab to carry the name).

Everything else is inherited: precedence (customLabel > … > aiVaultTitle >
generatedLabel > live label), the 20s-while-missing / 5-min-when-named refresh
cadence, execution-host routing for SSH and runtime hosts, and persistence.

Why not publish the resolved title as the tab's label instead? That would
be a second title source, and it also loses a rule: label sits below
generatedLabel in resolveUnifiedTabLabel, so with "Auto-generate tab titles"
on, a generated title would outrank the provider's own session name — the
opposite of what a terminal-backed Codex tab does.

What the acceptance cases needed

  • Create — the chat adopts the provider title as soon as the thread is known.
  • Provider title update — carried by the pipeline's live refresh. No flashing:
    the mirror now preserves the aiVaultTitle and customLabel it used to discard
    on every host snapshot, the store write bails when the name is unchanged, and an
    unnamed tab shows the existing label rather than an empty one, so nothing blanks
    or reflows.
  • Manual rename precedence — unchanged rules; the bug was the mirror resetting
    customLabel: null on every snapshot, which is now preserved.
  • Restart restoration — agentSessionProviderSessionId joins aiVaultTitle
    in the persisted unified-tab schema, so a restored chat shows its name
    immediately and can still refresh it.
  • Multiple simultaneous sessions — titles are matched by
    host \0 agent \0 threadId, so an answer for one thread cannot name another,
    and a thread with no answer keeps its existing name.

Absence is not a title

The host omits providerSessionId until the provider proves a handle, rather
than publishing an empty string. A tab with no proven thread stays on its current
name; when the thread is proven the host republishes the snapshot and the name
lands without waiting for a restart.

Cross-platform / SSH

The title is resolved by the execution host that owns the session
(getExecutionHostIdForWorktree → aiVault.resolveSessionTitles host routing),
so a remote structured chat reads that host's Codex home, not the client's. No
new path handling. The new wire field is Rule 1 (optional): old hosts omit it,
old clients ignore it. docs/reference/remote-wire-compatibility.md records the
addition and the client-owned-name carve-out, since the cross-version harness
does not cover the session-tab sync channel.

Tests

Ten new tests, one per acceptance case plus the identity edges. All nine that can
fail before the change do fail on main; each of the 13 gates was ablated
individually and each reddens at least one test on its own. The one test that is
green before the change is the "publish no identity while unproven" guard — the
field does not exist yet on main, so it cannot fail there; it is pinned by
ablation (stamping ?? '' instead of omitting reddens it).

Gates

pnpm tc clean (both projects). oxlint clean, no suppressions.
node config/scripts/check-changed-code-quality.mjs: 0 new findings across 15
files, React Doctor included. git diff --check clean. Formatted with
npx oxfmt --write on changed paths only.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR extends the existing AI Vault title pipeline to structured Codex chat tabs while preserving client-owned titles across host snapshots.

  • Publishes the current provider-session identity through the optional runtime tab contract.
  • Resolves, refreshes, renders, and persists provider-owned titles for structured chats.
  • Preserves manual labels and AI Vault titles during local and remote snapshot reconciliation.
  • Adds coverage for creation, delayed identity discovery, provider renames, restart restoration, host routing, and multiple sessions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/main/runtime/orca-runtime.ts Projects the current structured-session provider identity into runtime tab snapshots and refreshes it when provider ownership changes.
src/main/ai-vault/session-title-file-reader.ts Falls back to resolving an exact provider transcript when the title cache lacks a transcript path.
src/renderer/src/lib/ai-vault-tab-title-requests.ts Adds host-aware structured-chat requests to the existing AI Vault title collection pipeline.
src/renderer/src/runtime/web-session-tabs-sync.ts Mirrors structured-session identity while preserving client-owned custom and provider titles.
src/renderer/src/store/slices/agent-session-tab-ai-vault-title.ts Adds the unified-tab store update path for structured-session AI Vault titles.
src/shared/workspace-session-schema.ts Persists the optional provider-session identity and resolved title needed for restart restoration.

Sequence Diagram

sequenceDiagram
    participant Codex as Codex session
    participant Host as Execution host
    participant Client as Renderer
    participant Vault as AI Vault title resolver
    participant Store as Unified tab store
    Codex->>Host: Prove provider thread identity
    Host-->>Client: Publish structured tab snapshot
    Client->>Vault: Resolve title by host, agent, and thread
    Vault-->>Client: Return provider session title
    Client->>Store: Set aiVaultTitle
    Store-->>Client: Render resolved tab label
    Note over Client,Store: customLabel remains higher precedence
Loading

Reviews (5): Last reviewed commit: "fix(native-chat): invalidate titles acro..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ded8a5c4-62b9-4d6c-b4d9-c6926531f7cd

📥 Commits

Reviewing files that changed from the base of the PR and between 415d0d2 and e9db810.

📒 Files selected for processing (2)
  • docs/reference/remote-wire-compatibility.md
  • src/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/reference/remote-wire-compatibility.md

Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Structured agent-session tabs now publish proven provider session identifiers and refresh snapshots when identities become available or change. Renderer state persists these identifiers, execution hosts, custom labels, and AI Vault titles during tab mirroring. AI Vault synchronization now includes structured tabs and resolves missing transcript paths. Structured tab rendering uses unified title resolution. Tests cover identity propagation, title refreshes, manual labels, persistence, hydration, refresh timing, and session isolation.

Merge Risk: ⚪ Minimal · up to e9db8

The PR makes structured Codex chat tabs follow their provider conversation names while preserving manual names and restored state. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.16% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 24 files. (2 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: naming structured Codex chat tabs from their own session.
Description check ✅ Passed The description explains the problem, solution, rationale, acceptance cases, compatibility impact, testing, and linked issue. It does not include the required Visual Proof section with screenshots or …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, rationale, acceptance cases, compatibility impact, testing, and linked issue. It does not include the required Visual Proof section with screenshots or videos, and it omits several template headings and checklist items.

Full details: Docstring Coverage

Explanation

Docstring coverage is 13.16% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 24 files. (2 skipped: 1 unsupported, 1 too large.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Structured app-server chat tabs kept the generic "Codex Chat" label while an
equivalent terminal-backed Codex tab picked up the name Codex writes for the
thread, so several open chats were indistinguishable.

Routes structured chats into the existing AI Vault tab-title pipeline rather
than adding a second title source: the host publishes the session's Codex
thread id (`RuntimeMobileSessionAgentTab.providerSessionId`, the head of the
record's provider-handle chain) as identity only, and the renderer's existing
title sync resolves the name against the host that owns the session and writes
it to the same `aiVaultTitle` slot terminal Codex tabs use. Precedence,
refresh cadence, remote host routing and persistence therefore come from the
pipeline unchanged — a manual rename still outranks the provider name, and a
generated title still does not.

Absence stays unknown: the thread id is omitted until the provider proves one,
a late-proven thread reaches clients through a republished snapshot, and the
mirror now preserves the client-owned `customLabel` and `aiVaultTitle` it was
overwriting on every snapshot, which is what made a rename vanish and would
have blinked a named tab back to the generic label.
@brennanb2025
brennanb2025 force-pushed the sta-5861-structured-codex-title branch from 415d0d2 to e9db810 Compare August 30, 2026 02:01
brennanb2025 pushed a commit that referenced this pull request Sep 11, 2026
The chat asks the provider for a title and the AI Vault scanner can read it
back, but nothing displayed it: the vault title pipeline was terminal-only at
both ends. A structured chat is a unified agent-session tab with no TerminalTab
behind it, so it produced no title request and could not be written back to.

Publish the provider conversation id as a new optional field on the
agent-session tab contract, sourced from the head of the record's provider
handle chain so a fork is never presented as its origin, and omitted until the
provider proves one. Teach the collector to treat a chat as a candidate source
under the existing Claude/Codex gate, and the write-back to name the unified
row when no terminal tab owns the id. Persist the conversation id so a restored
chat keeps its name and can still refresh it.

Reuses the mechanism from #17092.
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: superseded. Structured chats (Claude and Codex) will be named by a user-configurable agent from the Chat settings page, stored on the session record, and shown on the tab, the sidebar row and AI Vault from that one field. That work replaces this approach.

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