Repository navigation
Keep the restore error and stop the tool once when tray start-up fails - #26
Merged
Merged
Conversation
A successful OnStart cleared the preference-restore error seeded into the menu, so the status line looked healthy although the remembered setting was not applied. The start sequence now re-seeds it after a successful start; a failed start still reports its own error. When start-up threw after OnStart had run, RunTray saw HasStarted false, skipped OnStop and fell back to the console, which called OnStart again. TrayApplication now records ToolStarted separately: Dispose stops the tool on it, and RunTray reports the failure and exits 1 instead of restarting the tool in the terminal. Fixes #12 Fixes #13 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tqaKZaJ9nxFMskVoZgreK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011tqaKZaJ9nxFMskVoZgreK
|
This was referenced Sep 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #12
Fixes #13
Both bugs are in
TrayApplication's start sequence, and the triage on each said to fix them together, so they share this PR.#12: a failed preference restore was hidden by a successful
OnStartTrayMenu.RunclearsLastErroron success. That wiped the restore error seeded byRunTraybefore the menu was ever painted. The start action now runs in a newTrayApplication.StartTool(), which puts the seeded error back when the start succeeds. A failed start still reports its own error.#13: tray start-up that threw after
OnStartstarted the tool twiceTrayApplicationnow recordsToolStartedwhen the start action runs, separately fromHasStarted:Disposestops the tool whenToolStartedis set. It used to checkHasStarted, which is still false if start-up threw partway.RunTray's catch has moved toTrayAppBuilder.RecoverFromTrayFailureso that it can be tested. When the tool has started but the tray has not finished starting, it disposes the host, which callsOnStoponce. It then reports the error and exits 1, instead of printing "could not show a tray icon" and callingOnStartagain fromConsoleRunner.The README's "Load-bearing behaviour" table has a row for each.
Tests
Five new tests in
TrayApplicationTestsexerciseStartToolandRecoverFromTrayFailurewithout a display. Three of them failed before the fix:StartTool_WhenTheStartActionSucceeds_KeepsTheSeededRestoreErrorDispose_AfterTheToolStartedButBeforeTheTrayFinishedStarting_StopsTheToolRecoverFromTrayFailure_AfterTheToolStarted_DoesNotStartItAgain(OnStartran twice)The other two check behaviour that must not change: a failed start reports its own error, and a refusal before start still falls back to the console. The full suite passes locally: 122 passed, 1 skipped because it is platform-conditional. The solution builds with 0 warnings.
Not done: the optional check that icon resources exist in
Build(), which #13 suggested. With this change a mistyped icon name no longer double-starts the tool, so that check would be a separate improvement.🤖 Generated with Claude Code
https://claude.ai/code/session_011tqaKZaJ9nxFMskVoZgreK
Generated by Claude Code