You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(android): never fabricate clipboard availability from a failed probe
Review blocker on #2021. The probe I added had a `catch { return true }`, then
cached that result by device id for the runtime owner's lifetime. A transient
adb offline or timeout therefore made `capabilities` advertise the clipboard on
a build with no clipboard shell — recreating the exact lie the fix was for, and
pinning it for the rest of the session. A test locked the behavior in.
Support is now a typed verdict with three states, because "we could not ask" is
not "it works": `supported | unsupported | probe-failed`. Only a definitive
answer is cached; `probe-failed` refuses conservatively with a hint saying
support could not be determined, and is deliberately not remembered, so the next
inspection asks again.
The same change repairs the ownership boundary. Turning raw adb stdout/stderr
into a verdict is Android tool knowledge, so it belongs to the Android owner, not
to shared vocabulary — `@agent-device/contracts/android-clipboard-support` now
carries the typed union alone. The parser returns to `src/platforms/android/adb.ts`
and runs in exactly one place, behind a new `AndroidToolHost.probeClipboardShellSupport`
that hands owners the verdict. That also settles which Android home owns it:
R13 lets only `src/platform-runtime.ts` import `@agent-device/platform-android`,
so a parser shared between the package and the root leaf cannot live in the
package either.
Tests now cover the failure path the previous ones locked the wrong way: a failed
probe refuses instead of admitting, its refusal says it could not determine
support rather than claiming the build lacks it, and it is not cached — a second
inspection re-probes and admits once the device answers.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019RpfS12XApXqasuAWZJaEX
hint: 'This Android build ships no shell implementation for the clipboard service, so adb cannot read or write the clipboard on it.',
211
211
}asconst);
212
212
213
+
/**
214
+
* The probe could not reach the device, so this owner does not know whether the build supports a
215
+
* shell clipboard. Refusing is the conservative answer and the only honest one: reporting
216
+
* available would hand the caller a capability execution may immediately reject, which is the
217
+
* exact failure fact-based admission exists to prevent. Deliberately not cached — the next
218
+
* inspection asks again.
219
+
*/
220
+
constclipboardShellUnknown=Object.freeze({
221
+
available: false,
222
+
reason: 'owner-capability-missing',
223
+
hint: 'Could not determine whether this Android build supports a shell clipboard: the adb probe did not complete. Retry once the device is reachable.',
224
+
}asconst);
225
+
226
+
/**
227
+
* `probe-failed` covers both ways this owner can end up without an answer: the probe ran and could
228
+
* not reach the device, or the host exposes no probe at all. Neither is evidence of support, and
0 commit comments