|
| 1 | +# BUG-011: appium-shell-stall |
| 2 | + |
| 3 | +> **Line Limit:** 150 lines max (enforced) |
| 4 | +> **Purpose:** Core bug documentation and implementation details |
| 5 | +
|
| 6 | +--- |
| 7 | + |
| 8 | +## Summary |
| 9 | +Drift detection runs never finish when Appium starts without `allowInsecure=adb_shell`. The agent captures a screenshot, but the run remains `running`, the frontend shows the stale frame, and there is no failure surfaced to engineers or QA. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Severity / Impact |
| 14 | +- **Severity**: High |
| 15 | +- **Impact**: Automated backend tests and manual drift detection rely on Appium. Misconfiguration silently stalls runs, masking failure signals and blocking verification. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Environment |
| 20 | +- **Backend**: encore run (local) |
| 21 | +- **Frontend**: localhost:5173 |
| 22 | +- **Browser/OS**: Chrome 130 on macOS 14.6 |
| 23 | +- **Package Versions**: Appium 2.x (without `allowInsecure=adb_shell`) |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Steps to Reproduce |
| 28 | +1. Start Appium without insecure shell (`appium --port 4723`). |
| 29 | +2. Run `task backend:test` or click “Detect My First Drift” in the UI. |
| 30 | +3. Observe Vitest logs: `ProvisionApp.signature.failed` with `adb_shell not enabled`. |
| 31 | +4. Frontend displays a screenshot forever; Encore reports run status `running`. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## Expected Result |
| 36 | +- Backend run transitions to `failed` with an actionable `stop_reason`. |
| 37 | +- Frontend surfaces an error state to the user when the agent cannot proceed. |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## Actual Result |
| 42 | +- `mobile: shell` command fails; Encore logs a warning but leaves the run in `running`. |
| 43 | +- UI shows the last captured screenshot indefinitely with no error banner. |
| 44 | +- Engineers receive no signal that Appium is misconfigured. |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +## Root Cause |
| 49 | +Initial finding: the agent treats signature verification failure as recoverable, so the orchestration never emits a terminal event. The frontend only sees `status: "running"`, leaving the stale frame onscreen. |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Proposed Fix |
| 54 | +1. Update `ProvisionApp` handling to propagate the signature failure as a terminal `run.stop_reason`. |
| 55 | +2. Add backend telemetry/metrics for `adb_shell` capability errors. |
| 56 | +3. Frontend: detect runs that remain `running` past timeout and surface an explicit error banner. |
| 57 | +4. Document Appium startup requirements and add a CLI guard to `task qa:appium:start`. |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## Attachments / Logs |
| 62 | +- Vitest snippet: `WebDriverError: Potentially insecure feature 'adb_shell' has not been enabled.` |
| 63 | +- Encore log lines from `ProvisionApp.signature.failed`. |
| 64 | +- Screenshot of frontend showing single frozen frame. |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## Owner / Priority |
| 69 | +- **Reported by**: QA (Founder request) |
| 70 | +- **Assigned to**: Backend + QA pair |
| 71 | +- **Priority**: P1 |
| 72 | + |
| 73 | +--- |
| 74 | + |
| 75 | +## Related Items |
| 76 | +- **Discovered in**: Drift detection regression testing |
| 77 | +- **Blocks**: Automated backend smoke tests that depend on Appium |
| 78 | +- **Related**: FR-019 (Appium auto-start hardening) |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Notes |
| 83 | +- Tests `agent/tests/metrics.test.ts` and `backend/run/start.integration.test.ts` fail with timeout when this occurs. |
| 84 | +- Issue confirmed multiple times on 2025-11-10; screenshot persisted on frontend even after Appium shutdown. |
| 85 | + |
| 86 | + |
0 commit comments