Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: classify slow gbrain probes separately#1969

Open
RudraMalvankar wants to merge 1 commit into
garrytan:main from
RudraMalvankar:fix/gbrain-slow-engine-timeout
Open

fix: classify slow gbrain probes separately #1969
RudraMalvankar wants to merge 1 commit into
garrytan:main from
RudraMalvankar:fix/gbrain-slow-engine-timeout

Conversation

@RudraMalvankar

@RudraMalvankar RudraMalvankar commented Jun 11, 2026

Copy link
Copy Markdown

Related Issue

Closes #1964

Summary

This PR fixes an issue where healthy but slow gbrain engines could be incorrectly classified as broken-config when the probe operation exceeded the default timeout threshold.

In environments where the gbrain CLI takes longer than 5 seconds to respond (for example, when using remote databases or connection poolers), the probe would time out and fall back to the generic broken-config classification. As a result, /sync-gbrain skipped the code and memory stages even though the engine itself was healthy and operational.

Changes Made

1. Added a dedicated slow-engine status

Introduced a new LocalEngineStatus value:

"slow-engine"

This allows timeout-related failures to be distinguished from actual configuration problems.

2. Improved timeout handling

The classifier now explicitly detects timeout conditions (such as ETIMEDOUT) and returns slow-engine instead of incorrectly falling back to broken-config.

3. Made probe timeout configurable

Replaced the hardcoded timeout value with an environment-variable-based configuration:

GSTACK_GBRAIN_PROBE_TIMEOUT_MS

This allows users with slower database connections or remote infrastructure to adjust the probe timeout without modifying source code.

4. Increased the default timeout

Updated the default probe timeout from:

5000ms

to:

20000ms

This better accommodates slower but healthy environments while still preventing indefinite waits.

5. Added a user-friendly sync message

When a slow engine is detected, users now receive a clear explanation indicating that the engine may still be healthy and suggesting increasing the timeout or improving database connectivity, rather than being told their configuration is malformed.

Why This Change?

The original behavior treated timeout failures as configuration failures, which could mislead users into troubleshooting the wrong component. This PR separates slow-response scenarios from actual configuration issues, making diagnostics more accurate and improving the overall user experience.

Testing

  • Verified that timeout-related failures are classified as slow-engine.
  • Verified that existing broken-config and broken-db classifications remain unchanged.
  • Verified that the timeout can be configured using GSTACK_GBRAIN_PROBE_TIMEOUT_MS.
  • Verified that sync skip messages now provide more accurate guidance for slow environments.

Checklist

  • Code follows project style
  • No unrelated changes included
  • Existing behavior preserved for valid configurations
  • Added clearer handling for slow-engine scenarios

trunk-io Bot commented Jun 11, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

gbrain-local-status: 5s probe timeout misclassifies healthy-but-slow engines as broken-config; /sync-gbrain skips code+memory

1 participant

AltStyle によって変換されたページ (->オリジナル) /