A refused Screen Recording can end a Run with RUNTIME_CLEANUP_UNCONFIRMED and lock the Runtime until restart

Aperta
#499 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, typescript

Direzione di ricerca

Start in localtools/computer_permission.go at ComputerPermissions.cuaStatus, then follow operation.close in localtools/manager.go and finishOperation in daemon/operations.go to see how uncleanOperations is populated. The trigger is still unconfirmed, so the first step is reproducing the status-poll restart during a Run and reading the cua.call.timing logs. Done means a repro showing the cause, followed by a design decision on the restart bound and lockout recovery.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

Following #344, where this chain was noted as its own bug: after the auto-update left Screen Recording effectively refused while System Settings still showed it on, one failed turn cascaded into Local MCP cleanup failed, and every later start on that Runtime was refused with The Runtime process could not be confirmed stopped. Check Local Computer before starting another Run. Only quitting and reopening Linger cleared it.

This is a code-level trace of the whole chain on current main, the candidate triggers, and what logs would discriminate them. No patch is proposed yet; the escalation and lockout mechanics below are concrete, the exact trigger still needs a repro's logs.

The chain

  1. The shared CuaDriver service is restarted on every denied status read. ComputerPermissions.cuaStatus (localtools/computer_permission.go) restarts the service whenever CuaDriver's Screen Recording reads denied, so a fresh grant clears the driver's cached preflight. In the stale-grant state the reading stays denied until the grant is re-recorded, so while a permission card is visible and polled, the shared service is killed and relaunched repeatedly.

  2. A Run in that state races those restarts. Its cua calls fail fast — requirePermissions refuses before any action starts, so the refusal itself is clean (the call's defer keeps confirmed). But paths that cannot prove the outcome mark the operation unknown (c.op.markUnknown() in the cua call defer: a journal receipt that fails to finish, or errUnconfirmedSession from starting input sessions), and a session whose service exits mid-call settles as errDriverStopped.

  3. Operation close escalates. operation.close (localtools/manager.go) joins mcpproxy.ErrCleanupUnconfirmed when an unknown action remains and any close step errored, and op.cua.close() errors join directly.

  4. The terminal carries it. finishOperation (daemon/operations.go) turns the Set.Close error into Local MCP cleanup failed with CleanupUnconfirmed; on a scheduler yield the Runtime is appended to uncleanOperations.

  5. The Runtime is locked. Start, prepare, model invoke and session compaction all refuse while runtimeCleanupUnconfirmed(RuntimeType) holds (operation_start.go, operation_prepare.go, model_invoke.go, session_compact.go), and the web renders that as the could-not-be-confirmed-stopped message.

  6. Recovery is a restart. uncleanOperations is an in-memory, append-only slice: nothing removes from it, acknowledges it, or expires it. Quitting Linger is the only way out, which matches the report.

Candidate triggers, ranked

a. The status-poll restart races a Run's in-flight calls: each poll SIGTERMs the shared service the Run's sessions are bound to. A call that cannot prove its outcome because the service died under it marks the operation unknown — one such mark plus any close error poisons the whole Runtime. The two only coincide while the card is polled during a Run, which is exactly the reported window.

b. The escalation itself: operation.close is deliberately conservative (any unknown + any close error), which is the right bias for actions whose effects cannot be proven, but it means one unprovable cleanup out of a whole Run blocks every later start, with no bounded retry or owner-facing acknowledge for the lockout itself.

What would discriminate

On the next occurrence, while the card is pending and before restarting Linger: the daemon log's cua.call.timing lines (failed, driver_ms) around the last Run, the runner.operation.finished failure_code, any COMPUTER_ACTION_UNKNOWN or journal receipt failures, and whether the permission card was being polled while the Run was mid-turn.

Possible directions, for discussion

  • Bound or debounce the cuaStatus restart (for example, restart at most once per interval, or only when the Linger bridge reads granted while the driver denies — the signature mismatch itself).
  • Give the lockout an owner-facing recovery that re-proves cleanup (a bounded retry that re-reads the driver and clears uncleanOperations on a confirmed-clean proof) instead of requiring a restart.
Lingua principale
TypeScript
Stelle
3.8k
Fork
360
Merge medio
8h 10m
PR unite (30g)
540

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di simplexai-labs/linger

Tutte le issue di simplexai-labs/linger

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.