-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[fix]: use correct model on cache replay failure #1498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix]: use correct model on cache replay failure #1498
Conversation
🦋 Changeset detectedLatest commit: 615c997 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Greptile SummaryFixes a bug where cached
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant V3
participant ActCache
participant AgentCache
participant ActHandler
participant LLM
Note over User,LLM: Act Cache Flow
User->>V3: act(instruction, {model: "custom-model"})
V3->>V3: resolveLlmClient(options.model)
V3->>ActCache: prepareContext(instruction, page)
ActCache-->>V3: actCacheContext
V3->>ActCache: tryReplay(context, page, timeout, llmClient)
ActCache->>ActCache: replayCachedActions(context, entry, page, timeout, llmClient)
ActCache->>ActHandler: takeDeterministicAction(action, page, timeout, llmClient)
alt Action succeeds
ActHandler-->>ActCache: success
else Action fails (self-heal)
ActHandler->>LLM: Use llmClient (not default!)
LLM-->>ActHandler: New action
ActHandler-->>ActCache: Updated action
end
ActCache-->>V3: ActResult
V3-->>User: Result with correct model used
Note over User,LLM: Agent Cache Flow
User->>V3: agent({model: "custom-model"}).execute(instruction)
V3->>V3: prepareAgentExecution(options)
V3->>V3: resolveLlmClient(options.model)
V3->>AgentCache: tryReplay(context, llmClient)
AgentCache->>AgentCache: replayAgentCacheEntry(context, entry, llmClient)
loop Each step
AgentCache->>AgentCache: executeAgentReplayStep(step, ctx, handler, llmClient)
alt Act/FillForm step
AgentCache->>ActHandler: takeDeterministicAction(action, page, timeout, llmClient)
alt Action fails (self-heal)
ActHandler->>LLM: Use llmClient (not default!)
LLM-->>ActHandler: New action
end
else Goto/Scroll/Wait step
Note over AgentCache: No LLM needed
end
end
AgentCache-->>V3: AgentResult
V3-->>User: Result with correct model used
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 6 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name=".changeset/mean-melons-repeat.md">
<violation number="1" location=".changeset/mean-melons-repeat.md:5">
P2: Changeset message describes the bug behavior rather than the fix. The description says it 'uses default model' but the actual fix makes cached replays use the *originally specified model* instead of the default. Consider rewording to clarify the fix, e.g., "fix: replaying cached actions (for agent & act) now uses the originally-specified model instead of default when rerunning inference after failure"</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
.changeset/mean-melons-repeat.md
Outdated
| "@browserbasehq/stagehand": patch | ||
| --- | ||
|
|
||
| fix: replaying cached actions (for agent & act) uses default model when action fails and rerunning inference is needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Changeset message describes the bug behavior rather than the fix. The description says it 'uses default model' but the actual fix makes cached replays use the originally specified model instead of the default. Consider rewording to clarify the fix, e.g., "fix: replaying cached actions (for agent & act) now uses the originally-specified model instead of default when rerunning inference after failure"
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .changeset/mean-melons-repeat.md, line 5:
<comment>Changeset message describes the bug behavior rather than the fix. The description says it 'uses default model' but the actual fix makes cached replays use the *originally specified model* instead of the default. Consider rewording to clarify the fix, e.g., "fix: replaying cached actions (for agent & act) now uses the originally-specified model instead of default when rerunning inference after failure"</comment>
<file context>
@@ -0,0 +1,5 @@
+"@browserbasehq/stagehand": patch
+---
+
+fix: replaying cached actions (for agent & act) uses default model when action fails and rerunning inference is needed
</file context>
✅ Addressed in 2240a0d
2240a0d to
615c997
Compare
why
what changed
LLMClientfromStagehand.act()&Stagehand.agent()intoActCache.tryReplay&AgentCache.tryReplay(AsStream)so cache hits reuse the same client as their original runs and only fall back to the default when no override is providedtest plan
Summary by cubic
Fixes a bug where cache replay used the default model after an action failed; agent and act replays now use the requested model when inference is rerun. Addresses Linear STG-930.
Written for commit 615c997. Summary will update on new commits.