Skip to content

Nest workers and subagents under their lead on Desktop and Mobile - #410

Queued
n0rpan wants to merge 8 commits into
mainfrom
feat/host-worker-hierarchy
Queued

n0rpan wants to merge 8 commits into
mainfrom
feat/host-worker-hierarchy

Conversation

@n0rpan

@n0rpan n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Make lead/orchestrator conversations unmistakably distinct from the workers and subagents they spawn on both OX Desktop and OX Mobile, while preserving full direct technical availability for every worker and subagent.

Designs evaluated

  1. Strict master-detail drawer (hide workers from lists): Keeps lists cleanest, but hurts direct 1-tap triage for waiting/failing workers and makes orphaned or linked-host workers harder to reach.
  2. Flat lists with muted role tags: Preserves 1-tap access, but workers still flood the top of chronological lists and bury the lead conversation.
  3. Lead-First Tree + subordinate branch chrome + one-tap Back-to-Lead (implemented): Combines clean lead scanning with full 1-tap worker availability:
    • Workers and subagents nest physically under their lead and fold by default under an inline clickable branch summary (▸ 3 · 1 live, ▸ 2 · 1 needs).
    • Branches auto-expand when a worker needs approval (Needs you), when a descendant is selected (Desktop), or when searching/filtering — keeping the lead row visible as a parent anchor even when the lead itself is idle waiting on its running/waiting worker.
    • Worker/subagent rows use recessed surfaces, vertical tree rails, Cartridge::Worker, calmer subordinate typography, and WKR/SUB or WORKER #N/SUBAGENT badges so they never look like peer leads (including in Timeline mode, pinned/orphaned states, and linked hosts).
    • Inside any worker or subagent conversation (including native subagents), a prominent ← Back to lead · <Title> control returns straight to the lead.

Summary of changes

  • OX Desktop (desktop/ox-desktop)
    • src/kit/mod.rs: Added SubordinateKind, BranchBadge, recessed worker row styling, continuous/elbow vertical tree rails, lead vs. subordinate ink/type hierarchy, and inline clickable branch pills.
    • src/views/host/discovery.rs & src/views/host.rs: Replaced collapsed: HashSet with default-collapsed fold_overrides (branch_expanded), rolled descendant latest_activity and total descendants onto leads, kept lead anchors when filtering (is:running, is:waiting, search), recorded ParentLink for native subagents, and added is_last_child rail geometry.
    • src/views/workbench/worker.rs: Upgraded worker_crumb to a subordinate context bar with a clear ← Back to lead button for both OX workers and native subagents; included native subagents in workers_line.
    • src/views/host/palette.rs: Labeled threads clearly as Lead, Worker under <Lead>, or Subagent under <Lead>.
  • OX Mobile (desktop/ox-mobile)
    • src/session_tree.rs: New pure, host-testable hierarchy engine classifying leads (including handoffs), OX workers, and native subagents; resolving cross-route/cross-checkout parents; protecting against cycles; rolling up urgency/timestamps; keeping lead anchors under filters; and resolving Back to lead destinations.
    • src/catalog.rs & src/catalog_rows.rs: Switched Activity to the hierarchical Lead-First Tree with >= 44pt inline branch toggle bars on leads and indented recessed worker/subagent cards on a 3px semantic left rail; added title_for and host_children_of.
    • src/mobile.rs: Applied the same Lead-First Tree to sessions_screen; added Cartridge::Worker, WORKER #N/SUBAGENT eyebrow, and a >= 44pt ← Back to lead · <Title> button in conversation (supporting both same-scope and cross-scope host navigation); expanded Workers (N) and linked_workers_screen to cover native subagents and cross-scope host workers alongside same-scope and linked-host workers.
    • src/defined_projects.rs & src/mobile/projects_view.rs: Classified Home recent sessions and styled unassigned workers as subordinate rows without project-creation buttons.

Verification

  • Checked against origin/main at 805f7dec (PR Let hosted OX sessions message local peers #351 only touched transcript rendering; no overlap).
  • Local Linux checks passed:
    • cargo fmt --all -- --check and cargo fmt --manifest-path desktop/Cargo.toml --all -- --check
    • cargo clippy --manifest-path desktop/Cargo.toml --locked -p ox-desktop -p ox-mobile --all-targets -- -D warnings
    • cargo test --manifest-path desktop/Cargo.toml --locked -p ox-desktop -p ox-mobile (167 ox-desktop unit tests + 389+ ox-mobile unit & Android integration tests passed)
    • python3 -m unittest discover -s desktop/ci -p 'test_*.py' (63 passed)
  • Not verified locally: iOS, Android, and macOS target compilation/simulator runs (exercised by CI on this PR).

The December 3 catalog fix keeps the host watch active in Conversation and Linked Workers. The cached count follows the catalog revision and the existing selected-conversation invalidation. The iOS simulator fixture opens a conversation with one catalog child, then tests removal and reappearance without a selected-scope update. Checked against main 66f53176e896ad64009e97e052cd7885d6775f2f. Local root, mobile, installer and CI-script checks passed. The simulator assertion runs in the unsigned iOS launch job.

Desktop also refreshes its host index when a standalone approval changes the set of waiting threads. The regression test applies an asks-only delta to a real store, observes that its catalog revision stays constant, and verifies that adding and clearing the ask changes the index signature. On the tree integrated with #398 at main 545fc974, 191 Desktop and 396 mobile library tests passed. The iOS simulator job exercised the Conversation catalog-count regression on 576f944b.

Back to lead now resolves an older lead through the paired host’s paginated session history when the destination store’s first page omits it. The phone matches the project, route, and session ID before sending the discovered row to the host. The regression test exercises a replica that refuses a plain selection for this ID and accepts the discovered row from the matching scope. Tested after integrating main at 373f8c9a.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T21:51:27.762640Z c05b568 Draft marked ready
🔒 Security Review ✅ Completed 2026-12-03T21:51:13.394283Z c05b568 Draft marked ready
ℹ️ 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.

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Please coordinate the new mobile tree with #398’s Home → Needs approval shortcut. #398 counts waiting session IDs with visible catalog rows; #410 can keep a waiting worker under a lead the user explicitly collapsed. A combined regression should start with a collapsed lead and one waiting child, tap the Home shortcut, and confirm the actual worker is reachable in Needs approval. The idle lead can be an anchor, but it should not count as a second pending conversation or replace the worker as the action target.

@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: c0bcf171d0

ℹ️ 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 thread desktop/ox-mobile/src/catalog.rs Resolved
Comment thread desktop/ox-mobile/src/mobile.rs Resolved
@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Coordinated with #398 in 148a899a:

  • When Activity enters Filter::NeedsApproval (filtering = true, as Home's shortcut does), FoldState::is_expanded overrides any explicit user collapse on the lead so the waiting worker is emitted and directly tappable underneath its idle lead anchor.
  • TreeCounts::matched tracks only direct filter matches (excluding idle parent anchors), and the Activity section heading now shows NEEDS APPROVAL · <matched> so the idle lead anchor never counts as a second pending conversation and does not receive a NEEDS YOU badge while expanded.
  • Added explicitly_collapsed_lead_still_reveals_waiting_worker_in_needs_approval_without_double_counting in desktop/ox-mobile/src/session_tree.rs.

Note on the previous run (47169835703 on c0bcf17): all Desktop, Android, iOS build/simulator, and Linux/macOS ARM legs passed; the sole failure was in Native process and host tests (macos-26-intel) on update::standalone::tests::rejected_staged_binary_preserves_installation_and_clears_record (src/update/standalone.rs:166), which is outside the files touched by this PR.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue 148a899

@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

In line to merge. Commit c05b568 is reviewed with nothing blocking; it has entered the merge queue.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

Asked for by the maintainer’s queue request, for commit 148a899.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 148a899af0

ℹ️ 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".

@n0rpan
n0rpan enabled auto-merge December 3, 2026 18:44
@n0rpan
n0rpan marked this pull request as draft December 3, 2026 19:04
auto-merge was automatically disabled December 3, 2026 19:04

Pull request was converted to draft

@n0rpan
n0rpan marked this pull request as ready for review December 3, 2026 19:04

@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: 148a899af0

ℹ️ 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 thread desktop/ox-mobile/src/mobile.rs Resolved
@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
Any commits made after this event will not be merged.
@n0rpan
n0rpan removed this pull request from the merge queue due to a manual request Dec 3, 2026

@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: 576f944b55

ℹ️ 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".

@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: bbbda65d39

ℹ️ 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 thread desktop/ox-mobile/src/mobile.rs Resolved
@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

/queue c05b568

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex security review

Asked for by the maintainer’s queue request, for commit c05b568.

@n0rpan
n0rpan marked this pull request as draft December 3, 2026 21:48
@n0rpan
n0rpan marked this pull request as ready for review December 3, 2026 21:48
@n0rpan
n0rpan added this pull request to the merge queue Dec 3, 2026
Any commits made after this event will not be merged.
@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

GitHub marked this queue entry unmergeable behind #426. I reproduced the five file conflicts against its integrated candidate 7faf9e7b. The reconciled tree retains the Project Hub and Conversation catalog watches, opens a session only while the initiating screen is still in front, and applies multi-field search while retaining matching workers’ ancestor rows. Desktop command palette rows keep both the worker/lead label and #426’s route and status information.

The combined run passed 197 Desktop tests, 417 mobile library tests, 46 mobile integration tests, and Clippy. I’ll apply the reconciliation against landed main when #426 reaches it, then request review and admission for the resulting commit.

@n0rpan

n0rpan commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

The #410 and #428 conversation headers conflict. I tested the catalog-only child and return navigation on the combined heads. The failing and passing touch paths and the exact reconciliation are in the #428 simulator result. Please keep ownership of #410’s branch and queue follow-up.

@n0rpan

n0rpan commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

#426’s new head is behind this PR in the admission process. This head merges cleanly with the current predecessor candidate for #391 (d7c41a07); its earlier five conflicts came from the previous #426 candidate.

For whichever change lands second, I tested #426’s 0624fd71 on the reconciled tree. It makes the replica catalog revision advance on asks-only deltas, so #410’s regression correctly caught an obsolete assumption: it observed revision 1 where the old test expected 0. Both local and remote Desktop panes subscribe through a replica. With both changes present, the index can use the pane’s catalog revision directly and drop the separate waiting-thread signature. I verified that adding an ask increments the revision and exposes the worker, clearing it increments the revision again and empties the waiting list, and no session row is required. The combined suites and Clippy passed. Desktop window check on the combined tree

This branch has not been deployed

No deployments
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