[fix]: harden act variables prompt#1922
Merged
seanmcguire12 merged 1 commit intomainfrom Mar 31, 2026
Merged
Conversation
|
Contributor
There was a problem hiding this comment.
No issues found across 2 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 User Application
participant Inf as Inference Service (act/stepTwo)
participant PB as Prompt Builder
participant LLM as AI Model (External)
participant RP as Regex Processor
Note over App,RP: Execution flow for actions involving dynamic variables
App->>Inf: act(instruction, variables)
rect rgb(240, 240, 240)
Note over Inf,PB: Prompt Construction Phase
Inf->>PB: buildActPrompt / buildStepTwoPrompt
PB->>PB: NEW: buildActVariablesPrompt(variables)
Note right of PB: Maps keys to %key% format<br/>Injects strict usage instructions
end
PB-->>Inf: Combined Prompt String
Inf->>LLM: Send Prompt + Zod Schema
Note over LLM: Schema CHANGED: Element ID<br/>now includes '0-76' examples
LLM-->>Inf: Structured JSON Response (elementId, arguments)
rect rgb(230, 245, 230)
Note over Inf,RP: Variable Substitution Phase
Inf->>RP: processArguments(arguments, variables)
alt Model followed instructions (%variable%)
RP->>RP: Regex matches %variableName%
RP->>RP: Replace placeholder with actual value
else Model returned raw variable name
Note right of RP: Regex fails to match.<br/>Action executed with raw string.
end
RP-->>Inf: Final Action Arguments
end
Inf->>App: Return Action Result
pirate
approved these changes
Mar 31, 2026
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.
why
what changed
variablesare provided by the usertest plan
Summary by cubic
Hardened the act variables prompt so models always return argument placeholders as %variableName%, preventing failed variable substitution. Also clarified the element ID format with concrete examples.
Bug Fixes
argumentsarray when variables are provided.Refactors
buildActVariablesPrompt()and reused it in both act and step-two prompts to keep messaging consistent and avoid duplication.Written for commit 8b592f2. Summary will update on new commits. Review in cubic