Skip to content

perf(core): batch planned action stability waits - #160

Open
dexhunter wants to merge 1 commit into
magnitudedev:mainfrom
dexhunter:perf/batched-stability-waits
Open

perf(core): batch planned action stability waits#160
dexhunter wants to merge 1 commit into
magnitudedev:mainfrom
dexhunter:perf/batched-stability-waits

Conversation

@dexhunter

Copy link
Copy Markdown

Fixes #93

Summary

  • wrap each planned action sequence in connector-level batch lifecycle handling
  • coalesce ordinary browser stability waits at the batch boundary while preserving the largest requested timeout
  • keep immediate barriers for explicit navigation and tab switches, plus a 500 ms navigation-detection window for click-driven transitions
  • support nested batches and safely ignore service-worker and non-navigation requests

Performance

A deterministic seven-sample harness exercised the real Agent -> action resolver -> WebHarness path with three consecutive keyboard:type actions on the same stable page.

Stability waits Median batch time
main (f1b587c4) 3 3326.816 ms
this branch 1 2299.677 ms

That removes two redundant waits and reduced median batch time by 30.87% on the test host. The harness also verifies action order, arguments, results, emitted events, memory recording, and planning-call count.

Safety coverage

  • delayed click navigation completes before the next action runs
  • explicit navigation and tab switches retain immediate stability barriers
  • pending timeout requirements are not discarded by an immediate barrier
  • nested batches coalesce without deadlocking
  • service-worker requests never call Request.frame()

Validation

  • bun run check
  • bun run build
  • bun test packages/magnitude-core/src (40 passed)
  • focused lifecycle test repeated five times (4 passed each run)
  • external safety harness (8 assertions)
  • git diff --check

Fixes magnitudedev#93

Co-Authored-By: Aiden <aiden@weco.ai>
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.

disable wait on consecutive actions

1 participant