fix(app): return error when conversation is not found#2852
Merged
tusharmath merged 3 commits intomainfrom Apr 6, 2026
Merged
Conversation
e188476 to
79c08d9
Compare
This was referenced Apr 6, 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.
Summary
Return a proper error when a conversation is not found during chat initialization instead of panicking, and clean up stale/experimental code that accumulated around OAuth, Bedrock, and dependency management.
Context
The previous code used
unwrap_or_default().expect(...)when looking up a conversation, which would panic with a confusing message if the conversation was missing. This PR replaces that with properanyhowerror propagation so callers receive a clean, descriptive error.Alongside the bug fix, this PR removes several features and files that are no longer needed: the localhost OAuth callback server (and its
tiny_httpdependency), the BedrockSanitizeToolIdstransformer, thegoogle_ai_studioprovider, and thehexcrate (replaced byformat!("{:x}", ...)directly). The Bedrock provider model list is also restored to the stable set of GA models.Changes
find_conversationnow propagates errors properly using?andok_or_else, returning"conversation {id} not found"instead of panickingLocalhostOAuthCallbackServer: Deletedoauth_callback.rs(~526 lines) and removed thetiny_httpdependency — the OAuth flow now always prompts the user to paste the authorization codeSanitizeToolIdsBedrock transformer: Deletedbedrock_sanitize_ids.rs(~269 lines) and itsregexdependency fromforge_repogoogle_ai_studioprovider: Cleaned up theProviderIdconstant, display name mapping,from_strparsing, and related testsid_tokenfromOAuthTokenResponse: Field and associated enrichment logic for Codex OAuth removed;extract_chatgpt_account_idis now inlined directly where needed (device flow only)hexcrate: SHA-256 hex encoding now usesformat!("{:x}", hasher.finalize())in bothforge_appandforge_fssha2pinned back to0.10,similarto2.4,rustylineto17.0.2,posthog-rsto0.4.7,toml_editto0.22— aligning with upstream stable versionsKey Implementation Details
The conversation lookup change is minimal but impactful:
unwrap_or_default().expect(...)was replaced with?chaining throughok_or_else(|| anyhow::anyhow!("conversation {} not found", id)). This ensures any missing conversation surfaces as a structuredanyhow::Errorrather than a panic, which is then handled correctly by the caller.The
enrich_codex_oauth_credentialhelper was removed because theid_tokenfield (its primary input) was removed fromOAuthTokenResponse. The Codex device flow still extractschatgpt_account_idfrom the access token directly.Testing
Links