Skip to content

Plan execution: track known-good prefix and invalidated frontier #1028

@shaun0927

Description

@shaun0927

배경

Skyvern workflow copilot은 검증된 prefix를 유지하고 실패한 frontier block만 수정/재실행하는 방식으로 긴 workflow 비용과 실패 복구 비용을 줄인다. openchrome PlanExecutor는 step error handler가 있지만, 검증된 prefix와 invalidated frontier 개념은 명확하지 않다.

목표

PlanExecutor 또는 orchestration plan에 known-good prefix와 invalidated frontier metadata를 추가해 긴 계획의 부분 실패 복구를 개선한다.

범위

  • step execution record에 다음을 추가:
    • step order/tool/args hash
    • pre-state summary 또는 state hash
    • postcondition/success evidence
    • output params
    • invalidation reason
  • 실패 시:
    • 성공한 prefix를 재사용 가능 상태로 표시
    • 실패 step부터 frontier로 표시
    • retry/recovery는 frontier 이후에만 적용
  • 기존 errorHandlers와 호환되어야 한다.

비범위

  • 모든 browser state를 완벽히 checkpoint/rollback하지 않는다.
  • Playwright/Skyvern식 workflow builder UI를 만들지 않는다.

구현 가이드

  1. PlanExecutionResult 또는 별도 execution ledger에 per-step verdict를 추가한다.
  2. postcondition evidence는 기존 contract/evidence bundle과 연결 가능한 handle로 둔다.
  3. args hash는 deterministic canonical JSON을 사용한다.
  4. 이전 prefix 재사용은 안전한 경우에만 한다. page state가 달라졌으면 invalidation reason을 남긴다.

성공 기준

  • plan step별 success/failure/evidence metadata가 남는다.
  • step N 실패 시 1..N-1 prefix가 known-good으로 표시된다.
  • retry 시 known-good prefix를 재실행하지 않거나, 재실행이 필요한 이유를 명확히 기록한다.
  • params/output propagation이 기존 PlanExecutor behavior와 호환된다.
  • unsafe reuse가 감지되면 prefix를 invalidate한다.

코드 검증

  • 단위 테스트: all-success plan ledger.
  • 단위 테스트: middle-step failure -> frontier index 기록.
  • 단위 테스트: args hash 변경 -> prefix invalidation.
  • 단위 테스트: recovery handler 이후 ledger 업데이트.
  • npm run build 통과.

openchrome 실검증 항목

  1. openchrome 서버를 실행하고 실제 브라우저 탭을 확보한 뒤 3-step plan을 실행한다.
    • step 1: navigate to https://example.com
    • step 2: read_page 또는 query_dom
    • step 3: 의도적으로 실패하는 selector/ref interaction
  2. 실행 결과에서 step 1~2가 known-good, step 3이 failed frontier로 기록되는지 확인한다.
  3. step 3만 수정한 뒤 retry했을 때 step 1~2가 불필요하게 반복되지 않거나, 반복되었다면 invalidation reason이 남는지 확인한다.
  4. 최종 성공 후 ledger가 completed로 정리되는지 확인한다.
  5. PR 본문에 plan 입력, ledger 출력, retry 전후 event를 첨부한다.

리스크와 완화

  • 리스크: page state 재사용을 과신하면 잘못된 상태에서 재시작할 수 있음.
    • 완화: pre-state hash/current URL/title/DOM summary 불일치 시 prefix invalidate.

Curated scope, overlap handling, and verification checklist

Scope classification

  • Canonical lane: PlanExecutor partial-failure recovery metadata.
  • Primary deliverable: known-good prefix and invalidated frontier metadata for plan execution records.
  • Open PR: feat(orchestration): expose plan known-good frontier (#1028) #1102 (feat/1028-known-good-prefix). Amend that PR first.
  • Non-goal: full browser rollback/checkpointing, workflow builder UI, speculative re-planning, or automatic retry beyond existing error handlers.

Overlap and conflict resolution

Implementation checklist

  • Extend plan execution records with step order, tool/args hash, pre-state summary/hash, postcondition evidence, output params, verdict, and invalidation reason.
  • Mark successful prefix as reusable only when evidence and state hashes still support reuse.
  • Mark failed/current step and downstream steps as invalidated frontier with clear reason.
  • Add deterministic canonical JSON hashing for args and tests for hash stability.
  • Add tests for all-success, mid-plan failure, changed page state invalidation, existing error handler compatibility, and evidence handle persistence.

Success criteria

  • After a mid-plan failure, callers can identify the known-good prefix and failed frontier without rereading the whole trace.
  • Reuse is conservative and invalidates when page/state evidence no longer matches.
  • Existing plan execution behavior remains compatible aside from additional metadata.
  • Metadata is deterministic and bounded enough for LLM context.

Post-merge OpenChrome live verification checklist

  • Run a multi-step local fixture plan that succeeds for the first steps and intentionally fails later.
  • Verify the result identifies known-good prefix, invalidated frontier, args hashes, and evidence handles.
  • Modify fixture/page state and verify prefix reuse is rejected or invalidated with a reason.
  • Record plan result JSON excerpt and evidence handle paths in merge notes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestharnessExecution harness, run lifecycle, recovery, and verificationlive-verificationRequires live OpenChrome/browser validation after implementationskyvern-learningsImprovements inspired by Skyvern architecture analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions