Repository navigation
Conversation
Fixes ai-openshell#36 Signed-off-by: Artem Lytvyn <letv1n2007@icloud.com>
rhuss
reviewed
Nov 20, 2026
rhuss
left a comment
Contributor
There was a problem hiding this comment.
cc-review Summary
What Went Well
openshell/v1/sandbox_client.goWatch (line 455) now sends through the sharedw.emit(streamCtx, ...)helper, which also selects onctx.Done(). A producer blocked on a full 64-slot buffer exits when the caller cancels, and status Watch now shares one send-or-stop path withretryWatchLogsinsandbox_watch_logs.go, as issue #36 asked.openshell/v1/sandbox_client.go:466-469collapses two nested selects into one guard with a comment explaining why. It uses the same suppression rule asretryWatchLogs(sandbox_watch_logs.go:169), so caller-initiated cancellation is no longer reported as a failure while real gateway errors still surface asEventError.- The Watch goroutine's
defer close(ch)anddefer streamCancel()close the channel and release the stream context on every exit path (EOF, error, Stop, ctx cancel, StopOnTerminal). TestSandboxWatch_ContextCancelUnblocksFullChannelinopenshell/v1/sandbox_client_test.gowaits withrequire.Eventuallyuntillen(ch) == cap(ch)before cancelling and bounds delivered events bycap(ch)+1, so it hits the blocked-producer path directly instead of relying on timing.- The
sandboxEventsanddrainSandboxWatchhelpers (sandbox_client_test.golines 1166-1196) keep the new tests short, and the 5s drain timeout turns a producer that never closes into a clear failure instead of a hung suite. docs/src/api/sandboxes.md:230keeps the user-facing docs in sync with the new close/error contract.
Findings
| Severity | File | Description | Source |
|---|---|---|---|
| Minor | openshell/v1/sandbox_client.go:398 | The new close/error contract for Watch is documented on the unexported sandboxClient.Watch met... |
architecture |
| Minor | openshell/v1/sandbox_client.go:468 | The newly documented guarantee that Stop closes the Watch channel without an EventError (even... |
test-quality |
| Minor | openshell/v1/sandbox_client.go:468 | Watch now closes the channel silently when ctx's deadline expires. The guard recvErr != io.EOF... |
gator |
Review Details
These findings were produced by cc-review's reviewer agents and posted without a per-finding review.
- Findings posted: 3
- Findings reviewed and not posted: 0
- Gate outcome: PASS
- Participating reviewers: architecture, test-quality, gator
…tract on the interface Signed-off-by: Artem Lytvyn <letv1n2007@icloud.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36
The sandbox
Watchgoroutine now useswatcher.emit/stoppedinstead of its own selects, so it shares delivery logic withWatchLogs. That also fixes a leak: if a caller cancelledctxwithout reading, the goroutine stayed blocked on a full channel.Behaviour change: cancelling
ctxnow closes the channel without a finalEventError(Cancelled), matchingStop,WatchLogsand the fake client. Callers that need to know why a watch ended should checkctx.Err().Testing: two new tests (cancel with a full channel, cancel closes without an error). Both fail against the old code. Ran
-race -count=10andmise run ci.