Skip to content

Conversation

@Sanskarzz
Copy link
Contributor

Issue: #3178

Description

This PR fixes a bug where the /api/v1beta/workloads (list) endpoint incorrectly reported the transport_type as streamable-http for workloads that were actually using stdio transport.

Changes

  • Updated the minimalRunConfig struct in pkg/workloads/types/types.go to include the Transport field.
  • Refactored WorkloadFromContainerInfo to:
    Load the actual transport type from the stored RunConfig.
    Use state-of-truth transport type for both the domain model and URL generation.
    Fall back to labels only if the run configuration is missing.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where the /api/v1beta/workloads list endpoint incorrectly reported transport_type as streamable-http for workloads actually using stdio transport. The fix ensures the transport type is loaded from the stored run configuration (the source of truth) rather than relying solely on container labels.

Changes:

  • Added Transport field to minimalRunConfig struct to capture the transport type from stored configurations
  • Updated WorkloadFromContainerInfo to use the transport type from the run configuration when available, falling back to labels only if the configuration is missing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 83 to 85
if runConfig.Transport != "" {
tType = runConfig.Transport
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The transportType variable from line 69 is now unused after this change. The code first parses the label into transportType, then parses it again into tType, and then overwrites tType with the value from runConfig.Transport. Consider removing the transportType variable entirely and just using tType throughout, or rename the variable from line 69 to make it clear it's only used as a fallback.

Copilot uses AI. Check for mistakes.
Comment on lines 83 to 85
if runConfig.Transport != "" {
tType = runConfig.Transport
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The changes to the WorkloadFromContainerInfo function introduce new behavior for loading and using the transport type from the run configuration, but there are no tests covering this function. Consider adding unit tests to verify that:

  1. The transport type is correctly loaded from the run configuration when available
  2. The function falls back to the label-based transport type when the run configuration is missing or doesn't contain a transport field
  3. The URL is generated with the correct transport type from the run configuration

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@amirejaz amirejaz left a comment

Choose a reason for hiding this comment

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

Hi @Sanskarzz, thanks for the contribution! The fix works, but we need to adjust how the container transport label is set.

Right now, the transport label stored on the container is using the proxy-mode value instead of the actual transport type. Because of that, we had to read the transport from runConfig. If we update the container label to correctly reflect the transport type, this additional logic can be removed and the correct value will already be available via the container labels.

@Sanskarzz Sanskarzz requested a review from amirejaz January 20, 2026 14:07
@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Jan 20, 2026
@amirejaz
Copy link
Contributor

@Sanskarzz this looks good. There are some CI test failures and a few lint errors to address.

Signed-off-by: Sanskarzz <[email protected]>
@github-actions github-actions bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Jan 21, 2026
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.85%. Comparing base (5ff5cfe) to head (fda98a1).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3313      +/-   ##
==========================================
+ Coverage   64.78%   64.85%   +0.06%     
==========================================
  Files         372      372              
  Lines       36292    36288       -4     
==========================================
+ Hits        23513    23534      +21     
+ Misses      10932    10905      -27     
- Partials     1847     1849       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amirejaz amirejaz merged commit 0e4480b into stacklok:main Jan 21, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants