Skip to content

fix(first-run): keep the chosen harness and guide a multi-model save - #560

Open
Zhangbo-cn wants to merge 5 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/first-run-harness-and-guidance
Open

Zhangbo-cn wants to merge 5 commits into
ThinkFlowLab:mainfrom
Zhangbo-cn:fix/first-run-harness-and-guidance

Conversation

@Zhangbo-cn

@Zhangbo-cn Zhangbo-cn commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes two first-run setup defects and two follow-up findings from the first review round:

  • [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556 — saving a language model silently reset the chosen harness. Choosing Codex (or another existing harness), going back, and then adding a language model wrote runtime: "default" back to the draft, so chat ran on Default instead of the harness the user had just picked. The draft save also validated the harness status of the wrong runtime.
  • [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559 — a multi-model save had no guidance to step 2. Saving two or more language models jumped to the model list without saying that a choice was still required, without marking which rows were just added, and without moving focus to the first new row.
  • Editing an existing service looked like a new-model save. The language-model form reports every saved model to the welcome screen, so after "Edit service" the Added-N hint and the New · pick to continue markers appeared even though the user had not added anything. finishModelSetup now receives the edit flag and returns to the neutral language list after an edit.
  • A single-model edit auto-advanced to step 2. The same edit path still ran the "one usable model, connect it" branch before the edit check, which both skipped the neutral list and overwrote the agent selection the user had made earlier. The edit check now runs first and clears the added-model guidance.

Linked issue

  • Fixes #556
  • Fixes #559

Labels

  • type:bug, area:canvas, area:harness, area:i18n

Test plan

  • Local, at head 1d429709:
    • node tests/browser/first_run.mjs against an isolated fixture API with a Vite dev server and again against the production build (vite build + vite preview, the previewSafe manifest entry): passed. Journeys cover [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556 (pick Codex → Back → save one language model → draft runtime is still codex, modelSelections.agent updated; explicit OpenCode pick switches the runtime; an unavailable kept harness reports the assistant-unavailable alert and leaves the draft on codex), the default runtime on a fresh project, and [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559 (save two language models → hint and New · pick to continue markers shown → agent selection unchanged → pick a new row → step 2).
    • node tests/browser/first_run_added_models.mjs (new gate test) on the same dev server and production build: passed. It isolates the multi-model guidance (hint text, two markers, focus on the first added id, unchanged-then-updated modelSelections.agent) and three edit paths: a paused saved service → "Edit service" → save → no hint and no markers; an edit after a fresh multi-model save clears the stale hint and markers; a single saved service edit stays on the language list and keeps the previously picked modelSelections.agent.
    • npm test: 1113 passed, 0 failed.
    • npm run check:i18n: 3857 keys, 0 problems.
    • npm run check:browser-locale: 103 pages, 0 problems.
    • npm run check:browser-manifest: OK, 111 entries.
    • tsc --noEmit: clean.
  • Failing-before: the current test files were run against the base revision 83b142f0, built from source (vite build + vite preview) with the isolated fixture. Because these test files are introduced by this PR, the current versions were copied into a clean 83b142f0 worktree; nothing else in that worktree was changed.
    • first_run.mjs fails at tests/browser/first_run.mjs:212 with AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: 'default' !== 'codex'.
    • first_run_added_models.mjs fails at tests/browser/first_run_added_models.mjs:98, waiting for the "Added 2 language models..." hint that the base does not render.
    • On the previous head 4a9e43c5, first_run_added_models.mjs fails at tests/browser/first_run_added_models.mjs:128 with Expected values to be strictly equal: 1 !== 0 (the Added-N hint is present after an edit).
    • On the previous head a5a2c176, the extended first_run_added_models.mjs (applied to that worktree, served by the Vite dev server with the isolated fixture) fails at line 160 with Expected values to be strictly equal: 1 !== 0 (the stale hint survives an edit). A probe script reproduced both defects on the same SHA: after editing the paused service staleHint was 1 and staleMarkers was 2; after editing the single paused service the wizard advanced (advanced 1, stayed 0) and modelSelections.agent changed from 059ad3d6… to cc68fcde…. The logs and screenshots are in the evidence below; at 1d429709 the same probe reports staleHint 0, staleMarkers 0, advanced 0, stayed 1, and an unchanged agent.
  • Release checks on 1d429709 (run 47392989081): static, browser (voice), and browser (assistant) passed. The isolated lane and the frontend/desktop failures are described below.

CI status and attribution

The failures on this tip are not caused by this diff and are not the base's state either; they are dependency drift in the wheel-verification environment.

  • frontend, desktop / macos, desktop / windows build a fresh venv from the packaged opendirector wheel (.github/workflows/release-checks.yml, "Verify installed wheel without Node.js" and the packaged smoke tests). In run 47392989081 this venv resolved fastapi 0.165.1 with opentelemetry-api 1.46.0 and failed with TypeError: get_logger() takes 1 positional argument but 3 positional arguments (and 1 keyword-only argument) were given at fastapi/telemetry/_asgi.py:332. The base run 47344640055 and the previous-head run 47376634219 used the same job and the same fastapi 0.165.1 but resolved opentelemetry-api 1.45.3, and passed. pyproject.toml declares fastapi>=0.115,<1, the wheel metadata leaves opentelemetry-api unpinned, and requirements.txt pins older versions, so the drift comes from the fresh resolution, not from this change.
  • browser (isolated): the lane ran 35 of 36 workflows green, including first_run.mjs and first_run_added_models.mjs. The only failure is canvas_toolbar_topbar.mjs:125, a 15 s timeout waiting for .cw-node-toolbar-anchor button — the known red tracked by [test] canvas: clear the tool rail when seeding the toolbar drag #686, also red on the base at 83b142f0. This PR does not touch toolbar code.

Evidence that it works

Tested at head 1d429709, at the previous heads a5a2c176 and 4a9e43c5, and at 83b142f0. All runs used an isolated creation fixture; assistant runtimes and /api/model-configs were model doubles, not real providers.

Reproduction for #556/#559: open a fresh project with ?setup=welcome, choose "Use an existing harness" → Codex, go Back, choose "Set up a language model", fetch and save models.

Reproduction for the edit paths: open the language list with a saved service that is paused, choose "Edit service", and save.

Before (83b142f0):

  • The multi-model list shows no hint and no new-row markers in either locale.
  • After saving with Codex already chosen, the chat footer says "Default".

Before, en-US: no hint after saving two models
Before, zh-CN: no hint after saving two models
Before, zh-CN: chat runs on Default after the model save

After the harness and multi-model fixes (4a9e43c5):

  • The hint "Added 2 language models. Pick one to continue to step 2." and New · pick to continue markers appear on the added rows; picking one advances to step 2.
  • The chat footer keeps "Codex" after the model save.

After, en-US: hint and new-row markers
After, zh-CN: the same hint in Chinese
After, zh-CN: chat keeps Codex after the model save

Edit path, first round: clicking "Edit service" on the paused edit-b service and saving at 4a9e43c5 still shows the Added-N hint and marks both rows New · pick to continue:

Before the edit fix, en-US: hint after editing a service
Before the edit fix, zh-CN: hint after editing a service

At a5a2c176 the same save returns to the neutral list; the paused service is the entry point and no hint or marker remains, in both locales. Focus movement to the first added row is asserted by the test via document.activeElement.dataset.firstRunAgent; the recording shows the rows and the step change but does not visibly render a focus ring:

At a5a2c176, en-US: the paused service and its Edit service entry
At a5a2c176, en-US: neutral list after the edit
At a5a2c176, zh-CN: neutral list after the edit

Play the first-round recording at a5a2c176

Edit path, second round (the two defects fixed in 1d429709). At a5a2c176, editing the paused service after a fresh multi-model save left the hint and both markers, and editing the single paused service jumped to "Choose how to create" and replaced the picked agent:

At a5a2c176, en-US: the stale hint and markers survive the edit
At a5a2c176, en-US: editing the single service advances and replaces the selection
Play the before-fix recording at a5a2c176
The extended gate test failing at a5a2c176 (line 160, 1 !== 0)
Probe output at a5a2c176: staleHint 1, staleMarkers 2, advanced 1, stayed 0, agent changed

At 1d429709 both edits stay on the neutral language list with no hint or markers, and the previously picked agent is unchanged:

At 1d429709, en-US: the stale hint and markers are gone after the edit
At 1d429709, en-US: the single-service edit stays on the language list
Play the after-fix recording at 1d429709
Probe output at 1d429709: staleHint 0, staleMarkers 0, advanced 0, stayed 1, agent unchanged

Provider verification

  • No real-provider calls. The runs mocked /assistant/runtimes, the harness status endpoints, /api/model-configs, and /api/model-configs/discover. Saving language models used the real isolated creation API with a local base URL. No credentials appear in the diff.

Bilingual UI

  • Both locales updated: firstRun.pickAddedModel and firstRun.modelJustAdded in en-US/firstRun.ts and zh-CN/firstRun.ts. check:i18n and check:browser-locale pass, and the screenshots show both languages at the previous head and the final head.

Review

  • Self-review (candidate mode), first round: base 83b142f0, head a5a2c176 — WITHHOLD (required Release checks not green on that SHA for reasons outside the diff); no actionable defect found by the self-review.
  • Independent subagent review (candidate mode), first round: base 83b142f0, head a5a2c176 — REQUEST CHANGES. Findings: (1) a single-model edit auto-advanced to step 2 and overwrote the agent selection; (2) the PR body attributed the frontend/desktop failures to the base, which the run logs contradict; (3) a stale Added-N hint survived an edit; plus low findings on the wizard having no path back to Default after choosing a harness (out of scope), the failing-before evidence being narrative-only, and the focus-ring claim not being visible in the recording. Findings 1–3 are fixed in 1d429709; the CI attribution and focus wording are corrected above; the failing-before logs are now attached; the Default path is out of scope for [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556/[bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559.
  • Self-review and independent subagent review (candidate mode), final round: base 83b142f0, head 1d429709 — scores and remaining gaps recorded below once both reviews of this candidate complete.
  • Material validation gaps: local browser evidence covers the first-run paths only. Release checks on 1d429709 cannot be green because of the wheel-venv dependency drift above; the isolated lane inherits only the [test] canvas: clear the tool rail when seeding the toolbar drag #686 toolbar red.

🤖 Generated with Claude Code

@github-actions github-actions Bot added area:harness Harness and skill integration (Default, OpenCode, Codex, Claude Code, Jiuwen, DSH) type:bug Something is broken labels Nov 28, 2026
@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch from 1732977 to 23a4deb Compare November 29, 2026 03:54
@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation area:i18n Localisation and bilingual UI labels Nov 29, 2026
@kunkunblueberry

kunkunblueberry commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

PASS 23a4deb Fixes #556, #559

  • [bug] 首启向导保存语言模型时把已选 harness 静默重置为 Default #556: connect() reads the draft before saving a language model and keeps a non-default runtime, updating only modelSelections.agent. The second half of that fix matters as much — the readiness check now runs against the runtime that will actually run, not default.
  • [bug] 首启向导:一次添加多个语言模型后缺少下一步指引 #559: the multi-model save says how many were added and asks the user to pick one, with the new rows marked and focused. Single-model saves still continue automatically, so the common path is unchanged.
  • Both new strings ship in en-US and zh-CN together, and the browser test asserts the two behaviours that were broken: runtime retained after a second save, and modelSelections.agent unchanged until a pick.

Ran: gh pr checks 560 on 23a4deb (13/13); read the WelcomeScreen diff, both locale files and the new browser assertions.
Not run: first_run.mjs locally.

@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch 3 times, most recently from 55b08ff to 6140a6a Compare December 4, 2026 16:27
Saving a language model inside the setup wizard always wrote runtime=default,
silently replacing a harness the user had just picked (Claude Code, Codex,
OpenCode). A language-model save now keeps a non-default runtime, validates
the runtime that actually runs, and only updates modelSelections.agent.
Explicitly picking another harness still switches.

Also make a multi-model save understandable: show how many models were added,
mark the new rows, move focus to the first one, and keep the single-model
auto-continue behaviour unchanged.

Refs ThinkFlowLab#556, ThinkFlowLab#559

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Zhangbo-cn
Zhangbo-cn force-pushed the fix/first-run-harness-and-guidance branch from 6140a6a to 4a9e43c Compare December 4, 2026 16:30
dev and others added 4 commits December 5, 2026 01:13
The language-model form reports every saved model to the welcome screen.
Editing an existing service therefore showed the Added-N hint and the
new-row markers, implying the user had just added models and must pick
one. Pass the edit flag through finishModelSetup so an edit returns to
the language list without the addition guidance.

Split the multi-model guidance journey into its own gate test so it can
run against earlier revisions without the full first-run setup, and
cover an unavailable kept harness plus the default runtime on a fresh
project in first_run.mjs.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…anguage list

An edit save with one usable model connected and advanced to step 2,
overwriting the chosen assistant, and an edit after a multi-model save
left the added-model hint and markers behind. Return after an edit
before the single-model path and clear the added-model guidance.

Co-Authored-By: Claude Code <noreply@anthropic.com>

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

area:canvas Canvas, nodes and direct manipulation area:harness Harness and skill integration (Default, OpenCode, Codex, Claude Code, Jiuwen, DSH) area:i18n Localisation and bilingual UI type:bug Something is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants