Skip to content

fix(runtime): accept sequence observations and share bound execution - #5475

Open
testikun wants to merge 3 commits into
apache:mainfrom
testikun:codex/cu-observation-lease
Open

testikun wants to merge 3 commits into
apache:mainfrom
testikun:codex/cu-observation-lease

Conversation

@testikun

@testikun testikun commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #5474. After element_sequence returned a fresh observation, its next bound action was rejected as reobserve_required: the frame was registered but the session was not activated. Accept all six fresh-observation paths with a pre-capture lease check and synchronous frame/session activation. This also declines captures invalidated while in flight.

A separate second commit shares the existing bound-action execution protocol between a single semantic action and each sequence step: recheck the action lease after presentation, preserve partial delivery as outcome_unknown, and apply the same frame retirement/confirmation rules. Sequence still owns target lookup, progress, capture policy and response formatting; ordinary type/key is unchanged. Host/fake-backend timing checks do not establish real OS input delivery. Refs #4909; independent of open #5458.

Verification

  • On unmodified main, the new closing-observation regression failed with actual: reobserve_required; after the fix it passes. The presentation-stop and partial-delivery regressions also failed before the second commit and pass after it.
  • 148 tests across eight runtime CU test files and the computer-use cross-layer contract passed after rebuilding the affected workspaces.
  • npm run lint, npm run format:check, npm run build, npm run typecheck, npm run check:asf-headers, and both prescribed knip workspace checks passed.
  • Local npm test was stopped at user request to avoid a large suite; before interruption, several concurrent runtime-host tests reported readiness/terminal timeouts. The first remote test run exposed a new-Turn observe lease regression in this PR; it failed the cross-layer contract, was fixed in the first commit, and the focused cross-layer test is green locally. The corrected head passed remote build, typecheck, and affected standard workspace tests. The later Runtime Host test step failed on runtime-resource-process with a 60-second PTY control-close timeout (not in the changed code). This account lacks Actions rerun permission, so a maintainer needs to rerun that job. The full suite is not claimed green pending a privileged rerun of the Runtime Host step. No real Desktop/model/OS CU reproduction was run.
  • Ablation: removing the presentation-time lease recheck dispatched a stopped second step; removing observation lease validation published an invalidated closing frame and accepted a stopped wait result. Both checks were restored.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex (OpenAI) authored the scoped runtime changes, regression tests, and this description; the contributor reviews and owns submission. Both commits carry Generated-by trailers.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/L Under 1000 readable lines label Sep 18, 2026
@testikun

Copy link
Copy Markdown
Contributor Author

Status for maintainers: this PR is mergeable and has no review threads. The hosted Runtime Host step failed only in the unchanged runtime-resource-process PTY integrity test after its 60s close wait; the affected Computer Use build and focused tests passed. I tried gh run rerun 35312795350 --failed, but GitHub requires repository admin rights for this account. Please rerun that failed check and review the PR; no unrelated CI-only commit has been added.

Generated-by: OpenAI Codex
runCtx,
);
final = registerObservation(
final = acceptObservation(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 — An invalidated closing capture is reported as a successful sequence without a current observation

The closing capture is guarded by acceptObservation, so when the observation lease is invalidated during that capture it correctly returns no frame. However, stopped remains unset and the result is still formatted as maka_computer.element_sequence ok (N of N steps) with no error or recovery state. I reproduced this on the current head by calling sessionEvents.reobserveRequired('s1') from the closing captureObservation: the result was ok (1 of 1 steps) with no Fresh observation, while the session snapshot was reobserve_required; the next bound action was then refused.

This leaves the model with a success message but no usable observation and causes an avoidable failed follow-up call. The same path occurs when a Stop invalidates the closing capture.

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

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(runtime): sequence closing observation cannot be used for the next action

2 participants