Skip to content

[Compute Separation] M3b: host.json delivery via gRPC #11646

@brettsam

Description

@brettsam

In separated compute, the host cannot read host.json from disk — it lives in the worker's container. The worker sends it in StartStream.host_configuration_json. A custom IConfigurationSource blocks in ConfigureAppConfiguration until the worker provides it.

This works because the gRPC server starts at the WebHost level (via RpcInitializationService) before the ScriptHost is built.

Dependencies: M3 (#11645), PROTO (#11642)

Deliverables

File Purpose
ExternalWorkers/HostJsonContentProvider.cs WebHost singleton — SetContent() from gRPC, WaitForContent() for config pipeline, Reset() for restarts
ExternalWorkers/ExternalWorkerHostJsonConfigurationSource.cs IConfigurationSource + ConfigurationProvider — blocks in Load()
ScriptHostBuilderExtensions.cs (modified) Conditional swap of config source
Server/FunctionRpcService.cs (modified) Intercept host_configuration_json from StartStream

Restart Handling

Scenario Behavior
ScriptHost restarts, worker connected Reset() keeps cache → next Load() immediate
Worker disconnects Reset(clearCache: true) → next Load() blocks
Placeholder mode Returns default config {"version":"2.0"} without blocking

Acceptance Criteria

  • host.json from StartStream is parsed and applied as configuration
  • All downstream option bindings (ScriptJobHostOptions, etc.) receive correct values
  • Placeholder mode returns defaults without blocking
  • ScriptHost restart uses cached content when worker is still connected
  • Worker disconnect clears cache
  • HostJsonFileConfigurationSource is unchanged
  • Unit tests

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions