Skip to content

Give your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.

chore: release prep for 1.6.0

Pnantbe7781459cb0
diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml
index d127e3d3..53413919 100644
--- a/.github/workflows/pytest.yml
+++ b/.github/workflows/pytest.yml
@@ -109,3 +109,68 @@ jobs:
/tmp/smoke/bin/agent-reach version
cd /tmp && /tmp/smoke/bin/agent-reach channels | /tmp/smoke/bin/python -c "import json, sys; d = json.load(sys.stdin); assert d['ok'] and d['channels'], d; print(f\"channels OK: {len(d['channels'])}\")"
cd /tmp && /tmp/smoke/bin/python -c "import agent_reach; from importlib.resources import files; assert (files('agent_reach')/'skill'/'SKILL.md').is_file(); print('SKILL.md ships in site-packages OK')"
+
+ # Most users are on 1.5 (installed with pipx). Rehearse the documented
+ # upgrade (docs/update.md step 3) on every OS: the new copy must win on PATH,
+ # keep the old config, explain the upgrade and remove the old pipx copy.
+ upgrade-from-1-5:
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 30
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ defaults:
+ run:
+ shell: bash
+ env:
+ AGENT_REACH_NO_UPDATE_CHECK: "1"
+ PYTHONIOENCODING: utf-8
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+
+ - uses: astral-sh/setup-uv@v5
+
+ - name: Install 1.5 the way its install guide said (pipx)
+ run: |
+ git fetch --tags --force https://github.com/Panniantong/Agent-Reach.git 'refs/tags/v1.5.0:refs/tags/v1.5.0' || true
+ git worktree add ../v15 v1.5.0
+ python -m pip install --quiet pipx
+ python -m pipx install --python "$(python -c 'import sys;print(sys.executable)')" ../v15
+ echo "$(python -m pipx environment --value PIPX_BIN_DIR)" >> "$GITHUB_PATH"
+ python - <<'PY'
+ from pathlib import Path
+ d = Path.home() / ".agent-reach"; d.mkdir(exist_ok=True)
+ (d / "config.yaml").write_text("groq_api_key: test\ntwitter_auth_token: t\n")
+ PY
+
+ - name: Old version is 1.5
+ run: agent-reach version | tee /dev/stderr | grep -q "v1.5"
+
+ - name: Upgrade as docs/update.md step 3 says
+ run: |
+ uv tool install --force .
+ echo "$(uv tool dir --bin)" >> "$GITHUB_PATH"
+
+ - name: New copy wins, sets up, removes the old one
+ run: |
+ agent-reach version | tee /dev/stderr | grep -q '"install_method": "uv"'
+ agent-reach setup > setup.json || true
+ python - <<'PY'
+ import json
+ d = json.loads(open("setup.json", encoding="utf-8").read().strip().split("\n")[-1])
+ r = d["result"]
+ assert r["migration"] and r["migration"]["migrated"], r.get("migration")
+ assert "twitter" in r["migration"]["suggested_channels"], r["migration"]
+ assert r["old_copies"]["removed"] and not r["old_copies"]["failed"], r["old_copies"]
+ assert "1.5" in r["installation_report"]["markdown"]
+ print("upgrade OK:", r["old_copies"])
+ PY
+ if python -m pipx list --short | grep -q agent-reach; then echo "old pipx copy still registered"; exit 1; fi
+ agent-reach version | grep -q '"install_method": "uv"'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0abfd364..30c148c6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,10 +10,28 @@ All notable changes to this project will be documented in this file.
## [1.6.0] - unreleased
中文:
+
+- 从旧版升级:把"帮我更新 Agent Reach"那句话发给你的 AI 就行。你的密钥和设置都保留,旧版程序会自动删掉。
+- 加一个平台只要说一句,需要的软件都会自动装好,不需要管理员密码;你只需要登录或者填一个 Key。
+- 小红书、推特这类要登录的平台,改用 Agent Reach 自己的专用浏览器,不弹窗、不占用你的浏览器;多个 AI 可以同时查。
+- RSS 订阅和 Exa 全网搜索合并进了"网页"。以后有新版本,AI 会用大白话告诉你改了什么,你同意了才更新。
+
+English:
+
+- Upgrading from an older version: just send your AI the "update Agent Reach" sentence. Your keys and settings are kept, and the old program is removed for you.
+- Adding a platform takes one sentence. Everything it needs is installed for you, with no admin password; you only log in or enter a key.
+- Platforms that need a login, such as Xiaohongshu and X, now use Agent Reach's own browser in the background, never yours, and several AIs can search at once.
+- RSS and Exa search are now part of "web". When a new version is out, your AI tells you in plain words what changed and updates only if you say yes.
+
+1.6 is a rebuild. Agents call one command, `agent-reach`; everything Agent Reach installs or stores lives under `~/.agent-reach/`.
+1.6 是重构版本:Agent 只调一个命令 `agent-reach`,Agent Reach 装的、存的东西全部在 `~/.agent-reach/` 下。
+
+中文(技术细节):
- 修复未登录 gh 阻断公开 API、公开行情触发浏览器、错误认证提示和未登记缓存清理;临时音频/字幕保存在 Reach 内。BOSS 站内搜索优先官方 OpenCLI,JD 上游适配故障单列;PR 与发版均检查真实验收和待验状态。
- CLI 对已声明的公开搜索/阅读先复用网页工具,成功后不准备浏览器;结果标注来源和内容范围,站内路径明确要求认证时才提示登录。可指定后端保留原有站内能力。
- 浏览器渠道共用一份登录,闲置十分钟自动关闭,下次使用自动打开。
-- 添加渠道自动准备工具;删除时只清理该网站的登录。
+- 添加渠道自动准备工具;删除时只清理该网站的登录。默认平台也能去掉,去掉后更新不会再加回来。
+- 更新时,有已测版本的工具保持在已测版本,其他工具用兼容范围内的最新版。
- 公开内容继续先读,不强制登录;安装后用简短表格说明能查什么。
- 保留小宇宙转录;去掉额外模型配置和重复的网站抓取实现。
- Bridge 随专用浏览器管理;按真实页面操作计时、定期保存登录。清理失败保留渠道,卸载只删台账文件。发布前必须有渠道真实验收。
@@ -23,34 +41,18 @@ All notable changes to this project will be documented in this file.
- 没登录时报"需要登录"而不是"上游工具坏了":雪球社区(错误码 400016)、B站字幕(没有 B站登录)、LinkedIn(专用浏览器里没有 LinkedIn 登录)。
- 从 1.5 升级更顺:update.md 先看版本再分流;`agent-reach update` 遇到 pip/pipx 装的旧版会自己换成 uv 安装;`setup` 删掉旧版 Agent Reach 程序(只删它自己,不动其他工具),安装汇报说明保留了什么、变了什么、以前用过哪些渠道可以加回来。安装地址改为始终指向最新正式版。
-English:
+English (technical):
- Browser channels share one profile, close after ten idle minutes and reopen on demand.
-- Adding a channel prepares its tools; removal clears only that site's login.
+- Adding a channel prepares its tools; removal clears only that site's login. Default platforms can be removed and updates won't add them back.
+- Updating keeps tools that have a tested version at that version; other tools get the newest version inside their supported range.
- Public content remains public-first, with a compact capability receipt.
- Keep Xiaoyuzhou transcription; remove the extra planner and duplicate site extraction.
+- Reuse existing local site sessions read-only; queries default to headless, with a visible window for human login.
- The dedicated browser is identified by the id its extension saves inside its own profile, so the user's own Chrome is never mistaken for it; a query no longer closes an open login window.
- Browser channels run queries in parallel: up to 2 per platform and 4 in total, with the rest queued instead of failing BUSY at once; login windows, logout and browser setup wait for running queries.
- Report NEED_LOGIN instead of UPSTREAM_BROKEN when not logged in: Xueqiu community (error 400016), Bilibili subtitles (no Bilibili login), LinkedIn (no LinkedIn login in the dedicated browser).
- Smoother upgrade from 1.5: update.md checks the version first; `agent-reach update` moves a pip/pipx install to uv by itself; `setup` removes the old Agent Reach program (only Agent Reach itself) and the install report explains what was kept, what changed and which old channels can be added back. Install URLs always point at the latest release.
-
-中文:
-
-- 加一个平台只要一句话,需要的软件(Node.js、Chrome、ffmpeg、浏览器扩展)都会自动装好,不需要管理员密码;你只需要登录或者填一个 Key。
-- 默认平台也能去掉,去掉后更新不会再加回来;去掉时会一起清掉它的登录和专用工具。
-- 更新时,有已测版本的工具保持在已测版本,其他工具用兼容范围内的最新版;有新版本时,AI 会用大白话告诉你改了什么,你同意了才更新。
-- 优先按站点复用本地已有登录,原浏览器不变;查询默认无头,需要本人登录时才显窗。
-
-English:
-
-- Adding a platform takes one sentence. Whatever it needs (Node.js, Chrome, ffmpeg, the browser extension) is installed for you, with no admin password; you only log in or enter a key.
-- Default platforms can be removed, and updates won't add them back; removing one also clears its login and private tools.
-- Updating keeps tools that have a tested version at that version; other tools get the newest version inside their supported range. When a new version is out, your AI tells you in plain words what changed and updates only if you say yes.
-- Reuse existing local site sessions read-only; queries default to headless, with a visible window for human login.
-
-1.6 is a rebuild. Agents call one command, `agent-reach`; everything Agent Reach installs or stores lives under `~/.agent-reach/`.
-1.6 是重构版本:Agent 只调一个命令 `agent-reach`,Agent Reach 装的、存的东西全部在 `~/.agent-reach/` 下。
-
### ✨ New / 新增
- **Unified entry / 统一入口**: `agent-reach <channel> <action>`, `agent-reach read <url>`, `agent-reach channels`. One JSON envelope per call, unified error codes with hints, per-call timeout, automatic fallback to the next backend.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5e6e2e4a..fb04d167 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -73,6 +73,14 @@ Paste the `check --text` output into the PR. Also add unit tests under `tests/`
Every version section in `CHANGELOG.md` starts with a short plain summary for users, in Chinese and in English: what changed for them and anything they must do, in 1 to 4 short points, with no jargon (no file names, commands or internal terms). This text becomes the GitHub release body, which the AI reads from `meta.update.notes` and shows the user when it offers an update. Technical entries follow below the summary.
+## Releasing (maintainers)
+
+Users install and update from the latest GitHub release, and 1.5 users read `docs/update.md` on `main`, so the merge and the release must land together:
+
+1. On the release branch, with the needed logins and keys in place, run `python scripts/record_release_acceptance.py` until it prints `release_ready: True` (`--only <channel>` rechecks some channels and keeps the rest). Commit `.github/release-acceptance.json`. Any later change under `agent_reach/` invalidates it; the record is valid for 7 days.
+2. Set the version's date in `CHANGELOG.md`.
+3. Merge the PR, then immediately tag the merge commit (`git tag vX.Y.Z && git push origin vX.Y.Z`). The release workflow tests, checks the record, and publishes the release with `agent-reach.zip`, which the install and update guides point at. Until it finishes, the guides' download link does not work, so don't leave a gap.
+
## Reporting issues
Include your OS, `agent-reach doctor --text`, `agent-reach check <channel> --text`, steps to reproduce, and what you expected. Remove personal data first.
diff --git a/agent_reach/runtime/legacy.py b/agent_reach/runtime/legacy.py
index 298e0c6c..bd2693a8 100644
--- a/agent_reach/runtime/legacy.py
+++ b/agent_reach/runtime/legacy.py
@@ -20,14 +20,30 @@ from agent_reach.utils.paths import home_dir
_WIN = os.name == "nt"
+def _pipx_reported_venvs() -> str:
+ """Where the installed pipx keeps its programs (it differs by OS and pipx version)."""
+ pipx = shutil.which("pipx")
+ if not pipx:
+ return ""
+ try:
+ out = subprocess.run([pipx, "environment", "--value", "PIPX_LOCAL_VENVS"],
+ capture_output=True, text=True, timeout=30)
+ except (OSError, subprocess.TimeoutExpired):
+ return ""
+ return (getattr(out, "stdout", "") or "").strip() if getattr(out, "returncode", 1) == 0 else ""
+
+
def _pipx_venvs() -> List[Path]:
home = home_dir()
- roots = [os.environ.get("PIPX_HOME", ""),
- str(home / ".local" / "pipx"),
- str(home / "Library" / "Application Support" / "pipx"),
- str(home / ".local" / "share" / "pipx"),
- str(home / "pipx")]
- return [Path(r) / "venvs" / "agent-reach" for r in roots if r]
+ local = os.environ.get("LOCALAPPDATA", "")
+ venv_dirs = [_pipx_reported_venvs(),
+ os.path.join(os.environ["PIPX_HOME"], "venvs") if os.environ.get("PIPX_HOME") else "",
+ str(home / ".local" / "pipx" / "venvs"),
+ str(home / "Library" / "Application Support" / "pipx" / "venvs"),
+ str(home / ".local" / "share" / "pipx" / "venvs"),
+ os.path.join(local, "pipx", "pipx", "venvs") if local else "",
+ str(home / "pipx" / "venvs")]
+ return [Path(d) / "agent-reach" for d in venv_dirs if d]
def _has_agent_reach(venv: Path) -> bool:
diff --git a/agent_reach/runtime/manage.py b/agent_reach/runtime/manage.py
index 26833294..02aae41c 100644
--- a/agent_reach/runtime/manage.py
+++ b/agent_reach/runtime/manage.py
@@ -855,7 +855,7 @@ def _move_to_uv(info: dict) -> dict:
child = [str(exe), "setup"] if fresh else [str(exe), "update", "--sync-only"]
out = subprocess.run(child, capture_output=True, text=True, timeout=1800)
try:
- result = json.loads(out.stdout.strip().splitlines()[-1]).get("result") or {}
+ result = json.loads(out.stdout.strip().split("\n")[-1]).get("result") or {}
except (ValueError, IndexError):
result = {"raw": out.stdout[-500:]}
actions = list(result.get("user_actions") or [])
@@ -895,7 +895,7 @@ def update(check_only: bool = False) -> dict:
exe = shutil.which("agent-reach") or sys.argv[0]
out = subprocess.run([exe, "update", "--sync-only"], capture_output=True, text=True, timeout=1800)
try:
- synced = json.loads(out.stdout.strip().splitlines()[-1]).get("result") or {}
+ synced = json.loads(out.stdout.strip().split("\n")[-1]).get("result") or {}
except (ValueError, IndexError):
synced = {"raw": out.stdout[-500:]}
return {**info, "upgraded": True, "method": method, "sync": synced,
diff --git a/scripts/check_release_acceptance.py b/scripts/check_release_acceptance.py
index 31b7dd97..f186a0f5 100644
--- a/scripts/check_release_acceptance.py
+++ b/scripts/check_release_acceptance.py
@@ -61,7 +61,7 @@ def validate(data: dict, required: set[tuple[str, str]], digest: str) -> list[st
def main() -> int:
parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument("manifest", nargs="?", default="docs/validation/release-acceptance.json")
+ parser.add_argument("manifest", nargs="?", default=".github/release-acceptance.json")
args = parser.parse_args()
from agent_reach.runtime.cli import unified_channels
required = {(channel.name, action.name) for channel in unified_channels() for action in channel.actions}
diff --git a/scripts/record_release_acceptance.py b/scripts/record_release_acceptance.py
new file mode 100644
index 00000000..28941fa8
--- /dev/null
+++ b/scripts/record_release_acceptance.py
@@ -0,0 +1,136 @@
+"""Run every declared channel action through the real `agent-reach` CLI and write the
+release acceptance record that `check_release_acceptance.py` (and the release workflow) require.
+
+Run on the maintainer's machine after the needed logins/keys are in place:
+
+ python scripts/record_release_acceptance.py # all channels
+ python scripts/record_release_acceptance.py --only reddit # recheck some, keep the rest
+ python scripts/record_release_acceptance.py --episode <xiaoyuzhou episode URL>
+
+Only codes, counts and backends are written; no queries' results, cookies or paths.
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import platform
+import subprocess
+import sys
+from datetime import datetime, timezone
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+sys.path.insert(0, str(ROOT))
+sys.path.insert(0, str(ROOT / "scripts"))
+
+from check_release_acceptance import source_digest # noqa: E402
+
+DEFAULT_OUT = ROOT / ".github" / "release-acceptance.json"
+
+#: Actions without a fixed live_test take their target from an earlier result in the same run.
+FROM_SEARCH = {
+ ("twitter", "tweets"): ("profile", None, {"username": "OpenAI", "limit": 2}),
+ ("twitter", "thread"): ("search", "target", None),
+ ("youtube", "transcribe"): (None, None, {"target": "https://www.youtube.com/watch?v=jNQXAC9IVRw"}),
+ ("reddit", "read"): ("search", "target", None),
+ ("xiaohongshu", "read"): ("search", "target", None),
+ ("xiaohongshu", "comments"): ("search", "target", None),
+ ("linkedin", "read"): ("jobs", "target", None),
+ ("boss", "read"): ("search", "target", None),
+}
+
+
+def _argv(channel, action, params) -> list:
+ args = [channel.name, action.name]
+ for p in action.params:
+ value = params.get(p.name)
+ if value is None:
+ continue
+ args += [str(value)] if p.required else [f"--{p.name}", str(value)]
+ return args + ["--timeout", str(max(action.timeout or 60, 60))]
+
+
+def _run(args) -> dict:
+ env = {**os.environ, "AGENT_REACH_NO_UPDATE_CHECK": "1", "PYTHONPATH": str(ROOT)}
+ out = subprocess.run([sys.executable, "-m", "agent_reach.cli", *args], capture_output=True,
+ text=True, encoding="utf-8", errors="replace", env=env, timeout=900, cwd=str(ROOT))
+ try:
+ # split("\n"), not splitlines(): post text may hold U+2028 and similar separators
+ return json.loads(out.stdout.strip().split("\n")[-1])
+ except (ValueError, IndexError):
+ return {"ok": False, "items": [], "error": {"code": "UNREADABLE"}}
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ parser.add_argument("--only", nargs="*", default=None, help="channels to (re)check; others keep their rows")
+ parser.add_argument("--episode", default="", help="a public Xiaoyuzhou episode URL for transcribe")
+ parser.add_argument("--out", default=str(DEFAULT_OUT))
+ ns = parser.parse_args()
+
+ from agent_reach.runtime import manage, state
+ from agent_reach.runtime.cli import unified_channels
+
+ digest, osname = source_digest(), platform.system()
+ out_path = Path(ns.out)
+ try:
+ old = json.loads(out_path.read_text("utf-8"))
+ except (OSError, ValueError):
+ old = {}
+ kept = [r for r in old.get("results", []) if r.get("source_sha256") == digest]
+ channels = [c for c in unified_channels() if ns.only is None or c.name in ns.only]
+ names = {c.name for c in channels}
+ rows = [r for r in kept if r.get("channel") not in names]
+ pending = [p for p in old.get("pending", []) if p.get("channel") not in names
+ and old.get("source_sha256") == digest]
+ data = state.load()
+ for ch in channels:
+ if not manage.is_added(ch, data):
+ pending += [{"channel": ch.name, "action": a.name, "reason": f"not added: run `agent-reach add {ch.name}`"}
+ for a in ch.actions]
+ print(f"{ch.name}: not added, skipped")
+ continue
+ first_url = {}
+ for action in ch.actions:
+ params = dict(action.live_test or {})
+ if not action.live_test:
+ source, key, fixed = FROM_SEARCH.get((ch.name, action.name), (None, None, None))
+ if (ch.name, action.name) == ("xiaoyuzhou", "transcribe"):
+ fixed = {"target": ns.episode} if ns.episode else None
+ if fixed:
+ params = dict(fixed)
+ elif source and first_url.get(source):
+ params = {key: first_url[source]}
+ else:
+ reason = "needs --episode" if ch.name == "xiaoyuzhou" else f"no {source} result to read"
+ pending.append({"channel": ch.name, "action": action.name, "reason": reason})
+ print(f"{ch.name}/{action.name}: skipped ({reason})")
+ continue
+ result = _run(_argv(ch, action, params))
+ items = result.get("items") or []
+ if items and items[0].get("url"):
+ first_url[action.name] = items[0]["url"]
+ passed = bool(result.get("ok") and items and result.get("backend"))
+ code = None if passed else (result.get("error") or {}).get("code") or "EMPTY"
+ rows.append({"channel": ch.name, "action": action.name, "method": "real-cli",
+ "backend": result.get("backend"), "item_count": len(items),
+ "at": datetime.now(timezone.utc).isoformat(), "os": osname,
+ "source_sha256": digest, "passed": passed, "error": code})
+ if not passed:
+ pending.append({"channel": ch.name, "action": action.name, "reason": code})
+ print(f"{ch.name}/{action.name}: {'ok' if passed else code} ({len(items)} items)")
+ required = {(c.name, a.name) for c in unified_channels() for a in c.actions}
+ passed_keys = {(r["channel"], r["action"]) for r in rows if r.get("passed")}
+ pending = [p for p in pending if (p["channel"], p["action"]) not in passed_keys]
+ record = {"source_sha256": digest, "release_ready": not pending and required <= passed_keys,
+ "pending": pending, "results": sorted(rows, key=lambda r: (r["channel"], r["action"]))}
+ out_path.parent.mkdir(parents=True, exist_ok=True)
+ out_path.write_text(json.dumps(record, ensure_ascii=False, indent=1) + "\n", "utf-8")
+ print(f"\nrelease_ready: {record['release_ready']} passed {len(passed_keys & required)}/{len(required)} "
+ f"pending {len(pending)} -> {out_path}")
+ return 0 if record["release_ready"] else 1
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/tests/test_browser_slots.py b/tests/test_browser_slots.py
index de38e5e4..8dd78270 100644
--- a/tests/test_browser_slots.py
+++ b/tests/test_browser_slots.py
@@ -63,12 +63,12 @@ def test_overall_limit_holds_across_sites(monkeypatch):
def test_waiting_in_line_does_not_use_the_query_timeout():
- clock = Clock(1.0)
with bb.query_slot("x"), bb.query_slot("x"):
+ clock = Clock(1.0) # created once the line is full, so only the wait itself is measured
entered, release, t, errors = _enter_later(lambda: bb.query_slot("x", clock))
time.sleep(1.2) # longer than the whole budget
assert entered.wait(5)
- assert clock.remaining() > 0.5
+ assert clock.remaining() > 0.3
release.set()
t.join(5)
@@ -91,18 +91,27 @@ def test_exclusive_waits_for_running_queries_and_holds_off_new_ones(monkeypatch)
def test_parallel_same_site_searches_stay_spaced(monkeypatch):
- from agent_reach.runtime import dispatch
+ from agent_reach.runtime import dispatch, state
monkeypatch.setattr(dispatch, "BROWSER_SEARCH_INTERVAL", 0.8)
- starts = []
-
- def search():
- dispatch._pace_browser("twitter", "search", Clock(10.0))
- starts.append(time.monotonic())
-
- threads = [threading.Thread(target=search) for _ in range(2)]
+ stamps = []
+ real_mutate = state.mutate
+
+ def recording(change):
+ def spy(saved):
+ out = change(saved)
+ starts = saved.get("request_starts", {})
+ if "twitter" in starts:
+ stamps.append(starts["twitter"])
+ return out
+ return real_mutate(spy)
+
+ monkeypatch.setattr(dispatch.state, "mutate", recording)
+ threads = [threading.Thread(target=lambda: dispatch._pace_browser("twitter", "search", Clock(10.0)))
+ for _ in range(2)]
for t in threads:
t.start()
for t in threads:
t.join(10)
- assert len(starts) == 2 and abs(starts[1] - starts[0]) >= 0.7
+ starts = sorted(set(stamps))
+ assert len(starts) == 2 and starts[1] - starts[0] >= 0.75 # the recorded search starts
diff --git a/tests/test_manage.py b/tests/test_manage.py
index c6b554e7..9f8e4c03 100644
--- a/tests/test_manage.py
+++ b/tests/test_manage.py
@@ -346,11 +346,13 @@ def test_update_from_a_non_uv_install_moves_itself_to_uv(env, monkeypatch, tmp_p
def __init__(self, stdout=""):
self.returncode, self.stdout, self.stderr = 0, stdout, ""
+ exe = tmp_path / ("agent-reach.exe" if os.name == "nt" else "agent-reach")
+
def run(cmd, **kw):
calls.append(cmd)
if cmd[1:4] == ["tool", "dir", "--bin"]:
return Done(str(tmp_path))
- if cmd[0] == str(tmp_path / "agent-reach"):
+ if cmd[0] == str(exe):
return Done(json.dumps({"ok": True, "result": {"user_actions": ["log in to x"],
"installation_report": {"markdown": "r"}}}))
return Done()
@@ -358,7 +360,7 @@ def test_update_from_a_non_uv_install_moves_itself_to_uv(env, monkeypatch, tmp_p
monkeypatch.setattr(manage.subprocess, "run", run)
out = manage.update()
assert calls[0][:4] == ["/fake/uv", "tool", "install", "--force"] and calls[0][-1].endswith("/v2.0.1.zip")
- assert calls[2] == [str(tmp_path / "agent-reach"), "setup"] # no state yet: the new copy sets itself up
+ assert calls[2] == [str(exe), "setup"] # no state yet: the new copy sets itself up
assert out["upgraded"] and out["installation_report"] == {"markdown": "r"}
assert "log in to x" in out["user_actions"]
@@ -392,12 +394,14 @@ def test_old_pipx_copy_and_its_launcher_are_removed(monkeypatch, tmp_path):
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.delenv("PIPX_HOME", raising=False)
monkeypatch.delenv("PIPX_BIN_DIR", raising=False)
+ monkeypatch.setattr(legacy, "_pipx_reported_venvs", lambda: "")
venv = _old_venv(tmp_path / ".local" / "pipx" / "venvs" / "agent-reach")
(venv / "bin").mkdir()
(venv / "bin" / "agent-reach").write_text("")
shim = tmp_path / ".local" / "bin" / "agent-reach"
shim.parent.mkdir(parents=True)
- shim.symlink_to(venv / "bin" / "agent-reach")
+ if os.name != "nt": # pipx links its launcher on macOS/Linux; on Windows uv overwrites the copy
+ shim.symlink_to(venv / "bin" / "agent-reach")
(tmp_path / ".agent-reach-venv").mkdir() # a venv without Agent Reach is not ours to touch
assert [i["kind"] for i in legacy.find()] == ["pipx"]
out = legacy.remove()
@@ -407,6 +411,7 @@ def test_old_pipx_copy_and_its_launcher_are_removed(monkeypatch, tmp_path):
def test_old_shared_venv_only_loses_agent_reach(monkeypatch, tmp_path):
from agent_reach.runtime import legacy
+ monkeypatch.setattr(legacy, "_pipx_reported_venvs", lambda: "")
monkeypatch.setenv("HOME", str(tmp_path))
monkeypatch.delenv("PIPX_HOME", raising=False)
venv = _old_venv(tmp_path / ".agent-reach-venv")