Skip to content

BYOC: Fix Orchestrator streaming reserve capacity#3857

Merged
ad-astra-video merged 6 commits intolivepeer:masterfrom
muxionlabs:fix-streaming-reserve-capacity
Jan 21, 2026
Merged

BYOC: Fix Orchestrator streaming reserve capacity#3857
ad-astra-video merged 6 commits intolivepeer:masterfrom
muxionlabs:fix-streaming-reserve-capacity

Conversation

@ad-astra-video
Copy link
Collaborator

What does this pull request do? Explain your changes. (required)

Fixes bug introduces when spliting BYOC to separate gateway and orchestrator streaming files.

Part of the fix is also returning a JobToken even when there is no capacity. This enables reporting capacity available when job token sent

No net new features added, just bug fix and refactor.

Specific updates (required)

  • Fixed verifyJobCreds function in BYOCOrchestratorServer and simplified same function for Gateway to only parse the request.
  • Added test to check that reserve capacity function is called
  • Updated CheckExternalCapabilityCapacity to return net capacity available
  • Updated GetToken to return JobToken even if no capacity. No major change on this one but removing the if block makes the diff kind of ugly.
  • Updated getJobOrchestrators to use token.AvailableCapacity to determine if Orchestrator should be in working set (0 = excluded)

How did you test each of these updates (required)

Added test and built and ran local docker containers for Gateway and Orchestrator to test full stack.

Does this pull request close any open issues?

Checklist:

@github-actions github-actions bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Jan 16, 2026
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 72.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.24679%. Comparing base (34e6a34) to head (a03ba06).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
byoc/job_orchestrator.go 75.67568% 6 Missing and 3 partials ⚠️
core/ai_orchestrator.go 0.00000% 4 Missing ⚠️
byoc/job_gateway.go 87.50000% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3857         +/-   ##
===================================================
- Coverage   32.25814%   32.24679%   -0.01135%     
===================================================
  Files            169         169                 
  Lines          41202       41201          -1     
===================================================
- Hits           13291       13286          -5     
- Misses         26907       26915          +8     
+ Partials        1004        1000          -4     
Files with missing lines Coverage Δ
byoc/stream_orchestrator.go 36.02694% <100.00000%> (+1.68351%) ⬆️
byoc/types.go 46.15385% <ø> (ø)
server/rpc.go 69.41896% <ø> (ø)
byoc/job_gateway.go 43.36570% <87.50000%> (ø)
core/ai_orchestrator.go 30.53735% <0.00000%> (+0.13106%) ⬆️
byoc/job_orchestrator.go 40.88398% <75.67568%> (-0.16285%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 34e6a34...a03ba06. Read the comment docs.

Files with missing lines Coverage Δ
byoc/stream_orchestrator.go 36.02694% <100.00000%> (+1.68351%) ⬆️
byoc/types.go 46.15385% <ø> (ø)
server/rpc.go 69.41896% <ø> (ø)
byoc/job_gateway.go 43.36570% <87.50000%> (ø)
core/ai_orchestrator.go 30.53735% <0.00000%> (+0.13106%) ⬆️
byoc/job_orchestrator.go 40.88398% <75.67568%> (-0.16285%) ⬇️

... and 1 file with indirect coverage changes

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

Copy link
Collaborator

@eliteprox eliteprox left a comment

Choose a reason for hiding this comment

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

Changes LGTM! Added small nit on related lines

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be respTimeout or timeout from getJobOrchestrators() instead of 500 milliseconds? Note that respTimeout at the getJobOrchestrators() scope is unused.

Small nit, there is some ambiguity with the respTimeout variable name reused in getOrchJobToken, would suggest to rename one of them or remove the first if it remains unused

Copy link
Collaborator Author

@ad-astra-video ad-astra-video Jan 21, 2026

Choose a reason for hiding this comment

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

Good catch, updated and included a small improvement to the get orchestrators loop with the timeout in 545b14e.

Note that the getOrchSerachTimeouts applies defaults if no timeouts are set. respTimeout default is 500ms and the searchTimeout is 1s. The searchTimeout is what it waits for all the responses and the respTimeout applies to each request to the Orchestrator.

Balance: capBalInt,
Price: jobPrice,
ServiceAddr: orch.ServiceURI().String(),
AvailableCapacity: capacity,
Copy link
Collaborator

@eliteprox eliteprox Jan 19, 2026

Choose a reason for hiding this comment

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

I think it's worth noting that JobTokens generally can't be changed during the active stream, so this value will always reflect the capacity available when the orchestrator was selected for the job, is that correct?

Not sure if a code comment is needed or anything, just adding context here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, each JobToken is a point in time representation of information from the Orchestrator. They are requested and generated on demand for a stream start and refreshed when failing over to another Orchestrator to ensure fresh. The stream stop request gets a fresh token as well. Status and Update requests do not use the token since its just using a stream already running and paid for.

@eliteprox
Copy link
Collaborator

Please also update CHANGELOG_PENDING.md

@ad-astra-video
Copy link
Collaborator Author

Please also update CHANGELOG_PENDING.md

Updated in eef7567

@ad-astra-video ad-astra-video merged commit 92bdb59 into livepeer:master Jan 21, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Issues and PR related to the AI-video branch. go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants