feat(cu): connect typed host lifecycle events - #897
Conversation
|
@astrohan This Computer Use stack slice is ready for review. Please follow the dependency and merge order stated at the top of the PR; the exact net diff is linked there. |
eb637e0 to
7780f44
Compare
|
@astrohan P0 blocker found in live concurrent use: the current compatibility driver PID-bound CGEvent path does not move the pointer or steal focus, but it can still interfere with the user physical mouse button state. Do not merge the Computer Use stack as fully background-safe yet. I am preparing a fail-closed follow-up that disables every CGEvent mouse/keyboard path and retains only AX/CDP/screenshot operations until the native event backend can prove isolation. |
7780f44 to
c9b6197
Compare
c9b6197 to
1fd7f8e
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Approved on content. I found no P0 or P1. These two state-mapping issues are P2 and do not require another fix round.
P2
applyTypedOutcomeState()changesoutcome_unknowntoreobserve_requiredbefore the post-dispatch lease check (packages/runtime/src/computer-use-tools.ts:636-658, 1332-1336, 1445-1450). That lease failure replaces the backend's "the action may have executed; do not retry" result with a generic re-observe result. Preserveoutcome_unknownin the model-facing return while still invalidating the frame.- The same late outcome mapping can overwrite a terminal session state. If
user_stopped,screen_locked, orblocked_urlis set while an action is in flight and the backend then returns a typed failure,applyTypedOutcomeState()writes a new state such asreobserve_required(packages/runtime/src/computer-use-tools.ts:636-658, 1332, 1445). Terminal states should be absorbing for that generation. Desktop's synchronous abort chain makes this a race rather than a normal path, so it remains P2.
The current branch still needs to follow its parent stack before squash merge. The focused lifecycle and cumulative tests passed on the reviewed patch.
1fd7f8e to
e91cdbb
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Restack-only rereview on e91cdbbf. Its patch-id exactly matches the reviewed host-lifecycle change. Typecheck, test, and e2e are green. No P0 or P1.
P2
outcome_unknownis replaced by genericreobserve_requiredduring the post-dispatch lease check, losing the model-facing "may have executed; do not retry" result.- A late typed outcome can overwrite an absorbing
user_stopped,screen_locked, orblocked_urlstate for the same generation.
Both remain non-blocking. Approved for squash merge with no additional fix round.
Upstream stack notice
This is stack PR G1. It depends on #896 and must not merge before it.
The Files tab is cumulative until preceding fork branches are rebased after merge.
Review the exact 6-file host-event net diff now in fork-local PR hqhq1025#6.
Current rebase verification: @maka/computer-use 113/113; Runtime 1466 passed with 7 platform skips; Desktop typecheck.
Goal
Connect only Computer Use lifecycle events with a typed, attributable source, and add a scoped cross-layer deterministic contract.
This is G1, not the complete host-event or real-Electron E2E layer.
What this PR does
capture_faileduser_intervened-> re-observescreen_locked-> lockedblocked_url-> terminal URL blockoutcome_unknown, service unavailable, or service mismatch -> re-observereobserve_requiredsession_clearedlocal to that sessionLatest reverse-engineering constraints applied
Reviewed the current local reverse-engineering lab, including V10 and chapters 26/27.
Key consequences:
ps/formatted-start-time implementation was rejected during review rather than shipped as false protection.turn-endedis a signed-helper Apple Event lifecycle. Maka does not invoke or emulate it; helper exit is not proof of service cleanup.Non-goals
Verification
npm --workspace @maka/runtime test— 1434 passed, 2 skippednpm --workspace @maka/computer-use test— 109 passednpm --workspace @maka/desktop run typecheckgit diff --checkFollow-up stack
Stacked on #5.