## ADDED Requirements ### Requirement: Tunnel failure classification The system SHALL distinguish tunnel failures from application errors when determining whether to recreate a tunnel. #### Scenario: Tunnel is broken - **GIVEN** a running instance with a tunnel URL - **WHEN** the health check receives one of: - Connection refused (ECONNREFUSED) - Connection timeout (ETIMEDOUT) - DNS resolution failure (ENOTFOUND) - Empty response - **THEN** the tunnel status is "unreachable" - **AND** the frontend shows a "tunnel error" badge - **AND** the "Recreate Tunnel" button is enabled #### Scenario: Application returns error - **GIVEN** a running instance with a tunnel URL - **WHEN** the health check receives HTTP 502, 503, or 504 - **THEN** the tunnel status is "error_response" - **AND** the frontend shows an "app error" badge - **AND** the "Recreate Tunnel" button is NOT shown - **AND** the status code is displayed for diagnostics #### Scenario: Application is healthy - **GIVEN** a running instance with a tunnel URL - **WHEN** the health check receives HTTP 200-399 - **THEN** the tunnel status is "healthy" - **AND** no error badge is shown #### Scenario: Tunnel recreates successfully - **GIVEN** an instance with a broken tunnel (status "unreachable") - **WHEN** the user clicks "Recreate Tunnel" - **THEN** the old cloudflared process is stopped - **AND** a new cloudflared process is started - **AND** the instance URL is updated - **AND** the tunnel status becomes "healthy" (after verification) ## MODIFIED Requirements None. ## REMOVED Requirements None.