Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 2, 2026

Summary

This PR attempts to address Issue #11165 by adding support for VS Code variable interpolation in Provider Custom Headers.

Changes

New Features

  • Added interpolateHeaders function to src/utils/config.ts that supports:
    • ${workspaceFolder} - Full path to the workspace root
    • ${workspaceFolderBasename} - Just the folder name (e.g., my-repo-name)
    • ${env:VAR_NAME} - Environment variables

Integration Points

  • Integrated header interpolation in buildApiHandler (src/api/index.ts) so all providers benefit automatically
  • Updated getOpenAiModels function to interpolate headers when fetching models

Tests

  • Added comprehensive tests for the interpolateHeaders function covering:
    • Basic variable interpolation
    • Environment variable interpolation
    • Mixed variables in headers
    • Edge cases (undefined, empty, missing variables)

Usage Example

After this change, users can configure a custom header like:

X-App-ID: ${workspaceFolderBasename}

And when working in a project at /home/user/projects/my-awesome-app, the actual header sent would be:

X-App-ID: my-awesome-app

Related Issues

Closes #11165

Feedback

Feedback and guidance are welcome!


Important

Add support for VS Code variable interpolation in provider custom headers via interpolateHeaders function.

  • New Features:
    • Added interpolateHeaders function in config.ts to support ${workspaceFolder}, ${workspaceFolderBasename}, and ${env:VAR_NAME} in headers.
  • Integration:
    • Integrated interpolateHeaders in buildApiHandler in index.ts and getOpenAiModels in openai.ts for automatic header interpolation.
  • Tests:
    • Added tests for interpolateHeaders in config.spec.ts covering variable interpolation, environment variables, mixed variables, and edge cases.

This description was created by Ellipsis for f9abbd1. You can customize this summary. It will automatically update as commits are pushed.

…ders

- Add interpolateHeaders function to src/utils/config.ts
- Supports ${workspaceFolder}, ${workspaceFolderBasename}, and ${env:VAR_NAME}
- Integrate into buildApiHandler for all API providers
- Update getOpenAiModels to interpolate headers when fetching models
- Add comprehensive tests for the new functionality

Closes #11165
@roomote
Copy link
Contributor Author

roomote bot commented Feb 2, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly adds support for VS Code variable interpolation in Provider Custom Headers. The interpolateHeaders function properly handles ${workspaceFolder}, ${workspaceFolderBasename}, and ${env:VAR_NAME} patterns. All 28 tests pass.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Support ${workspaceFolderBasename} interpolation in Provider Custom Headers

1 participant