[STG-1802] fix: abort immediately for already-aborted agent signals#1982
Open
[STG-1802] fix: abort immediately for already-aborted agent signals#1982
Conversation
Contributor
There was a problem hiding this comment.
No issues found across 4 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant App as Client Application
participant V3 as V3 Core (Stagehand)
participant BB as Browserbase / Session
participant LLM as LLM Client
Note over App, LLM: Agent Execution Flow (with AbortSignal)
App->>V3: agent.execute({ instruction, signal })
V3->>V3: NEW: throwAgentAbortIfAborted(signal)
alt NEW: Signal is already aborted (Fast Path)
V3-->>App: throw AgentAbortError (reason)
Note right of V3: Execution stops before initializing resources
else Signal is active
V3->>V3: validateExperimentalFeatures()
opt CHANGED: If not initialized (Integration Tests)
V3->>BB: init() / Session Setup
BB-->>V3: session ready
end
V3->>LLM: setup & query handler
loop Agent Loop
V3->>LLM: Generate next action
LLM-->>V3: action
V3->>BB: Perform action on Page
opt Signal aborted during execution
V3-->>App: throw AgentAbortError
end
end
V3-->>App: AgentResult / Stream
end
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.
Summary
Verification
Linear: https://linear.app/browserbase/issue/STG-1802/abort-immediately-for-already-aborted-agent-signals
Summary by cubic
Abort agents immediately when given an already-aborted signal, throwing
AgentAbortErrorbefore any setup. Aligns with Linear STG-1802 and removes flakiness in the immediate-abort path for@browserbasehq/stagehand.throwAgentAbortIfAborted), usingsignal.reasonwhen present.Written for commit b84f012. Summary will update on new commits. Review in cubic