Documentation: Correct the telemetry device ID fallback when persistence fails

Đang mở Phù hợp với người mới
#6,468 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
91/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
documentation

Hướng nghiên cứu

Mở docs/open-source/telemetry.mdx tại phần Identity được nhắc đến trong issue. So sánh mô tả về phương án dự phòng với mã chọn ID telemetry được liên kết và bài kiểm thử hồi quy. Cập nhật đoạn văn để mô tả việc ghi đè, ID được lưu bền vững và ID ngẫu nhiên cục bộ trong tiến trình theo thứ tự nêu trong issue; hoàn tất khi nội dung được xuất bản khớp với các hành vi đó, bao gồm cả thời gian tồn tại của tiến trình đối với phương án dự phòng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Type of Documentation Issue

Incorrect documentation

Documentation Page

https://docs.browser-use.com/open-source/telemetry

Issue Description

Summary

The published Telemetry page says Browser Use derives the fallback device ID from the machine's MAC address and hostname when it cannot write the device_id file. The library instead generates a random ID for the process. The sentence gives readers an inaccurate account of how the installation identifier is derived and how long it lasts when storage is unavailable.

Runtime or environment

Tested the latest PyPI release, browser-use 1.0.6, in an isolated CPython 3.12.16 environment on macOS arm64. Also ran the check against the library's current default-branch source using the same dependencies, and read both the published Telemetry page and its current SDK source. The source revisions are pinned below.

Steps to reproduce

  1. Read the Identity section of the published Telemetry page.
  2. In an empty directory on a POSIX system, create a virtual environment named .venv and install the PyPI baseline above. Run as a user for whom a directory without write permission is unwritable.
  3. Save the files below as probe.py and run-probe.sh, then run bash run-probe.sh. The runner assembles two telemetry events in each of two fresh Python processes sharing an unwritable config directory, with usage telemetry enabled and no device ID override. It then repeats with writable storage. The probe assembles events in memory without starting the sender. It rejects the socket.connect, socket.getaddrinfo, and subprocess.Popen audit events. The output reports process-local IDs for the unwritable case and a shared ID for the writable control.
  4. To repeat the default-branch check, put the library at the pinned revision in a checkout named library under the probe directory and run bash run-probe.sh "$PWD/library". The runner passes that checkout to Python via PYTHONPATH and uses the dependencies from .venv.
Reproduction script: probe.py
import os
import sys
from pathlib import Path
from uuid import UUID


def block_network(event, args):
    if event in {"socket.connect", "socket.getaddrinfo", "subprocess.Popen"}:
        raise AssertionError(f"Unexpected operation: {event}")


sys.addaudithook(block_network)

from browser_use.telemetry.service import Job, ProductTelemetry

telemetry = ProductTelemetry()
assert telemetry.enabled
first = telemetry._event(Job("offline_probe", lambda *_: {}))["distinct_id"]
second = telemetry._event(Job("offline_probe", lambda *_: {}))["distinct_id"]
assert first == second
device_file = Path(os.environ["BROWSER_USE_CONFIG_DIR"]) / "device_id"
if device_file.exists():
    assert device_file.read_text().strip() == first
print(UUID(first).version, first)
Reproduction script: run-probe.sh
set -eu
source_dir="${1:-}"
fixture=$(mktemp -d "$PWD/fixture.XXXXXX")
config="$fixture/config"
mkdir "$config" "$fixture/home" "$fixture/xdg"
cleanup() {
    chmod u+w "$config"
    rm -r "$fixture"
}
trap cleanup EXIT
probe() {
    env -i PATH="$PATH" PYTHONPATH="$source_dir" HOME="$fixture/home" XDG_CONFIG_HOME="$fixture/xdg" \
        ANONYMIZED_TELEMETRY=true BH_TELEMETRY=1 BROWSER_USE_CONFIG_DIR="$config" \
        .venv/bin/python probe.py
}
chmod a-w "$config"
first=$(probe)
second=$(probe)
test "${first%% *}" = 4
test "${second%% *}" = 4
test "$first" != "$second"
test ! -e "$config/device_id"
printf '%s\n' 'Write denied: UUIDv4, reused within each process, different across two processes, no device_id file.'
chmod u+w "$config"
first=$(probe)
second=$(probe)
test "$first" = "$second"
test -f "$config/device_id"
printf '%s\n' 'Writable control: the device_id file and both processes agree.'

Expected behavior

The Telemetry page should accurately describe the fallback identifier that usage events carry when no override is set and no existing ID can be loaded or written. It should describe a randomly generated ID reused for the life of the process.

Actual behavior

The published page and the SDK source describe a MAC address and hostname hash. In both tested library baselines, the first process used one UUIDv4 for both events and the second process used a different UUIDv4. No device_id file was created. With writable storage, both fresh processes used the ID saved in the file.

Evidence

  • Expected source: SDK Telemetry page source shows the published fallback wording. The library regression test records the intended process-local behavior.
  • Failure source: The offline check above reproduced the mismatch. The ID selection and persistence code caches uuid.uuid4().hex when both the override and persistent ID are unavailable, and the event builder uses it as distinct_id when usage telemetry is enabled.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Read the deployed Telemetry page and compare it with the offline check. The Identity paragraph should distinguish an explicit override, an ID reused or created through persistence, and a random ID reused for the life of the process when neither of the first two sources supplies an ID. An existing readable ID can still be used in a read-only directory.

References

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: The privacy documentation misstates both the inputs and the lifetime of the fallback identifier, which affects users assessing what distinguishes telemetry events from installations with unwritable storage.
  • Workaround status: available
  • Workaround basis: Readers can verify the fallback in the linked source and regression test or run the offline check.
Suggested Changes

Update the Identity paragraph to describe the three sources in order. Browser Use uses BROWSER_USE_DEVICE_ID when set to a nonempty value. Otherwise, it uses an ID from the device file if one is read or created. If neither source yields an ID, it generates a random ID and reuses it for the life of the process.

Ngôn ngữ chính
Python
Star
123k
Fork
13.8k
Merge trung bình
1 ngày 21 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của browser-use/browser-use

Tất cả issue của browser-use/browser-use

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.