Skip to content

fix(claude_code): prevent the fullscreen-renderer onboarding upsell via settings - #600

Open
klabulan wants to merge 1 commit into
awslabs:mainfrom
klabulan:upstream-pr/claude-code-upsell-settings
Open

fix(claude_code): prevent the fullscreen-renderer onboarding upsell via settings#600
klabulan wants to merge 1 commit into
awslabs:mainfrom
klabulan:upstream-pr/claude-code-upsell-settings

Conversation

@klabulan

Copy link
Copy Markdown
Contributor

Claude Code shows a first-run "Try the new fullscreen renderer?" onboarding upsell on a HOME dir whose stored onboarding-version state lags the installed CLI, unless the CLI's own /tui setting is explicitly set. That prompt is structurally indistinguishable, from initialize()'s point of view, from a hung launch — it sits outside the accept-set and can block/tear down session initialization; it also renders an alternate-screen TUI that CAO's screen-scraping status detection does not expect.

Fix: extend the existing hardened settings-seeding function (renamed _ensure_startup_settings) to also seed tui:"default" in the same atomic, locked read-modify-write that already seeds skipDangerousModePermissionPrompt. Prevention instead of runtime detect-and-dismiss: with the setting seeded before launch the prompt never renders. tui is only seeded when absent, so an operator who deliberately chose "fullscreen" is not reset on every launch. "default" keeps the classic renderer the existing status detection expects. Upstream's _SETTINGS_WRITE_LOCK + atomic os.replace + mode-preservation hardening is preserved intact.

Tests: both keys are written in one os.replace (mode 0600); an explicit tui is preserved; no-op when both keys already present. Verified live: a fresh session seeds tui:"default" at create and reaches the REPL with no upsell.

Surfaced in production (harness-control#225).

🤖 Generated with Claude Code

…ia settings (harness-control#225)

Claude Code shows a first-run "Try the new fullscreen renderer?" onboarding upsell
on a HOME dir whose stored onboarding-version state lags the installed CLI, unless the
CLI's own /tui setting is explicitly set. That prompt blocks CAO's screen-scraping
status detection (which expects the classic renderer) and can hang initialization.

Extend the existing _ensure_skip_bypass_prompt_setting() (renamed _ensure_startup_settings)
to ALSO seed tui:"default" in the SAME atomic, locked read-modify-write that already
seeds skipDangerousModePermissionPrompt -- prevention instead of runtime detect-and-dismiss.
tui is only seeded when ABSENT, so an operator who deliberately chose "fullscreen" is not
reset on every launch. Preserves the _SETTINGS_WRITE_LOCK + os.replace atomic-write and
mode-preservation (0600) hardening intact.

Tests: seeds both keys in one os.replace; preserves an explicit tui; no-op when both present.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@0903561). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #600   +/-   ##
=======================================
  Coverage        ?   91.32%           
=======================================
  Files           ?      182           
  Lines           ?    24415           
  Branches        ?        0           
=======================================
  Hits            ?    22297           
  Misses          ?     2118           
  Partials        ?        0           
Flag Coverage Δ
unittests 91.32% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Claude Code session startup by proactively seeding Claude Code’s ~/.claude/settings.json to suppress first-run/upgrade prompts that can block CAO initialization and disrupt status detection.

Changes:

  • Rename and extend the settings seeding helper to _ensure_startup_settings, seeding both skipDangerousModePermissionPrompt: true and (when absent) tui: "default" in a single locked, atomic write.
  • Update provider initialization to invoke the renamed helper before launching Claude Code.
  • Update and expand unit/integration tests to cover the new tui behavior and the rename.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/cli_agent_orchestrator/providers/claude_code.py Renames and expands the startup settings seeding to include tui: "default" while preserving the atomic, locked write behavior.
test/providers/test_claude_code_unit.py Updates patches for the renamed helper and adds coverage for seeding/preserving tui alongside existing atomic-write tests.
test/providers/test_provider_init_timeout.py Updates initialization wiring tests to patch the renamed helper.
test/providers/test_container_wrapped.py Updates wrapped-provider lifecycle test to patch the renamed helper.
uv.lock Bumps package version and updates lock contents accordingly.
Suppressed comments (1)

test/providers/test_claude_code_unit.py:1965

  • This mock setup is redundant: mock_path_cls.home.return_value is reassigned a few lines later, so the __truediv__ side_effect configured here is overwritten and never used. Removing it reduces confusion and keeps the chain setup in one place.
        mock_path_cls.home.return_value.__truediv__ = MagicMock(
            side_effect=lambda _: mock_settings_path
        )
        # Chain .home() / ".claude" / "settings.json"

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

permissions confirmation dialog on every launch with ``--dangerously-skip-permissions``
unless this is persisted. CAO already uses the flag intentionally, so the confirmation
is redundant and blocks initialization.
- ``tui: "default"`` (workain/harness-control#225): Claude Code shows a first-run
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.

3 participants