Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(client): skip irrelevant exit-code scans in tool output #12782

Closedrobertnisipeanu(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12782/headopened View on GitHub

Large tool outputs are scanned by three exit-code regexes even when they contain no exit-code text. This adds CPU work while classifying historical activity rows.

Check for the required case-insensitive exit code substring before running the existing regexes. All failure phrases, exit-code rules, and legacy command/detail handling are preserved. The shared classifier serves web, desktop, and mobile; this change adds no cache, truncation, or data-retention policy.

Validation: 206 focused presentation/mobile-feed tests pass on this standalone branch, along with client-runtime typecheck and targeted lint. The implementation and behavior tests match the independently reviewed patch. In a synthetic native iOS Release/Hermes comparison of 500-tool-call histories, the guard reduced median fresh-feed computation from 425.83 ms to 319.05 ms with identical serialized output. That comparison held the mobile feed implementation constant on both sides, including its row caches, to isolate the classifier change; this PR contains only the classifier guard and its tests. It does not depend on the mobile row-cache change.

The native benchmark alternated baseline and candidate, used fresh fixture objects for each run, and measured 16 rounds after four warmup rounds. It measures feed computation, not total loading time, whole-app CPU, or physical-phone battery use. All published fixtures and measurements are synthetic. There is no intended visual change.

Created with GPT-6 Astra in Codex.

Summary by CodeRabbit

  • Reliability

    • Improved the consistency of tool failure detection across long outputs, split error messages, and incomplete status markers.
    • Ensured successful results remain correctly classified when exit codes or partial phrases do not indicate failure.
  • Performance

    • Reduced unnecessary checks while evaluating tool status, with no change to expected results.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at a43c047

      Macroscope's review found this PR approvable — This is a localized performance optimization that skips three exit-code regex scans when tool output cannot contain an exit-code marker, while preserving existing classification behavior. Added tests cover the supported failure and non-failure cases, and no product defaults or static-analysis settings are changed.

      No code changes detected at 6ddbbc9. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review Change StackReview Change Stack

      Important

      Review skipped

      Review was skipped as selected files did not have any reviewable changes.

      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 7e81c50e-a19f-483e-a26b-820c8c1583b9

      📥 Commits

      Reviewing files that changed from the base of the PR and between a43c047b8a134257f574b9cd5996c2cd80274490 and 6ddbbc9888fe3df934065145dbae36477f6606f4.

      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

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration

      Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml

      Review profile: CHILL

      Plan: Advanced

      Run ID: 1d32f468-5451-4f28-8554-c81089aed0f4

      📥 Commits

      Reviewing files that changed from the base of the PR and between fa1e1715538f6f8ac076761f7821f68479f616ab and a43c047b8a134257f574b9cd5996c2cd80274490.

      📒 Files selected for processing (2)
      • packages/client-runtime/src/work-log/presentation.test.ts
      • packages/client-runtime/src/work-log/presentation.ts

      Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


      📝 Walkthrough

      Walkthrough

      The change adds regression tests for tool failure detection and guards exit-code regex checks with an "exit code" substring check. The matching behavior remains unchanged.

      Changes

      Tool failure detection

      Layer / File(s)Summary
      Exit-code detection guard
      packages/client-runtime/src/work-log/presentation.ts
      Exit-code regex checks now run only when normalized text contains "exit code".
      Failure detection regression tests
      packages/client-runtime/src/work-log/presentation.test.ts
      Tests cover long successful output before failures, incomplete and benign markers, exit-code boundaries, and phrases split across detail and command fields.

      Priority: ⬇️ Low

      Estimated code review effort: 1 (Trivial) | ~5 minutes

      Change: Refactor

      Suggested reviewers: juliusmarminge

      🚥 Pre-merge checks | ✅ 5
      ✅ Passed checks (5 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly describes the main change: improving client tool-output performance by skipping irrelevant exit-code scans.
      Description check✅ PassedThe description clearly explains what changed, why it changed, validation results, benchmark context, scope, and the absence of UI changes. It does not use the template headings or include the checkli…
      Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR

      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge added labelsmacroscope-review

    5. Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.

      The patch conflicts with the rewrite in packages/client-runtime/src/work-log/presentation.ts. Even where the conflict is small enough to rebase, we are asking for fresh PRs against the new base so we can review and verify the behavior in V2.

      Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.

    6. juliusmarminge closed this

Sign in to join this conversation.