Skip to content

skip source init exp#3079

Draft
twishabansal wants to merge 2 commits intomainfrom
skip-source-init-exp
Draft

skip source init exp#3079
twishabansal wants to merge 2 commits intomainfrom
skip-source-init-exp

Conversation

@twishabansal
Copy link
Copy Markdown
Contributor

Description

Should include a concise description of the changes (bug or feature), it's
impact, along with a summary of the solution

PR Checklist

Thank you for opening a Pull Request! Before submitting your PR, there are a
few things you can do to make sure it goes smoothly:

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

@twishabansal twishabansal added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 16, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a 'SkipSourceInitialization' configuration option, allowing the server to proceed with uninitialized sources using a placeholder 'UninitializedSource' struct. This is particularly useful for CLI tools or environments where full source connectivity isn't immediately required. Feedback suggests improving log searchability by using structured logging attributes and adding panic recovery to handle potential type assertion failures on uninitialized sources. Additionally, the PR title and description must be updated to comply with the repository's style guide regarding Conventional Commits and the required template.

Comment thread internal/server/server.go
t, err := tc.Initialize(sourcesMap)
if err != nil {
if cfg.SkipSourceInitialization {
l.WarnContext(ctx, fmt.Sprintf("unable to initialize tool %q (source skip enabled): %v", name, err))
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.

medium

Leveraging structured logging by passing the tool name and error as separate attributes is preferred over fmt.Sprintf. This improves log searchability and consistency with other parts of the codebase (e.g., line 465).

Additionally, consider wrapping the tc.Initialize call in a recover() block when SkipSourceInitialization is enabled. This would prevent the server (or CLI tool) from crashing if a tool performs a concrete type assertion on an UninitializedSource and panics.

Suggested change
l.WarnContext(ctx, fmt.Sprintf("unable to initialize tool %q (source skip enabled): %v", name, err))
l.WarnContext(ctx, "unable to initialize tool (source skip enabled)", "tool", name, "error", err)

Comment thread internal/server/config.go
Comment on lines +87 to +88
// SkipSourceInitialization indicates if the server should skip initializing sources.
SkipSourceInitialization bool
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.

medium

The pull request title and description do not adhere to the repository's style guide.

  • Title: Should follow the Conventional Commits format (e.g., feat(server): add skip source initialization option). Currently: skip source init exp.
  • Description: The provided description is empty and contains only the template placeholders. Please provide a concise summary of the changes and their impact.
References
  1. PR title must follow the Conventional Commits format: (): . (link)
  2. Every PR must include a description that follows the repository's template. (link)

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

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant