Skip to content

base red: arch app_lines, move #30002's and #31033's app logic into their packages - #31456

Merged
lawrencecchen merged 2 commits into
feat-cmux-nextfrom
fix/base-red-arch-30002-31033-b
Nov 2, 2026
Merged

lawrencecchen merged 2 commits into
feat-cmux-nextfrom
fix/base-red-arch-30002-31033-b

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #30002
Fixes #31033

Summary

Replaces #31441, closed: this is the same tree as #31441's head 9878749 except that one call in AgentTabs.swift keeps its four lines. #31441 had joined it to three, a line join the lead asked to undo. The VM's git guard refuses a force push, so the squashed commit goes on a new branch.

Base red (priority zero): the arch ratchet refuses the feat-cmux-next tip (2640ee3) with [app_lines] CmuxNextApp +282 against the last green arch tip cf0a547. The two largest contributors are #30002 (Cloud chat repick, +131) and #31033 (an existing chat adopts the prewarmed page, +127); then #31353 (+29), #31363 (+22) and #31316 (+21).

This change moves logic that holds no app state out of CmuxNextApp into the package that owns its domain. The App calls the same logic through a public API, and only wiring stays in the App. Behavior does not change. No new package edge and no new target.

Move From CmuxNextApp To App lines
#31033: the adoption decision, the spare's readiness (servesExistingChat), the refusal reason, the trace outcome, the pool's slot and refill policy AgentTabs+SpareSession.swift (deleted), AgentTabs+Lifecycle.swift, AgentTabs.swift, NewTab/NewTabSparePool.swift CmuxNextAgentPane/AgentPaneSpareAdoption.swift (AgentPaneSpareAdoption, AgentPaneSpareReadiness, AgentPaneModel.servesExistingChat, AgentPaneModel.spareRefusal, AgentPaneSpareOutcome, AgentPaneSpareSlot, AgentPaneSpareRefill) -90
#30002: the started-chat record and the picked-machine match Cloud/CloudStartChat+Repick.swift CmuxNextAgentPane/AgentPaneCloudRepick+Machine.swift (AgentPaneCloudStarted, AgentPaneCloudRepick.machineID(in:)), next to AgentPaneCloudStart and AgentPaneCloudRepick -19
#31363: four methods that only forwarded to TerminalCommandSuggestionStore History/CommandHistory.swift CommandHistory.suggestions exposes the CmuxNextHistory store -16
#31316: the feed handoff driver and its wire shape Feed/FeedHandoffDriver.swift, Feed/FeedHandoffWire.swift CmuxNextAgentPane/Approvals/, next to FeedHandoffPolicy, which the driver already used ("Pure, so the driver decides the same way") -414

Total: app_lines -257 against cf0a547 (-539 against the tip).

What stays in the App, and why:

The pure tests move with their code: whichSpareServesAChat and theDecision to AgentPaneSpareAdoptionTests, and aRepickFindsThePickedMachineByIdOrByName to AgentPaneCloudStartTests. The tests that drive the tab store end to end stay in SpareSessionAdoptionTests.

ChatOpenTrace.swift (owner: Performance Lead) changes one comment: it named the old NewTabSparePool.servesChat.

Testing

  • python3 scripts/cmux-next/arch-ratchet.py --base cf0a547fc499 at this head: app_lines -257 (CmuxNextApp -257), no architecture count rises.
  • python3 scripts/cmux-next/prepush-gate.py: no new violations (only warning: the owner note for ChatOpenTrace.swift).
  • ./scripts/lint-ios-package-conventions.sh --namespace-fix on the changed files: no namespace findings and no fixes. Its one ERROR is the existing ChatOpenTrace.shared singleton, base debt in a file where this change edits only a comment.
  • python3 scripts/ci/risk_tier.py classify: normal.
  • Fleet compile at 9878749 (base red: arch app_lines, move #30002's and #31033's app logic into their packages #31441's head; this head differs only in the line breaks of one call in AgentTabs.swift): job ec567ba5179ef3d3feedea01, CmuxNext passed (333 s), app passed (51 s), cmux-tui passed (12 s).
  • Fleet suites at 9878749 (diff to this head: whitespace in one call only), job f7b2e07dab01043c87e85830 on aws-m4pro-3, all 8 passed, every one with tests executed: AgentPaneSpareAdoptionTests (2 tests), AgentPaneCloudStartTests (12), SpareSessionAdoptionTests (5), CloudStartChatMachineTests (10), IncognitoFeedHandoffTests (6), TerminalCommandSuggestionTests (3), NativeNewTabSpareTests (2), NewTabPrewarmStallTests (2).
  • Reviews: SHIP at 9878749 (full review, on base red: arch app_lines, move #30002's and #31033's app logic into their packages #31441) and SHIP at c5de0af (the whitespace delta, in a comment here).

Observed / Not run

  • Observed: the arch ratchet, the prepush gate, the namespace lint and the risk classifier at this head, on the VM; the fleet compile and the 8 suites above at 9878749.
  • Not run: the compile and suites at this exact head; they ran at 9878749, whose diff to this head is whitespace in one call (git diff 9878749ebfe2 c5de0af806ff). No build or test on the VM (fleet only). There is no tagged build: this change is behavior-neutral.

Changelog

none

Takes back #31363: only its four forwarding methods in CommandHistory.swift; CommandHistory now exposes its suggestion store directly, so callers reach the same store with no behavior change (an app_lines move, not a revert of #31363's feature).

…heir packages

The arch ratchet refused feat-cmux-next's tip with [app_lines] CmuxNextApp +282
against the last green arch tip cf0a547. This moves logic that holds no app
state out of CmuxNextApp, behavior-neutral, and leaves the wiring in the App:

- #31033 (spare page adopts an existing chat) to CmuxNextAgentPane: the adoption
  decision (AgentPaneSpareAdoption), the spare's readiness (AgentPaneSpareReadiness,
  AgentPaneModel.servesExistingChat), the refusal reason (AgentPaneModel.spareRefusal),
  the trace outcome (AgentPaneSpareOutcome), the pool's slot (AgentPaneSpareSlot) and
  refill policy (AgentPaneSpareRefill).
- #30002 (Cloud chat repick) to CmuxNextAgentPane, next to AgentPaneCloudStart and
  AgentPaneCloudRepick: the started-chat record (AgentPaneCloudStarted) and the
  picked-machine match (AgentPaneCloudRepick.machineID(in:)).
- #31363: CommandHistory exposes its TerminalCommandSuggestionStore (CmuxNextHistory)
  instead of four forwarding methods.
- #31316: the feed handoff driver and its wire shape (FeedHandoffDriver,
  FeedHandoffWire) to CmuxNextAgentPane/Approvals, next to FeedHandoffPolicy,
  which it already depends on.

The pure tests move with their code (AgentPaneSpareAdoptionTests,
AgentPaneCloudStartTests). No new package edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lawrencecchen lawrencecchen added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 1, 2026
@cursor

cursor Bot commented Nov 1, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review c5de0af: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr31456 -f ref=fix/base-red-arch-30002-31033-b -f platform=macos -f backend_mode=local

red: cmux-next checks (god files, concurrency, crash safety, l10n); no finished base run on 1d6ff66 to compare; do not merge until green; see lane-rules

Shipped in:

The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/41367464867 at 0d19fe6 failed: cmux-next daemon tests.
Those jobs last passed at 4285627. This pull request is one of 2 merged since: #31456, #31484.
If the failure is in your change, fix forward on feat-cmux-next. Pull requests run only the tiers their paths reach (docs/ci/cmux-next-tiers.md); label a batch PR full-ci to run them all before merging.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Review (subagent, correctness first): SHIP at c5de0af

  • Diff from 9878749 (base red: arch app_lines, move #30002's and #31033's app logic into their packages #31441's reviewed head): one file, Packages/macOS/CmuxNext/Sources/CmuxNextApp/AgentTabs.swift, +2/-1, line breaks in one call only. .adopted(chiefKeeps: chiefKeepsSession), moves from the end of the AgentPaneSpareAdoption(...) initializer line to its own line after it. No token changes. Swift parses the leading . as a member call on the same initializer value. The trailing comma still ends the if let session = … clause, and the let spare = takeConnectedSpare?(), adoptSpare(...) clause does not change. No semantic change.
  • c5de0af is one commit on parent 2640ee3, the same feat tip as 9878749.
  • The full independent review of 9878749 on base red: arch app_lines, move #30002's and #31033's app logic into their packages #31441 (SHIP) carries over unchanged. This includes its explicit confirmation that FeedHandoffDriver and FeedHandoffWire hold no app state and call no app services: every identifier comes from Foundation, CryptoKit, CmuxNextDaemon, CmuxNextCloud or CmuxNextAgentPane, or from closures injected at init.
  • python3 scripts/cmux-next/arch-ratchet.py --base cf0a547fc499 at c5de0af: app_lines -257 (CmuxNextApp -257), no architecture count rises.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Fleet suites: all 8 passed (job f7b2e07dab01043c87e85830, aws-m4pro-3) at 9878749, whose diff to this head c5de0af is whitespace in one call of AgentTabs.swift only (the undone line join): AgentPaneSpareAdoptionTests 2, AgentPaneCloudStartTests 12, SpareSessionAdoptionTests 5, CloudStartChatMachineTests 10, IncognitoFeedHandoffTests 6, TerminalCommandSuggestionTests 3, NativeNewTabSpareTests 2, NewTabPrewarmStallTests 2 tests executed. Compile at 9878749: job ec567ba5179ef3d3feedea01 (CmuxNext, app, cmux-tui passed).

@lawrencecchen lawrencecchen added the ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds label Nov 1, 2026
@blacksmith-sh

blacksmith-sh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Found 8 test failures on Blacksmith runners:

Failures

Test View Logs
/tmp/tmp06d7g88n/summary-fail.json (live):/summary-fail.json (live): View Logs
/tmp/tmp8nj0fqo2/summary-missing.json (live):/summary-missing.json (live): View Logs
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows/
[new_workspaces] debug.new_workspace timed 0 of 50 new workspace rows
View Logs
[new_workspaces] the window draws no frames/[new_workspaces] the window draws no frames View Logs
[tabs] debug.tab_switch timed 0 of 40 switches/
[tabs] debug.tab_switch timed 0 of 40 switches
View Logs
[tabs] the window draws no frames/[tabs] the window draws no frames View Logs
imported web bundle inputs are not routed:/imported web bundle inputs are not routed: View Logs
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)/
test_every_part_of_bun_run_check_runs_in_the_warn_branch (main.WebviewsWarnSplitCov
ersCheck.test_every_part_of_bun_run_check_runs_in_the_warn_branch)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 23:54 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 23:54 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 1, 2026 23:55 Inactive
@lawrencecchen
lawrencecchen merged commit c0b3866 into feat-cmux-next Nov 2, 2026
148 of 157 checks passed
@lawrencecchen
lawrencecchen deleted the fix/base-red-arch-30002-31033-b branch November 2, 2026 00:21

This branch was previously deployed

1 inactive deployment
ci-routing-agent — c695756a Deployed Nov 1, 2026 by cmux-bot[bot] via wait for same-key tree publisher #97915
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant