fix(desktop): preserve generation timeout reason and raise dropdown ceiling#169
Open
fix(desktop): preserve generation timeout reason and raise dropdown ceiling#169
Conversation
…eiling (#164) When a long-running generation hits the configured timeout, the main-process AbortController was stamped with a CodesignError(GENERATION_TIMEOUT) — but the Anthropic / OpenAI SDKs catch the aborted fetch and rethrow a generic 'Request was aborted.' error, dropping signal.reason. The user ended up with an opaque message with no hint about which limit was hit or where to raise it. - Add extractGenerationTimeoutError(signal) to recover the stashed error. - Both generate IPC catches (v1 + legacy) now upgrade the SDK error back to GENERATION_TIMEOUT when our own timer fired, so the log row and the renderer toast both show the configured seconds + Settings → Advanced path. - Expand the Settings timeout dropdown to 60s / 2m / 3m / 5m / 10m / 20m / 30m / 1h / 2h (the default prefs value is 1200s but the old 60-300s list silently downgraded to 300 on save). When a stored value is outside the canonical list, inject it so the select shows the user's existing choice instead of rendering blank. Signed-off-by: hqhq1025 <1506751656@qq.com>
f5c9aea to
423f0dd
Compare
Contributor
There was a problem hiding this comment.
Findings
- None.
Summary
- Review mode: initial
- No issues were identified on added/modified lines in this diff at high confidence.
- Residual risk:
docs/VISION.mdanddocs/PRINCIPLES.mdwere not found in this checkout (Not found in repo/docs), so architectural/principle alignment could only be checked againstCLAUDE.mdand the changed code/tests.
Testing
- Not run (automation)
open-codesign Bot
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 #164.
Summary
armGenerationTimeoutcallscontroller.abort(new CodesignError('Generation aborted after {n}s (Settings → Advanced → Generation timeout).', 'GENERATION_TIMEOUT')). But the Anthropic and OpenAI SDKs catch the aborted fetch and rethrow their own generic'Request was aborted.', which dropssignal.reason. The main-processcatchthen logged and re-threw that opaque error, so the user never saw the configured timeout or where to change it.extractGenerationTimeoutError(signal)reads back theCodesignErrorwe stashed. Bothcodesign:v1:generateand the legacycodesign:generatecatch blocks now prefer it over the rewritten SDK error, so the log row and the renderer toast both carryGENERATION_TIMEOUTwith the full message.updatePrefsilently downgraded on save (covered inproject_bug_settings_timeout_dropdownmemory — this PR resolves that). Options now run 60s / 2m / 3m / 5m / 10m / 20m / 30m / 1h / 2h, and a stored value outside the list is injected so the user's existing choice is preserved.Changes
apps/desktop/src/main/generation-ipc.ts— exportextractGenerationTimeoutError(signal).apps/desktop/src/main/index.ts— both generate catch blocks upgrade the SDK error back toGENERATION_TIMEOUTwhen our timer fired.apps/desktop/src/renderer/src/components/Settings.tsx—TIMEOUT_OPTION_SECONDS+resolveTimeoutOptions(currentSec)helper; dropdown maps from it.extractGenerationTimeoutErrorsuite (4 cases) +resolveTimeoutOptionssuite (4 cases).PRINCIPLES §5b
resolveTimeoutOptionsmerges unknown stored values, so we can change the canonical list in the future without stranding user settings.Test plan
pnpm typecheck— 10/10 tasks pass.pnpm --filter @open-codesign/desktop test -- --run— 878/878 pass.pnpm lint— clean.Coordination
retry.tsorremapProviderError(out of scope, other PRs own those).applyGenerateErrorin the renderer store — the richer error code already flows through the normal error pipeline; a follow-up can add a "Open Settings" secondary action on the toast if desired.😇