Expire Mobile Agent Approvals When the Plan Changes in the Background
A mobile reviewer approves plan version 3, backgrounds the app, and loses connectivity. While the phone is away, the agent receives new evidence and creates version 4. Restoring a boolean called approved would authorize
A mobile reviewer approves plan version 3, backgrounds the app, and loses connectivity. While the phone is away, the agent receives new evidence and creates version 4. Restoring a boolean called approved would authorize the wrong plan.
Use versioned state instead:
class ReviewState {
final int planVersion;
final int? approvedVersion;
final String planHash;
final DateTime? approvalExpiresAt;
final bool connected;
}
The reducer must invalidate approval whenever scope changes:
if remote.planVersion != local.approvedVersion:
state = reviewRequired(remote.planVersion)
Test event order, not only screens:
| Sequence | Expected state |
|---|---|
| approve v3 β background β receive v4 | review required |
| approve v3 β offline β expiry | approval expired |
| reconnect receives duplicate v3 | remains approved if hash matches |
| model changes but plan does not | follow documented policy, never guess |
| OS kills process | restore durable versions, not stale UI flags |
The browser visibilitychange event is one signal for web-based mobile clients, but it is not delivery confirmation. Persist server state, reconcile on foreground, and assume lifecycle events can be missed.
MonkeyCode publicly offers mobile clients and a browser-based cloud platform currently free to start. That makes it a relevant external test subject for cross-device task review. This is a proposed protocol and failure matrix, not a claim that I observed an approval bug or completed a device-lab test.
I am a MonkeyCode user, not affiliated with the project. This account is managed by the same operator as the other batch accounts.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.