Skip to content

fix(search): oversized thread queries no longer crash clients - #6633

Merged
maria-rcks merged 1 commit into
pingdotgg:mainfrom
Lucenx9:agent/fix-oversized-thread-search
Aug 22, 2026
Merged

fix(search): oversized thread queries no longer crash clients#6633
maria-rcks merged 1 commit into
pingdotgg:mainfrom
Lucenx9:agent/fix-oversized-thread-search

Conversation

@Lucenx9

@Lucenx9 Lucenx9 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What Changed

Thread content search could throw in web and mobile when a query exceeded the 200-character contract limit because the shared atom decoded its cache key synchronously.

Search keys are now decoded safely from JSON at the shared client-runtime boundary. Out-of-contract or malformed keys return an empty content-search state without issuing environment requests, while valid queries and local title matching continue unchanged. Boundary tests cover maximum-length normalization, oversized queries, and malformed JSON.

Why

A long query typed into the command palette or mobile thread search could abort client rendering. Treating out-of-contract content searches as empty keeps both clients usable and preserves the server's existing bounded-query contract.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (not applicable; no UI changes)
  • I included a video for animation/interaction changes (not applicable; no animation or interaction changes)

Created with gpt-5.6-sol using the Codex harness in T3 Code.

Note

Fix oversized or malformed thread search keys to return empty state instead of crashing

  • ThreadSearchKey schema in threadSearch.ts now decodes via Schema.decodeUnknownOption, returning None on invalid input instead of throwing.
  • createThreadSearchResultsAtomFamily returns { matches: [], isLoading: false } immediately when the key parses to None, skipping any search invocation.
  • Tests added in threadSearch.test.ts covering boundary-length valid keys and over-length/malformed keys.

Macroscope summarized 12faef0.


Note

Low Risk
Localized defensive change in shared search state with tests; no auth, data, or API contract changes beyond avoiding client crashes.

Overview
Thread content search in client-runtime no longer throws when a cache key is out of contract or malformed.

threadSearch.ts decodes search keys with Schema.fromJsonString and decodeUnknownOption instead of JSON.parse plus synchronous decode. Keys that fail validation (e.g. query over the 200-character limit) or invalid JSON yield { matches: [], isLoading: false } and do not call per-environment search atoms.

threadSearch.test.ts adds coverage for max-length valid keys (including trimmed whitespace) and for over-length and malformed keys asserting zero search invocations.

Reviewed by Cursor Bugbot for commit 12faef0. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 191e31ba-3d4a-44fd-80ba-3d9b266059fa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 14, 2026
@Lucenx9
Lucenx9 marked this pull request as ready for review August 14, 2026 18:24
@macroscopeapp

macroscopeapp Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 12faef0

This is a straightforward defensive bug fix that prevents client crashes from invalid search queries. The change switches from throwing exceptions to gracefully returning empty results for malformed inputs, with comprehensive test coverage added.

You can customize Macroscope's approvability policy. Learn more.

@CDVolvik CDVolvik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

threadSearch.test.ts: 6/6. Keys at 200 chars still search; 201 and malformed JSON return empty and do not call getSearchAtom.

Schema.fromJsonString + decodeUnknownOption replaces JSON.parse that could throw into the atom. That is the crash. MERGEABLE.

@maria-rcks
maria-rcks merged commit 421088c into pingdotgg:main Aug 22, 2026
23 checks passed
BarretoDiego added a commit to BarretoDiego/t3code that referenced this pull request Aug 22, 2026
- Corrige backend salvo diretamente que ocultava seu ambiente T3 Connect (pingdotgg#7086), ajustando `environmentSections` e o `useConnectionController`
- Corrige queries de busca de thread grandes demais que derrubavam os clients (pingdotgg#6633), em `threadSearch` no `client-runtime`
- Adiciona cobertura de testes para os dois casos: `environmentSections.test.ts`, `threadSearch.test.ts` e `DesktopClientSettings.test.ts`
- 2 commits do upstream, 6 arquivos alterados (+114/-15), sem conflitos com as modificações do fork

Sync automatico t3code-sync em 2026-08-22T00:08:13-03:00
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 22, 2026
## What's Changed
* fix(search): oversized thread queries no longer crash clients by @Lucenx9 in pingdotgg/t3code#6633
* fix(mobile): stop a directly-saved backend from hiding its T3 Connect environment by @Rishet11 in pingdotgg/t3code#7086


**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260822.1155...v0.0.34-nightly.20260822.1156

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260822.1156
frankdavidcorona pushed a commit to frankdavidcorona/t3code that referenced this pull request Aug 23, 2026
…tgg#6633)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
cloudbridgeuy pushed a commit to cloudbridgeuy/t3code that referenced this pull request Aug 23, 2026
…tgg#6633)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants