Repository navigation
fix(onboarding): recover failed builds with complete logs and reviewed AI fixes - #689
Salah-Eddine Lachkar (artpumpkin) wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c1035088a
ℹ️ 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 (@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 (@codex) address that feedback".
| {evolve?.evolutionId != null && !isGenerating ? ( | ||
| evolve.step === "evolve" ? <ReviewStep /> : evolve.step === "commit" ? <CommitStep /> : null | ||
| ) : null} |
There was a problem hiding this comment.
Hide retry while an AI fix awaits review
When Fix with AI completes after an onboarding build failure, rebuildStatus still describes the failed run, so the existing top-level “Retry build” button remains active while this newly rendered ReviewStep is awaiting approval. That button calls runFirstBuild and then handleApply directly, allowing the AI-modified working tree to be activated without using the review surface's confirmation gate. Hide or disable the original retry/fix controls whenever an evolution review is pending.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 40cd50d. Retry is disabled (and its handler guarded) during generation and while evolution review/save is pending; the secondary Fix with AI action is hidden. Regression tests cover both review and commit states.
| <EtcClobberConflictList result={etcClobber} /> | ||
| ) : null} | ||
| {evolve?.evolutionId != null && !isGenerating ? ( | ||
| evolve.step === "evolve" ? <ReviewStep /> : evolve.step === "commit" ? <CommitStep /> : null |
There was a problem hiding this comment.
Provide an onboarding-aware Back to Prompt action
In this embedding, ReviewStep exposes a “Back to Prompt” button that only sets the main widget's activeStepOverride to begin. OnboardingFlow routes with its separate onboarding step state, while BuildStep continues rendering this review from evolve.step, so clicking the button during onboarding has no visible effect and the user cannot reach the prompt to refine the fix. Pass an onboarding-specific navigation callback or suppress the unsupported action here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 40cd50d. ReviewStep/DriftReview can disable unsupported prompt navigation; onboarding does so, while the normal widget keeps its existing Back to Prompt callback. Tests verify both action configurations. Added onboarding guidance for review, apply, discard and save; the PR describes the still-outstanding packaged-app smoke test.
[Medium impact] The changes affect failed-build recovery in onboarding and shared rebuild status. The PR should not merge until the empty-review Retry trap and the shared error-reporting requirement are addressed. FindingsSummaryThe PR adds run-specific log copying and brings AI recovery into onboarding.
|
| const isGenerating = useUiState((s) => s.isGenerating); | ||
| const etcClobber = useUiState((s) => s.etcClobber); | ||
| const evolve = useViewModel((s) => s.evolve); | ||
| const recoveryPending = isGenerating || (evolve?.evolutionId != null && (evolve.step === "evolve" || evolve.step === "commit")); |
There was a problem hiding this comment.
Discarding the fix blocks Retry
After an AI fix, discarding its last change through a file’s “Discard change” menu leaves onboarding stuck. That action refreshes the session without clearing its evolutionId, so recoveryPending keeps Retry disabled. Meanwhile, DriftReview returns nothing when no files remain, hiding the whole-session Discard action too.
Clear the empty session or keep a way to discard it and retry.
| if (!run?.logFile) throw new Error("The complete build log is unavailable."); | ||
| const contents = await client.darwin.readRebuildLog({ logFile: run.logFile }); | ||
| if (!contents) throw new Error("The build log is empty."); | ||
| if (currentRun.current?.isRunning || currentRun.current?.logFile !== run.logFile) { | ||
| throw new Error("The build changed. Copy the log from the completed build again."); |
There was a problem hiding this comment.
Copy errors skip shared reporting
copyLog adds user-facing error strings directly in BuildStep. The repository requires errors to be defined and reported through nostics in errors.ts, not written as one-off strings in components. Add stable diagnostics for unavailable, empty, changed-run, and clipboard failures, then use them here. This repository requirement must be satisfied before merging.
Context Used: TypeScript error handling with nostics in the native app (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
40cd50d to
86719dd
Compare
|
|
Hi Salah-Eddine Lachkar (@artpumpkin)! The smoke test that was not performed, is a big part of the task, manually testing it. Please provide a video demonstration of the issue and the fix. You can download the packaged app from the "artifacts" in the Github Actions (it's an artifact of the |
cooper (czxtm)
left a comment
There was a problem hiding this comment.
Requesting changes: the Fix with AI regression, the formatting failure and the packaged-app recording need to land before this can merge.
Four review threads are still open, including the Greptile P1 about onboarding getting stuck after the last AI-fix file is discarded. I confirmed that one at the current head and it also blocks merge, so please address it along with the items below.
Blocking
- Fix with AI now errors when the build log is missing or empty. On main,
run_fixusedunwrap_or_default()on the log tail, so a missing log only dropped the optional output context. Now it propagatesread_completed_logwith?(evolve.rs), which errors on an empty file, an unreadable file or a mismatched log path (rebuild_status.rs). A build that fails before writing any output, or a cleared~/Library/Logs/nixmac, now gives the user an error and no fix, even though the error text and type are already passed tobuild_fix_description. Fall back to an empty tail onErrinrun_fix, keep the strict errors for the Copy log command, and add tests for the empty and missing cases. - The Git Hooks check fails: the treefmt hook runs with
--fail-on-changeand rewrites two files. Inrebuild_status.rsit wraps the chain at L58 and the longifat L64. Indarwin.rsit drops the stray blank line at L1431. Runprek run --all-filesin the devenv shell and push the result. - The video requested on Oct 30, showing the issue and the fix in the packaged app, is still outstanding, and the PR body leaves the same smoke test unchecked.
Smaller things
read_completed_logreads the whole transcript into memory andrun_fixthen keeps only the last 200 lines. Read just the tail for the AI path.create_log_fileswitched to a nanosecond timestamp withcreate_new(true). A short test that two consecutive calls give distinct files would help.




Summary
Fixes #529. First-build failures now offer complete, run-specific log copying with clipboard feedback, evidence-based notices, and accurate safety guidance. Activation failures are identified separately from Nix build failures; the fixed generic suggestions are removed.
The completed rebuild status retains its transcript path and clears it on retry. Copying and AI recovery use that exact file, and log filenames no longer overwrite another run in the same second. Eligible failures offer the existing Fix with AI flow; onboarding now exposes its progress, error, Review and Apply surfaces.
Test Plan
Docs
Implementation and local validation were AI-assisted.
Packaged-app smoke test before merge
Still outstanding: on a disposable test Mac/VM, reproduce a Nix evaluation failure and an activation/Homebrew failure; copy a transcript exceeding 500 lines; retry and verify the new transcript; run an eligible AI fix and confirm Retry stays disabled during review, Discard works, and activation requires the review action. Confirm unknown safety state and permission guidance as well. This local contribution does not claim that smoke test passed.
Onboarding now explains proposed changes and the apply/discard/save actions. Unsupported Back to Prompt navigation is hidden within onboarding; it remains available in the normal widget. The existing completion latch in useOnboardingFlow remains unchanged.