fix(server): observe persisted sandbox watch updates - #2257
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Signed-off-by: Evan Lezar <elezar@nvidia.com>
a79e28a to
1d24eff
Compare
elezar
left a comment
There was a problem hiding this comment.
gator-agent
PR Review Status
Validation: Maintainer-authored, small concentrated server consistency fix related to #1868; project-valid for OpenShell.
Head SHA: 1d24eff77d8313924173a28014f1ffa0f4e5b39a
Review findings:
- Two warning-level findings remain and are posted inline.
Docs: Not needed; this changes internal server watch consistency and does not change CLI, configuration, Fern docs workflows, or public policy/provider setup.
Checks: Required gates are currently green: DCOAssistant, OpenShell / Branch Checks, OpenShell / Helm Lint, OpenShell / E2E, and OpenShell / GPU E2E.
Next state: gator:in-review
| Ok(()) => { | ||
| match state.store.get_message::<Sandbox>(&sandbox_id).await { | ||
| Ok(Some(sandbox)) => { | ||
| last_sandbox_resource_version = |
There was a problem hiding this comment.
gator-agent
Warning: The bus path updates last_sandbox_resource_version but does not dedupe before sending. If the store poll observes a local write before the broadcast receiver runs, the later bus event can emit the same resource_version again. Please apply the same guard used in the poll branch before sending, for example:
let resource_version = sandbox.get_resource_version();
if last_sandbox_resource_version == Some(resource_version) {
continue;
}
last_sandbox_resource_version = Some(resource_version);| } | ||
| if stop_on_terminal { | ||
| let phase = SandboxPhase::try_from(sandbox.phase()).unwrap_or(SandboxPhase::Unknown); | ||
| if phase == SandboxPhase::Ready { |
There was a problem hiding this comment.
gator-agent
Warning: The new persisted-update path only stops on Ready, but WatchSandboxRequest.stop_on_terminal is documented as “READY or ERROR.” A remote process can now persist Error, the stream will emit it, then keep polling. Please use a shared terminal check such as matches!(phase, SandboxPhase::Ready | SandboxPhase::Error) in all stop checks, and add a regression for Provisioning -> Error via store polling.
Summary
Make
WatchSandboxstatus-follow streams observe sandbox changes persisted by another gateway process. The existing in-memory notification bus remains the fast path; a bounded store reconciliation closes the cross-process consistency gap.Related Issue
Related to #1868. This is a generally applicable consistency fix extracted from the HA review.
Changes
follow_statusis enabled.resource_versionchanges.Testing
mise run pre-commitpasses (run insidenix develop)Focused regression test:
nix develop -c cargo test -p openshell-server watch_sandbox_observes_store_update_without_local_notification --libOperational tradeoff
Each active
WatchSandboxstream withfollow_status=trueperforms one indexed single-record store read per second. This intentionally favors a small, isolated consistency fix over adding a database-specific notification mechanism. Streams that only follow logs or platform events do not poll. A future shared-store watch abstraction could coalesce reads if sustained watcher volume makes this material.Checklist