Skip to content

Conversation

@seanmcguire12
Copy link
Member

@seanmcguire12 seanmcguire12 commented Dec 1, 2025

why

what changed

test plan


Summary by cubic

Refactors actHandler to centralize LLM action parsing and execution, reduce duplication, and improve metrics reporting. Behavior stays the same, with clearer naming and more reliable two-step and fallback flows.

Why:

  • Reduce duplicated LLM calls and normalization logic.
  • Improve readability and maintainability.
  • Ensure consistent metrics and variable substitution.
  • Make the self-heal/fallback path more robust.

What:

  • Renamed actFromObserveResult to takeDeterministicAction and updated all call sites (ActCache, AgentCache, v3).
  • Added getActionFromLLM for inference, metrics, normalization, and variable substitution.
  • Added recordActMetrics to centralize ACT metrics reporting.
  • Extracted normalizeActInferenceElement and substituteVariablesInArguments helpers.
  • Simplified two-step act flow and fallback retry using shared helpers.
  • Kept existing behavior (selector normalization, variable substitution, retries).

Test Plan:

  • Run unit tests for actHandler to confirm no regressions.
  • Verify single-step actions execute as before.
  • Verify two-step flow triggers when LLM returns twoStep and executes the second action.
  • Confirm fallback self-heal path updates selector and retries successfully.
  • Check metrics are recorded once per inference call in both steps and fallback.
  • Validate variable substitution replaces %key% tokens in action arguments.
  • Exercise AgentCache and ActCache paths to ensure takeDeterministicAction works end-to-end.
  • Build passes and type checks for all renamed method references.

Written for commit 8d8e569. Summary will update automatically on new commits.

@changeset-bot
Copy link

changeset-bot bot commented Dec 1, 2025

⚠️ No Changeset found

Latest commit: 8d8e569

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants