Skip to content

Preserve correction formatting and make setup failures actionable - #38

Merged
ElliotDrel merged 11 commits into
mainfrom
codex/issue-closeout
Nov 21, 2026
Merged

ElliotDrel merged 11 commits into
mainfrom
codex/issue-closeout

Conversation

@ElliotDrel

@ElliotDrel ElliotDrel commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

What Changed and Why

Issue: Corrections could discard rich formatting, freeze editable web-chip labels, or fail without enough clipboard/HTTP diagnostics. Production migration and unavailable updates also lacked actionable behavior.

Why this change was necessary: The recorded formatting failure still reproduced on current main, and laptop logs showed repeated clipboard-backup aborts. Existing protection and mapping paths can address these without a new subsystem.

New status quo: Preserve unchanged rich fragments; use bounded verified mapping for unfamiliar producers; expose only uniquely matched web-chip labels while protecting destinations and sensitive labels. Retain partial HTTP timings, identify clipboard backup failures, and use one truthful correction phase. Reconcile enabled startup targets, retain updater initialization errors, focus missing key inputs, and provide a checksum-verified installer/readiness command. Update checkout/upload-artifact/setup-dotnet to supported majors.

Verification

  • Dev and Prod test suites pass; both Clippy modes pass; formatting passes.
  • Frozen request budgets were regenerated with no value changes.
  • Exact October 23 formatting replay now retains its original rich fragment. Browser contenteditable DOM insertion retained bold text and the exact href; this is not native hotkey/paste acceptance.
  • Installer parser/read-only execution and mocked missing-key, stale-startup and missing-digest cases pass.
  • Both local baseline latency attempts aborted before any trials because foreground acquisition failed. No speed result or passing native acceptance is claimed.
  • Original ChatGPT composer, real installation/upgrade, updater initialization failure and release packaging remain unverified. Screenshot capture reported no browser frames.

Open calls

Draft until native editor/performance and installed-app acceptance can run. The laptop is reachable but its interactive console is active; it was not interrupted.

Refs #5, #13, #15, #18, #36. Clipboard diagnostics are an investigation step, not a claimed producer root-cause fix. Warmup work (#22) remains deferred. No Production release, instruction-file edits, or changes to the primary checkout.

Summary by Sourcery

Preserve correction fidelity while making installation, startup, update, clipboard, and network failures explicit and actionable.

New Features:

  • Add a checksum-verified production installer and JSON readiness/inventory command with optional bounded correction verification.

Bug Fixes:

  • Preserve rich formatting for unchanged selections and safely handle unfamiliar or ambiguous link-chip mappings without dropping corrected text.
  • Retain partial HTTP timing diagnostics and provide actionable clipboard-backup failure details.
  • Surface startup registration, updater initialization, unavailable-update, and missing API-key failures with actionable status and notifications.

Enhancements:

  • Reconcile enabled Production startup targets while preventing Dev and standalone builds from registering login startup.
  • Expose editable labels only for uniquely verified web-link chips while protecting destinations and sensitive labels.
  • Use a single truthful correction phase and improve API-key form focus and save feedback.

Build:

  • Update checkout, upload-artifact, and setup-dotnet GitHub Actions to supported major versions.

CI:

  • Ensure the performance workflow creates the base worktree before restoring its cache.

Documentation:

  • Document installation verification, correction probing, startup behavior, rich-formatting handling, and diagnostic semantics.

Tests:

  • Add coverage for verified web-chip label handling and terminal HTTP failures with partial timings.

Summary by cubic

Preserves rich formatting in corrections and makes setup, startup, and update failures explicit and actionable.

  • Unchanged selections paste their original HTML fragment; unfamiliar editors use the verified mapper only when it returns exactly the corrected text.
  • Only uniquely matched web-link chips expose their editable labels; destinations and secret-bearing labels stay fully protected. A rejected chip projection pastes the complete corrected Unicode text without HTML, so protected links are never dropped.
  • Terminal HTTP failures retain the phase timings that ran, and clipboard backup failures report format, Win32 error, and owner PID.
  • Launch retargets an existing enabled Production startup entry without overriding an opt-out; standalone and Dev builds never register login startup, and registration requires a valid installed manifest. Setup and startup reconciliations are time-bounded and reconciliation errors are reported.
  • Updater initialization errors are surfaced, unavailable updates notify instead of silently skipping, and installed apps retry initialization on later triggers.
  • Adds a checksum-verified installer and read-only readiness report (scripts/install-production.ps1). Silent install launches the managed app and waits up to ten seconds for it to appear; the startup and data identifiers are derived from channel.rs. The optional correction probe requires exactly one verified run via the published 0.13.4 command or the newer benchmark. Readiness requires PID/start-time log evidence queried per process start date, accepts only events already occurring as of the current time, and updater evidence must fall within the verified process lifetime; without Python the inventory stays explicit but incomplete. The dashboard focuses missing API-key fields and confirms saves.
  • CI and release actions move to current supported majors, and the perf job creates the base worktree before restoring cache so a cache hit no longer aborts the comparison.

Refs #5, #13, #15, #18, #36. Native editor/installed-app acceptance remains unverified.

Written for commit 6c56bda. Summary will update on new commits.

View guided diff Turn on auto-fix

- Reuse verified rich mapping for unfamiliar producers and retain unchanged fragments.

- Expose only verified web-chip labels while protecting destinations and sensitive label content.

- Retain partial HTTP timings on failures, report clipboard format failures, and use one truthful correction phase.

- Extend existing regressions; native foreground acceptance remains blocked and is not claimed.
Reconcile existing enabled startup targets while preserving opt-out. Retain updater initialization errors and explain unavailable checks.

Add a checksum-verified installer and read-only readiness report, with an explicit correction probe. Focus missing key fields and confirm successful saves.

Installer branch and native UI acceptance still need an interactive installed environment; the verifier reports incomplete evidence explicitly.
Update checkout, artifact upload, and .NET setup to their current supported major versions while preserving the existing jobs and release flow.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a320c051-061e-4b4e-a12a-f56c2e4e4698
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@sourcery-ai

sourcery-ai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Extend HTTP failure data to retain which request phases ran and their timings, supporting truthful failure reporting.

  • rust/src/http.rs L351-363

API

Pass copied rich HTML into protection so only verified web-chip labels are editable while destinations and sensitive labels remain protected.

  • rust/src/cli.rs L55-59
  • rust/src/core.rs L58-66, L74-78, L83-90 (+1 small edits)
  • rust/src/rich_links.rs L205-247

Expose terminal request failures with partial timings to callers while keeping request and response timing fields explicit.

  • rust/src/http.rs L468-482, L497-511, L536-590 (+12 small edits)

Uses of the API

Use rich protection for captured selections and record terminal HTTP failure timings and diagnostics in run evidence.

  • rust/src/runtime.rs L350, L357-378, L469-471

Implementation

Preserve unchanged rich fragments, map unfamiliar producer markup only when bounded alignment exactly matches corrected text, and reject unverifiable chip projections without dropping corrected links.

  • rust/src/rich.rs L167-169, L189-198, L224-241
  • rust/src/rich_links.rs L51-57, L69-89, L301-307 (+3 small edits)

Add detailed clipboard-render failure context without logging clipboard payloads.

  • rust/src/clipboard.rs L511-523

Restrict automatic and manual login-startup registration to installed Production builds and reconcile only an existing enabled entry.

  • rust/src/platform.rs L107-111, L118-124 (+2 small edits)

Retain updater initialization errors, retry initialization for installed apps, and notify users when updates are unavailable.

  • rust/src/update.rs L47-72, L142-151

UI

Report startup-registration failures through logs and a user notification without preventing corrections.

  • rust/src/app.rs L93-101

Focus missing API-key fields and confirm when a new key has been saved and selected.

  • rust/src/dashboard.rs L312-319, L346-350

Configuration

Upgrade GitHub Actions and create the performance base worktree before cache restoration so restored paths are registered correctly.

  • .github/workflows/ci.yml L29-131 (6 small edits)
  • .github/workflows/release.yml L16-19

Add a checksum-verified installer and read-only readiness inventory with bounded launch and correction verification.

  • scripts/install-production.ps1 L1-138

Documentation

Explain installation inventory, correction verification, setup deadlines, and the evidence limitations of readiness checks.

  • README.md L9-14

Update architecture and formatting guidance for startup reconciliation, rich-fragment preservation, link verification, and updater retry behavior.

  • docs/architecture.md L13, L31-32, L49
  • docs/formatting.md L20, L52-53, L60-61

Document retained request-phase timings and privacy-safe clipboard backup diagnostics.

  • docs/logging.md L43-45, L66-67

Tests

Add regression coverage for partial request-failure timings.

  • rust/src/http.rs L765-791

Verify editable web-chip labels, protected destinations and sensitive labels, and safe fallback when projection is ambiguous.

  • rust/src/rich_links.rs L338-379, L474-475

Ensure standalone executables cannot register login startup.

  • rust/src/platform.rs L125-131

Update frozen formatting-contract fixtures for the revised rich-text behavior.

  • rust/tests/fixtures/formatting-contracts.jsonl L16, L77-84

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Additional verification: two consecutive mocked digest-verified installer runs passed without executing an installer or modifying a real installation. The missing-key, stale-startup and unavailable-digest cases also passed. Production installation, update/restart and native editor acceptance remain outstanding.

This batch also covers #10, #11, #12, #19, #20 and #21; those issues remain open until their changes are merged and the stated acceptance limits are resolved. The original descriptions and bot-owned sections were left unchanged.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Performance

Keypress-to-paste latency, replayed API, 4 alternating rounds x 5 runs per case.

case base ms candidate ms change
brands 54.3 54.3 -0.1 ms (-0.1%)
literals 55.5 55.5 +0.0 ms (+0.0%)
long 57.9 58.0 +0.1 ms (+0.1%)
multiline 54.6 54.5 -0.1 ms (-0.1%)
paragraph 55.6 55.5 -0.1 ms (-0.2%)
rich-link 54.2 54.2 +0.0 ms (+0.0%)
rich-list 54.6 54.5 -0.0 ms (-0.0%)
short 54.1 54.3 +0.1 ms (+0.2%)
unchanged 54.2 54.2 -0.0 ms (-0.0%)
unicode 54.7 54.6 -0.1 ms (-0.2%)
overall 54.6 54.6 -0.1 ms (-0.1%)

Geometric mean of per-case ratios: 1.000 (-0.0 ms at the overall median).

No latency regression.

Native acceptance exposed a first-launch path that registered an unmanaged Production build when its data marker was absent.

Require a valid installed manifest before any automatic startup registration. Desktop smoke and fresh standalone launches now reach readiness without changing startup state or creating the marker.
@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Desktop native acceptance update:

  • On the original PR source aff6f9e, an outside-sandbox replay run completed 30 measured corrections across all ten cases with zero failures. Later attempts (including the separately named follow-up build) aborted at the foreground gate before any trials; this is not a repeatable local performance comparison.
  • The verified Dev build passed native Settings checks through accessibility and keyboard input: missing-name and missing-key errors focus the correct field; saving a synthetic non-networking key creates the encrypted file, selects it and displays the explicit success message.
  • A launch-order mistake started the standalone Production candidate before the Dev rebuild had completed and wrote its test path to login startup. That test process was stopped and its exact test registration removed. The prior startup value had not been recorded, so restoration of the prior configuration is not claimed; startup is now disabled.
  • Follow-up commit 9220ac5 requires a valid installed manifest before any automatic startup registration. Both native smoke and fresh standalone launches reached readiness without changing startup or creating its marker. Dev/Prod test suites, Clippy and formatting pass after this guard.
  • This desktop has no managed Production installation/updater. The read-only verifier reports that explicitly; real installation/upgrade and updater acceptance remain unverified. Browser-editor checks are still in progress. No release or installer was run.

A real cache hit restored base/rust/target and created base before Git could register the worktree, aborting the performance job.

Move worktree creation ahead of cache restore. Retain the same builds, native correctness gates, comparisons, and regression thresholds.
@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Desktop acceptance checkpoint: application, request-budget and performance checks now pass at 86cd85b after moving baseline worktree creation before cache restoration. The performance report finds no latency regression; no thresholds were relaxed.

The remaining live ChatGPT composer test could not proceed: automatic approval review rejected copying the existing encrypted Production key into isolated Dev for an external API request without specific authorization. No live correction result is claimed. The acceptance-only encrypted key copy was removed, no acceptance process remains running, and the acceptance browser tab was closed without submitting a message. Native replay, key-entry and startup results remain as recorded above. Login startup remains disabled following the earlier test registration cleanup; its prior configuration is unknown. Real installation/upgrade remains untested and this PR stays draft.

@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Live editor acceptance retry: Elliot explicitly authorized the existing encrypted key for two synthetic corrections. The isolated Dev candidate launched, but browser discovery returned The browser access host is unavailable and native Chrome control returned Computer Use app approval timed out. Neither correction was attempted. The isolated process was stopped and the temporary encrypted key copy was removed, both verified. Live editor acceptance remains blocked by desktop automation access; prior native results are unchanged.

@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Elliot explicitly waived the blocked live ChatGPT editor acceptance test and asked to move on. This is an accepted verification gap, not an observed pass: no live editor correction was performed. Existing native replay, Settings and startup evidence remains unchanged. Real installed Production installation/upgrade acceptance also remains unverified. This waiver does not authorize merging or a Production release.

- Native install acceptance exposed that silent setup leaves the app stopped and v0.13.4 predates --bench.

- Launch managed Production after setup and use its supported legacy probe for that release.

- Require exactly one successful correction so missing or empty summaries cannot pass; document compatibility.
@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Desktop installed-Production acceptance completed against the official v0.13.4 release:

  • The installer SHA-256 matched GitHub's published digest. Managed executable and sq.version both identify 0.13.4; Update.exe is present and the saved Production key was usable without copying or displaying it.
  • Installed startup reached PID 29928 and completed its launch update check (Up to date). Login startup remains disabled; no enabled stale target exists.
  • One live native-editor correction passed: This is a tset. → This is a test., one attempted/succeeded/quality match, zero failures. Paste landing took 1759.6 ms in this single sample; it is not a latency distribution. Retained evidence: %TEMP%/usc-install-check-202638dd-3d87-4dac-bafa-854727ae8589/evidence.
  • Native --restart acknowledged exit 0, replaced PID 29928 with PID 29784, and the new process completed a fresh successful launch update check. Production remains running.

Acceptance exposed two script gaps, fixed in d2088dc: silent setup may not launch the app, and released 0.13.4 uses --bench-desktop rather than the unreleased consolidated --bench. The installer now launches managed Production if needed and handles the published probe. Both result formats require exactly one successful measured correction; missing/empty results fail. PowerShell parser and diff checks pass; the actual legacy live probe passed after the fix.

This validates the installer script and existing released app, not the unreleased runtime changes in this PR. No newer release was available, so download/apply of an actual version upgrade and the offline pending-update branch remain untested. ChatGPT editor acceptance remains explicitly waived. No release/tag or merge was performed. Latest CI is running.

- Sonnet final review found the fixed two-second sleep could reject a slow cold start.

- Check for the managed process every 200 ms for up to ten seconds, retaining the existing failure when launch never appears.
@ElliotDrel

Copy link
Copy Markdown
Owner Author

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

The sole requested Claude Sonnet 5.5 final review found no merge-blocking bugs at d2088dc (static full-diff/source review; no new test runs by the reviewer). Review observations addressed:

  1. Managed-process verification inspects the file at its path rather than proving the in-memory image version. Retained as a documented limitation for upgrades over an already-running process; this session's clean install and observed PID-changing restart were independently verified. No claim of actual newer-version upgrade acceptance is made.
  2. Fixed the cold-start timing concern in 234c443: replace the fixed two-second sleep with process checks every 200 ms, bounded to ten seconds. Parser, delayed-launch and expired-deadline checks passed; diff whitespace check passed.
  3. Preserving the original rich fragment for unchanged Unicode text is intentional native copy/paste behavior. Adding alignment as a prerequisite would reintroduce formatting loss for unfamiliar producers; changed corrections still require exact mapping or plain-text fallback.
  4. Standalone update/restart notification with a successful handled result is intentional; no caller requires the previous error.
  5. Candidate installed-startup/updater scenario coverage remains limited, as already recorded; this does not turn the released-app checks into candidate acceptance.
  6. The single Correcting... overlay phase is intentional and retained.

Elliot authorized merging after a clean final review. No additional reviewer was started. Waiting for checks on the small follow-up before merging; browser acceptance remains waived and no Production release is authorized.

@ElliotDrel
ElliotDrel marked this pull request as ready for review November 21, 2026 18:10
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-11-21T18:13:10.291527Z 234c443 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.

@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: 234c443bc1

ℹ️ 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 rust/src/rich.rs
Comment on lines +228 to +231
if mapped.applied && mapped.text == corrected {
return mapped;
}
return Rich::plain(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject rich mappings that omit protected link content

When link projection rejects an unfamiliar producer's markup, rewrite falls back to this branch, but mapped.text == corrected does not verify the rebuilt HTML: align initializes its result text from corrected and permits unchanged source characters outside mapped nodes. For example, HTML containing teh and one Inbox chip paired with Unicode containing two [Inbox](...) links fails occurrence verification, yet correcting teh to the can still produce an applied HTML result containing only one label and neither destination. Rich-text paste then loses protected content instead of using the complete corrected Unicode fallback. Reject such unverified link projections before accepting the generic mapper.

AGENTS.md reference: AGENTS.md:L35-L35

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Confirmed and fixed in 93c4655. A rejected chip projection now declines directly to the complete corrected Unicode payload with no HTML (reason=unverified_links), rather than retrying the generic mapper. This also prevents loss for an unchanged ambiguous selection. Two golden cases cover one HTML chip paired with two protected Unicode links, changed and unchanged; existing unsafe-link checks now require applied=false and empty HTML. Dev/Prod suites, both Clippy modes, fmt, release build and deterministic release replays pass. The documentation states this fallback explicitly.

Comment thread scripts/install-production.ps1 Outdated
$result.manifest_valid = $null -ne $id -and $id.InnerText -eq 'UniversalSpellCheck' -and $null -ne $version -and $version.InnerText -eq $result.managed_version
}
$runKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
$result.startup_target = (Get-ItemProperty -LiteralPath $runKey -Name 'UniversalSpellCheck' -ErrorAction SilentlyContinue).UniversalSpellCheck

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Derive the startup entry name from the channel authority

The new verifier hardcodes UniversalSpellCheck as the startup value name, whereas platform::startup writes that value using channel::MUTEX. This duplicates a channel-controlled identifier outside its authority, contrary to the explicit hard rule in AGENTS.md. If that identifier changes, the verifier will inspect the wrong value and treat the missing entry as a valid opt-out, potentially reporting success while the enabled startup entry still targets another executable. Resolve the Production startup identifier from rust/src/channel.rs, as the script already does for the data folder.

AGENTS.md reference: AGENTS.md:L27-L27

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Confirmed and fixed in 93c4655. The verifier extracts the Production MUTEX value from rust/src/channel.rs and uses it for both the registry lookup name and returned property. It fails explicitly if that authority cannot be resolved. A parser/AST-based mock renamed the authority to USC.Acceptance.Renamed and verified that the renamed startup entry is queried and its stale target is retained for validation. Read-only verification of the real installed Production app also passes.

@sourcery-ai sourcery-ai 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.

Hey - I've found 10 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="scripts/install-production.ps1" line_range="92" />
<code_context>
+        $summaryPath = Join-Path $evidence 'summary.json'
+        if (-not (Test-Path -LiteralPath $summaryPath)) { throw "Correction probe produced no summary (exit $($probe.ExitCode)); inspect $output" }
+        $summary = Get-Content -LiteralPath $summaryPath -Raw | ConvertFrom-Json
+        $passed = if ($legacy) { $null -ne $summary.aggregate -and $summary.aggregate.attempted -eq 1 -and $summary.aggregate.succeeded -eq 1 -and $summary.aggregate.failed -eq 0 -and $summary.aggregate.quality_matches -eq 1 -and -not $summary.block_error } else { $summary.measured -eq 1 -and $summary.failed -eq 0 -and -not $summary.error }
+        if ($probe.ExitCode -ne 0 -or -not $passed) { throw "Correction probe failed or did not complete exactly one correction; inspect $output" }
+        $result.correction = 'passed'
</code_context>
<issue_to_address>
**Invalid corrections pass readiness**

When the live correction returns an empty or incorrect result that is nevertheless pasted successfully, `install-production.ps1` accepts `measured == 1`, `failed == 0` and no summary error without checking whether the trial output matches the expected correction, so the verifier reports success and marks readiness complete for a bad correction.

Require the probe summary’s expected-output or quality-match result to pass before marking the correction successful.
</issue_to_address>

### Comment 2
<location path="scripts/install-production.ps1" line_range="52-55" />
<code_context>
+        $info = if ($path) { (Get-Item -LiteralPath $path).VersionInfo } else { $null }
</code_context>
<issue_to_address>
**Old process passes as current version**

When an upgrade replaces the executable while a process from the previous version is still running, `install-production.ps1` identifies the running process by path, then reads `ProductVersion` from the file currently at that path; it can therefore mark the old process as the new managed version and report readiness while the old app remains active.

Verify the version of the running process itself, rather than inferring it from the current file at its path.

Also at `scripts/install-production.ps1:29-32`.
</issue_to_address>

### Comment 3
<location path="scripts/install-production.ps1" line_range="25" />
<code_context>
+            Invoke-WebRequest -Uri $assets[0].browser_download_url -OutFile $temporary -Headers @{ 'User-Agent' = 'UniversalSpellCheck-installer' }
+            if ((Get-FileHash -Algorithm SHA256 -LiteralPath $temporary).Hash -ne $expected) { throw 'Installer checksum mismatch.' }
+            $result.installer_digest_verified = $true
+            $process = Start-Process -FilePath $temporary -ArgumentList '--silent' -Wait -PassThru -WindowStyle Hidden
+            if ($process.ExitCode -ne 0) { throw "Installer failed with exit code $($process.ExitCode)." }
+        } finally { if (Test-Path -LiteralPath $temporary) { Remove-Item -LiteralPath $temporary } }
</code_context>
<issue_to_address>
**Installer wait can hang indefinitely**

When the downloaded setup process hangs instead of exiting, `Start-Process -Wait` blocks until the setup process exits; if setup hangs, the verifier never reaches its later bounded correction probe or error handling, so the caller gets no JSON result or actionable failure.

Wait for setup with a deadline, terminate it on timeout, and report the timeout through the JSON result.
</issue_to_address>

### Comment 4
<location path="rust/src/platform.rs" line_range="111" />
<code_context>
     if flag.exists() {
+        // Only an installed Production app may retarget an existing enabled entry.
+        // An absent entry is an intentional opt-out. Smoke runs skip first_run.
+        if startup_registered() {
+            startup(true)?;
+        }
</code_context>
<issue_to_address>
**Stale startup target persists**

When the Production Run-key update fails during launch, `platform::first_run` returns the error from `startup(true)`, but `app::run` discards it, leaving the enabled startup entry pointed at the old executable without notifying the user.

Handle the `first_run` error in `app::run` so a failed startup reconciliation is visible to the user.

Also at `rust/src/platform.rs:112`.
</issue_to_address>

### Comment 5
<location path="docs/architecture.md" line_range="13" />
<code_context>
+4. The hotkey is registered with `RegisterHotKey` (Ctrl+Alt+U Prod, Ctrl+Alt+D Dev). Start-on-login is a Settings toggle that writes the `HKCU\...\Run` key; Dev and standalone builds never register it. Installed Production reconciles an existing enabled entry on launch, including after migration; an absent entry remains an opt-out.
</code_context>
<issue_to_address>
**Fresh install overrides startup opt-out**

When an installed Production app first runs with no `startup.initialized` marker and no Run entry, on an installed Production launch with no `startup.initialized` marker, `first_run` calls `startup(true)` without checking whether a Run entry already exists. A user who left or made the entry absent has startup enabled despite the documented opt-out.

Preserve an absent Run entry on the marker-absent path, or document that first launch defaults startup to enabled.
</issue_to_address>

### Comment 6
<location path="rust/src/update.rs" line_range="50-59" />
<code_context>
+            let (manager, unavailable)=if channel::IS_DEV {
+                (None, "Updates are disabled in Dev.".to_string())
+            } else {
+                match std::panic::catch_unwind(new_manager) {
+                    Ok(Ok(manager)) => (Some(manager), String::new()),
+                    Ok(Err(velopack::Error::NotInstalled(_))) if !installed_layout() =>
+                        (None, "Standalone build: install the official release to enable updates.".to_string()),
+                    result => {
+                        let error=match result { Ok(Err(error))=>error.to_string(), Err(_)=>"Update manager initialization panicked".into(), _=>unreachable!() };
+                        logger.event(format!("update_manager_init_failed error={}",serde_json::to_string(&error).unwrap_or_default()));
+                        (None, format!("Updates unavailable: {error}"))
+                    }
+                }
+            };
</code_context>
<issue_to_address>
**Transient update failure lasts all session**

When update-manager initialization fails transiently at application startup, `Updater::new` stores `manager` as `None` after any initialization error, then the worker loop handles every later trigger through the unavailable branch without trying initialization again. A transient startup failure therefore leaves manual and periodic update checks unavailable until the app is restarted.

Retry manager initialization on a later update trigger, or distinguish permanent installation errors from transient initialization failures.
</issue_to_address>

### Comment 7
<location path="scripts/install-production.ps1" line_range="49" />
<code_context>
+    }
+    $runKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
+    $result.startup_target = (Get-ItemProperty -LiteralPath $runKey -Name 'UniversalSpellCheck' -ErrorAction SilentlyContinue).UniversalSpellCheck
+    $result.startup_valid = -not $result.startup_target -or $result.startup_target.Trim('"').Equals($exe, [StringComparison]::OrdinalIgnoreCase)
+    foreach ($process in @(Get-Process -Name 'UniversalSpellCheck','universal-spell-check' -ErrorAction SilentlyContinue)) {
+        try { $path = $process.Path } catch { $path = $null }
</code_context>
<issue_to_address>
**Startup check races reconciliation**

When the installer starts the app while the Run registry entry still points to an older executable, the script treats any existing startup target that differs from the managed path as invalid. After it observes the launched process, it can check the registry before `app::run` reaches `platform::first_run` and retargets that entry, so installation verification fails even though the app is about to correct it.

Wait with a bounded deadline for startup reconciliation to finish before declaring the target invalid, or have startup expose an explicit readiness signal.
</issue_to_address>

### Comment 8
<location path="scripts/install-production.ps1" line_range="48" />
<code_context>
+        $result.manifest_valid = $null -ne $id -and $id.InnerText -eq 'UniversalSpellCheck' -and $null -ne $version -and $version.InnerText -eq $result.managed_version
+    }
+    $runKey = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run'
+    $result.startup_target = (Get-ItemProperty -LiteralPath $runKey -Name 'UniversalSpellCheck' -ErrorAction SilentlyContinue).UniversalSpellCheck
+    $result.startup_valid = -not $result.startup_target -or $result.startup_target.Trim('"').Equals($exe, [StringComparison]::OrdinalIgnoreCase)
+    foreach ($process in @(Get-Process -Name 'UniversalSpellCheck','universal-spell-check' -ErrorAction SilentlyContinue)) {
</code_context>
<issue_to_address>
**Startup verification uses a duplicate name**

When the Production mutex value in `channel.rs` differs from `UniversalSpellCheck`, the script queries the literal `UniversalSpellCheck` instead of the Production mutex value from `channel.rs`. If that value changes, the query misses the actual Run entry and `startup_valid` can report a stale startup target as valid, giving a false readiness result.

Read the Production startup value name from `channel.rs` rather than hardcoding it in the script.
</issue_to_address>

### Comment 9
<location path="rust/src/runtime.rs" line_range="357" />
<code_context>
         });
-        bus.send(UiEvent::Phase("Sending to AI..."));
-        let response=measure(&mut timings.request_ms, || match replay{Some(replay)=>replay.request(&request_payload),None=>client.ok_or("HTTP client unavailable")?.request(&request_payload,&key,||bus.send(UiEvent::Phase("Waiting for AI...")))})?;
+        bus.send(UiEvent::Phase("Correcting..."));
+        let response=measure(&mut timings.request_ms, || match replay {
+            Some(replay)=>replay.request(&request_payload),
</code_context>
<issue_to_address>
**Request progress phases disappear**

When a correction reaches the request phase, the worker emits only `Correcting...` and passes an empty wait callback, so the established `Sending to AI...` and `Waiting for AI...` events never reach the UI. Request progress no longer follows the required phases.

Emit the required request phase transitions to the UI while retaining accurate progress messaging.
</issue_to_address>

### Comment 10
<location path="rust/src/rich_links.rs" line_range="333" />
<code_context>
     use super::*;
     use crate::rich::{build_cf_html, fragment, rewrite};
     #[test]
+    fn verified_web_chip_labels_are_corrected_without_exposing_destinations() {
+        let source = "A [lnik](https://example.com/acceptance).";
+        let fragment_html = "<p>A <span text-link-href='https://example.com/acceptance'><span>lnik</span></span>.</p>";
</code_context>
<issue_to_address>
**Regression test bypasses table suite**

The web-chip regression is added as a standalone unit test instead of extending an existing table test. Processing regressions no longer follow the prescribed fixture-driven test approach.

Represent the web-chip regression as a case in the existing formatting-contract table tests.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 9 findings to address first, and the new install command downloads and runs the published installer, and the startup reconciliation can retarget an already-enabled login entry; a mistake could leave the wrong installed version or startup target in place after this change is reverted. Those effects are bounded and can be repaired by reinstalling or correcting the startup setting.

Blocking findings: scripts/install-production.ps1:92, scripts/install-production.ps1:55, scripts/install-production.ps1:25, rust/src/platform.rs:111, docs/architecture.md:13, and 4 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread rust/src/platform.rs Resolved
Comment thread docs/architecture.md Resolved
Comment thread rust/src/update.rs Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread rust/src/runtime.rs Resolved
Comment thread rust/src/rich_links.rs Resolved

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 18 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="rust/src/runtime.rs">

<violation number="1" location="rust/src/runtime.rs:368">
P2: This marks every terminal HTTP client error as a transport failure, including invalid JSON and oversized responses that were successfully received. Carry an explicit failure kind from `Client` or omit this marker for non-transport failures so failure diagnostics remain truthful.</violation>
</file>

<file name="docs/architecture.md">

<violation number="1" location="docs/architecture.md:32">
P3: The overlay remains visible during failure recovery because `run` restores the clipboard before sending its completion phase. Update this sentence to describe the actual ordering, or move the hide event before recovery.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread rust/src/rich.rs Resolved
Comment thread rust/src/runtime.rs Outdated
"final_response_attempt":failure.attempts,
"send_api_ms":failure.send_api_ms,
"send_completion_wait_ms":failure.send_completion_wait_ms,
"transport_failed":true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This marks every terminal HTTP client error as a transport failure, including invalid JSON and oversized responses that were successfully received. Carry an explicit failure kind from Client or omit this marker for non-transport failures so failure diagnostics remain truthful.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At rust/src/runtime.rs, line 368:

<comment>This marks every terminal HTTP client error as a transport failure, including invalid JSON and oversized responses that were successfully received. Carry an explicit failure kind from `Client` or omit this marker for non-transport failures so failure diagnostics remain truthful.</comment>

<file context>
@@ -347,17 +347,35 @@ fn run(started: Instant, context: RunContext<'_>) -> Result<(), String> {
+                        "final_response_attempt":failure.attempts,
+                        "send_api_ms":failure.send_api_ms,
+                        "send_completion_wait_ms":failure.send_completion_wait_ms,
+                        "transport_failed":true,
+                        "measured_total_ms":failure.total_ms
+                    });
</file context>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Fixed in 3f37904. Removed the misleading transport_failed marker and emit client_failed for terminal Client errors. Documentation explicitly includes transport, size and decoding errors without pretending to classify them all as transport failures.

Comment thread README.md Resolved
Comment thread rust/src/platform.rs Resolved
Comment thread rust/src/rich_links.rs Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread docs/logging.md Resolved
Comment thread docs/architecture.md Outdated
Unchanged text still pastes. Overlay phases (`Copying text...`, `Sending to AI...`,
`Waiting for AI...`, `Pasting...`) are sent over the bus. The overlay hides as soon as the hot
Unchanged text still pastes with its original rich fragment when the editor is unfamiliar.
Overlay phases (`Copying text...`, `Correcting...`, `Pasting...`) are sent over the bus. The overlay hides as soon as the hot

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: The overlay remains visible during failure recovery because run restores the clipboard before sending its completion phase. Update this sentence to describe the actual ordering, or move the hide event before recovery.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/architecture.md, line 32:

<comment>The overlay remains visible during failure recovery because `run` restores the clipboard before sending its completion phase. Update this sentence to describe the actual ordering, or move the hide event before recovery.</comment>

<file context>
@@ -28,8 +28,8 @@ during a run logs `guard_rejected reason=already_running` and is dropped, never
-Unchanged text still pastes. Overlay phases (`Copying text...`, `Sending to AI...`,
-`Waiting for AI...`, `Pasting...`) are sent over the bus. The overlay hides as soon as the hot
+Unchanged text still pastes with its original rich fragment when the editor is unfamiliar.
+Overlay phases (`Copying text...`, `Correcting...`, `Pasting...`) are sent over the bus. The overlay hides as soon as the hot
 path returns, before any slow clipboard restore, so it never sticks after a failure.
 
</file context>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Note

🤖 GPT-6.1 Sol responding on behalf of Elliot

Fixed the stale documentation in 3f37904: it now states that failure clipboard recovery finishes before the completion phase hides the overlay. Runtime ordering is unchanged.

- Automated review reproduced protected links disappearing from HTML after an ambiguous chip projection fell through to generic mapping.

- Decline rejected projections directly to the complete corrected Unicode payload, with changed and unchanged golden regression cases.

- Derive the installer startup entry from channel.rs and verify renamed identifiers instead of assuming the current Production value.
- Review found readiness could accept a wrong paste or infer an old process version from a replaced file; require quality output and PID/start-time log evidence.

- Bound setup and startup reconciliation waits, reject empty Run entries, and retain incomplete inventory when Python is absent.

- Report startup reconciliation errors, guard manual standalone startup registration, and retry installed update-manager initialization on later triggers.

- Keep HTTP failure labels truthful, handle chip attributes without case assumptions, add table regressions and correct the owning documentation.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 10 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
Comment thread scripts/install-production.ps1 Resolved
- Query startup logs on the process start dates rather than relying on a rolling 30-day last-N search.

- Guard inaccessible process metadata and briefly wait for new install startup evidence.

- Filter recent updater rows by verified PID, version and process lifetime before selecting the newest match; reject future records.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread scripts/install-production.ps1 Resolved
- The explicit next-day search includes midnight startup but must not treat a future-dated event as current process evidence.

- Apply the same current-time upper bound used for updater evidence; focused valid/future and future-only cases pass.
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