Skip to content

The agent that grows with you

Merge remote-tracking branch 'origin/main' into ethie/pm-clean

ethernetd29da5fe20bc
diff --cc .github/workflows/docker.yml
index b7882e7bda2,7e6b916f2ae..3c131afce9d
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@@ -199,21 -141,29 +199,25 @@@ jobs
# it between jobs via ``docker save``/``upload-artifact`` is slower
# than the build itself. Reusing the existing daemon state is the
# cheapest path to coverage on every PR that touches docker code.
+ # (The release path DOES pay that cost — see the save steps below —
+ # because publish must push the exact tested bytes, not a rebuild.)
# ---------------------------------------------------------------------
- - name: Install uv (for docker tests)
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # 8.2.0
+ # The stamp above marks the checkout as a docker distribution, and PM
+ # then expects the image's packaged runtime. The runner is not the
- # image: drop it before provisioning the test toolchain.
- - name: Remove the image install stamp from the checkout
- run: rm -f install-stamp.json
++ # image: park the stamp while the test toolchain is provisioned, then
++ # put it back — tests/docker compares the image's provenance against it.
++ - name: Park the image install stamp while provisioning the runner toolchain
++ run: mv install-stamp.json "$RUNNER_TEMP/install-stamp.json"
+
+ - name: Set up locked Python and test dependencies
+ uses: ./.github/actions/setup-pm
with:
- # Pinned: unpinned setup-uv fetches a 'latest' manifest from
- # raw.githubusercontent.com every job; transient fetch failures
- # fail the job (2026-07-28 incident). Keep in sync with tests.yml.
- version: "0.9.28"
+ extras: '["dev"]'
+ prune-python-cache: true
- - name: Set up Python 3.11 (for docker tests)
- uses: ./.github/actions/retry
- with:
- command: uv python install 3.11
-
- - name: Install Python dependencies (for docker tests)
- # ``dev`` extra pulls in pytest, pytest-asyncio —
- # everything tests/docker/ needs. We deliberately avoid ``all``
- # here because the docker tests only drive the container via
- # subprocess and don't import hermes_agent's optional deps.
- uses: ./.github/actions/retry
- with:
- command: uv sync --locked --python 3.11 --extra dev
++ - name: Restore the image install stamp for the docker tests
++ run: mv "$RUNNER_TEMP/install-stamp.json" install-stamp.json
+
- name: Run docker integration tests
env:
# Skip rebuild; use the image already loaded by the build step.
diff --cc agent/lsp/install.py
index 30913854ffb,fcf7f5d9083..6710bf94c2a
--- a/agent/lsp/install.py
+++ b/agent/lsp/install.py
@@@ -91,27 -107,27 +107,37 @@@ def _native_binary_candidates(base: Pat
return list(cands.values())
- def _first_existing(*bases: Path) -> Optional[Path]:
+ def _first_existing(*bases: Path, is_windows: Optional[bool] = None) -> Optional[Path]:
"""First platform-native candidate of any ``base`` that exists on disk."""
- return next((c for base in bases for c in _native_binary_candidates(base) if c.exists()), None)
+ return next((c for base in bases for c in _native_binary_candidates(base, is_windows=is_windows) if c.exists()), None)
+
+ def _npm_bin_dir() -> Path:
+ """npm's own ``node_modules/.bin`` under the staging tree, where its ``%~dp0``-relative wrappers work."""
+ return hermes_lsp_bin_dir().parent / "node_modules" / ".bin"
- def _existing_binary(name: str) -> Optional[str]:
- """Probe the staging dir + PATH for a binary named ``name``."""
- for staged in _native_binary_candidates(hermes_lsp_bin_dir() / name):
+
+ def _existing_binary(name: str, *, is_windows: Optional[bool] = None) -> Optional[str]:
+ """Probe the staging dir (+ npm's bin dir on Windows) then PATH for a binary named ``name``.
+
+ ``is_windows`` overrides the host check so the Windows resolution is testable as data on every lane.
+ """
+ win = _is_windows() if is_windows is None else is_windows
+ bases = [hermes_lsp_bin_dir() / name] + ([_npm_bin_dir() / name] if win else [])
+ for staged in (c for base in bases for c in _native_binary_candidates(base, is_windows=win)):
if staged.exists() and os.access(staged, os.X_OK):
return str(staged)
+ if any(r.get("strategy") == "pip" and r.get("bin") == name for r in INSTALL_RECIPES.values()):
+ import pm
+
+ try:
+ binary = pm.python_tool(f"lsp-{name}", name)
+ except RuntimeError as exc:
+ logger.warning("[install] cannot read Python server %s: %s", name, exc)
+ else:
+ if binary is not None:
+ return str(binary)
- suffixes = ("", *_WINDOWS_WRAPPER_SUFFIXES) if _is_windows() else ("",)
+ suffixes = (*_WINDOWS_WRAPPER_SUFFIXES, "") if win else ("",)
return next((p for s in suffixes if (p := shutil.which(f"{name}{s}"))), None)
@@@ -190,9 -242,9 +252,9 @@@ def _install_npm(pkg: str, bin_name: st
return None
staging = hermes_lsp_bin_dir().parent # <HERMES_HOME>/lsp/
install_targets = [pkg] + list(extra_pkgs or [])
- logger.info("[install] npm install --prefix %s %s", staging, " ".join(install_targets))
- cmd = [npm, "install", "--prefix", str(staging), "--silent", "--no-fund", "--no-audit", *install_targets]
- if not _run_installer("npm", pkg, cmd, timeout=300, env=with_hermes_node_path()):
+ cmd = [pm_bin, *_NODE_PM_ARGV[pm](str(staging)), *install_targets]
+ logger.info("[install] %s %s", pm, " ".join(cmd[1:]))
- if not _run_installer(pm, pkg, cmd, timeout=300):
++ if not _run_installer(pm, pkg, cmd, timeout=300, env=with_hermes_node_path()):
return None
found = _first_existing(staging / "node_modules" / ".bin" / bin_name)
if found is not None:
diff --cc apps/desktop/src/i18n/ar.ts
index ea6ff57a256,417790d62c3..faa9ec7e4e8
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@@ -1,53 -1,6 +1,13 @@@
import { defineLocale } from './define-locale'
export const ar = defineLocale({
+ externalOpenFailed: {
+ title: 'تعذّر فتح هذا الرابط',
+ message: 'لا يوجد متصفح مسجل لفتح هذا العنوان. انسخ الرابط وافتحه يدويًا.',
+ copyUrl: 'نسخ الرابط',
+ close: 'إغلاق'
+ },
+
- catalog: {
- listView: 'عرض القائمة',
- cardView: 'عرض البطاقات',
- installTitle: (name: string) => `تثبيت «${name}»؟`,
- installDescription: 'ستتوفر هذه المهارة في الجلسات الجديدة. ثبّت من المصادر التي تثق بها فقط.',
- installTo: 'التثبيت في',
- thisComputer: 'هذا الكمبيوتر',
- installing: 'جارٍ التثبيت…',
- installComplete: (name: string) => `تم تثبيت «${name}»`,
- destinationChanged: 'تغيرت وجهة التثبيت. أغلق هذا الحوار وافتح رابط التثبيت مجددًا.',
- browse: 'تصفح',
- installed: 'المثبتة',
- searchSkills: 'البحث في المهارات',
- searchPlugins: 'البحث في الإضافات',
- allSources: 'كل المصادر',
- allCategories: 'كل الفئات',
- about: 'نبذة',
- author: 'المؤلف',
- source: 'المصدر',
- category: 'الفئة',
- version: 'الإصدار',
- platforms: 'المنصات',
- requires: 'المتطلبات',
- tools: 'الأدوات',
- hooks: 'الخطافات',
- repository: 'المستودع',
- documentation: 'التوثيق',
- noResults: 'لا توجد نتائج مطابقة',
- tryAnother: 'جرّب بحثًا آخر أو امسح عوامل التصفية.',
- clearFilters: 'مسح عوامل التصفية',
- loadFailed: 'تعذر تحميل الكتالوج',
- retry: 'حاول مرة أخرى',
- more: 'عرض المزيد',
- pinned: 'التزام تمت مراجعته',
- snapshotHint: 'من كتالوج Hermes. لا يتصل التصفح بمستودعات المصدر مطلقًا.',
- installHint: 'راجع المصدر قبل التثبيت. تسري التغييرات على الجلسات الجديدة.',
- results: (count: number) => `النتائج: ${count.toLocaleString('ar')}`,
- back: 'العودة إلى النتائج'
- },
-
sessionImport: {
title: 'المتابعة من تطبيق آخر',
subtitle: 'انقل محادثة إلى Hermes وتابع من حيث توقفت.',
@@@ -1926,10 -1911,13 +1886,10 @@@
},
nav: {
'new-session': 'جلسة جديدة',
- skills: 'المهارات',
+ capabilities: 'المهارات',
messaging: 'المراسلة',
artifacts: 'العناصر',
- chat: 'المحادثة',
- settings: 'الإعدادات',
- cron: 'المهام المجدولة',
- agents: 'الوكلاء'
+ cron: 'المهام المجدولة'
},
searchAria: 'البحث في الجلسات',
searchPlaceholder: 'البحث في الجلسات...',
diff --cc apps/desktop/src/i18n/en.ts
index e00258d8373,6192d915d2a..3158a56f6e0
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@@ -3,51 -3,6 +3,12 @@@ import { FIELD_DESCRIPTIONS, FIELD_LABE
import type { Translations } from './types'
export const en: Translations = {
+ externalOpenFailed: {
+ title: 'Couldn’t open this link',
+ message: 'No browser is registered to open this address. Copy the link and open it manually.',
+ copyUrl: 'Copy link',
+ close: 'Close'
+ },
- catalog: {
- listView: 'List view',
- cardView: 'Card view',
- installTitle: (name: string) => `Install “${name}”?`,
- installDescription: 'This skill will be available in new sessions. Only install sources you trust.',
- installTo: 'Install to',
- thisComputer: 'This computer',
- installing: 'Installing…',
- installComplete: (name: string) => `“${name}” installed`,
- destinationChanged: 'The destination changed. Close this dialog and open the install link again.',
- browse: 'Browse',
- installed: 'Installed',
- searchSkills: 'Search skills',
- searchPlugins: 'Search plugins',
- allSources: 'All sources',
- allCategories: 'All categories',
- about: 'About',
- author: 'Author',
- source: 'Source',
- category: 'Category',
- version: 'Version',
- platforms: 'Platforms',
- requires: 'Requires',
- tools: 'Tools',
- hooks: 'Hooks',
- repository: 'Repository',
- documentation: 'Documentation',
- noResults: 'No matches',
- tryAnother: 'Try another search or clear your filters.',
- clearFilters: 'Clear filters',
- loadFailed: 'Could not load the catalog',
- retry: 'Try again',
- more: 'Show more',
- pinned: 'Reviewed commit',
- snapshotHint: 'From the Hermes catalog. Browsing never contacts source repositories.',
- installHint: 'Review the source before installing. Changes apply to new sessions.',
- results: (count: number) => `${count.toLocaleString()} result${count === 1 ? '' : 's'}`,
- back: 'Back to results'
- },
connectors: {
title: 'Connect your apps',
connect: 'Connect',
diff --cc apps/desktop/src/i18n/ja.ts
index d79db66fa09,cb3925206c7..2467a1f83d5
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@@ -3,51 -3,6 +3,12 @@@ import { defineFieldCopy } from '@/app/
import { defineLocale } from './define-locale'
export const ja = defineLocale({
+ externalOpenFailed: {
+ title: 'このリンクを開けませんでした',
+ message: 'このアドレスを開くブラウザが登録されていません。リンクをコピーして手動で開いてください。',
+ copyUrl: 'リンクをコピー',
+ close: '閉じる'
+ },
- catalog: {
- listView: 'リスト表示',
- cardView: 'カード表示',
- installTitle: (name: string) => `「${name}」をインストールしますか?`,
- installDescription: 'このスキルは新しいセッションで利用できます。信頼できる提供元からのみインストールしてください。',
- installTo: 'インストール先',
- thisComputer: 'このコンピューター',
- installing: 'インストール中…',
- installComplete: (name: string) => `「${name}」をインストールしました`,
- destinationChanged: 'インストール先が変更されました。このダイアログを閉じ、インストールリンクを開き直してください。',
- browse: '閲覧',
- installed: 'インストール済み',
- searchSkills: 'スキルを検索',
- searchPlugins: 'プラグインを検索',
- allSources: 'すべての提供元',
- allCategories: 'すべてのカテゴリ',
- about: '概要',
- author: '作者',
- source: '提供元',
- category: 'カテゴリ',
- version: 'バージョン',
- platforms: '対応プラットフォーム',
- requires: '必要なもの',
- tools: 'ツール',
- hooks: 'フック',
- repository: 'リポジトリ',
- documentation: 'ドキュメント',
- noResults: '一致する項目がありません',
- tryAnother: '別の検索を試すか、フィルターをクリアしてください。',
- clearFilters: 'フィルターをクリア',
- loadFailed: 'カタログを読み込めませんでした',
- retry: '再試行',
- more: 'さらに表示',
- pinned: 'レビュー済みコミット',
- snapshotHint: 'Hermesカタログの情報です。閲覧時に提供元のリポジトリへ接続することはありません。',
- installHint: 'インストール前にソースを確認してください。変更は新しいセッションに適用されます。',
- results: (count: number) => `${count.toLocaleString('ja')}件の結果`,
- back: '結果に戻る'
- },
sessionImport: {
title: '別のアプリから続ける',
subtitle: '会話をHermesに取り込み、続きを始めましょう。',
diff --cc apps/desktop/src/i18n/types.ts
index fabcf2a5e78,bc729aaa0ce..8e77a8857c4
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@@ -59,51 -59,6 +59,12 @@@ interface AuxTaskCopy
}
export interface Translations {
+ externalOpenFailed: {
+ title: string
+ message: string
+ copyUrl: string
+ close: string
+ };
- catalog: {
- listView: string
- cardView: string
- installTitle: (name: string) => string
- installDescription: string
- installTo: string
- thisComputer: string
- installing: string
- installComplete: (name: string) => string
- destinationChanged: string
- browse: string
- installed: string
- searchSkills: string
- searchPlugins: string
- allSources: string
- allCategories: string
- about: string
- author: string
- source: string
- category: string
- version: string
- platforms: string
- requires: string
- tools: string
- hooks: string
- repository: string
- documentation: string
- noResults: string
- tryAnother: string
- clearFilters: string
- loadFailed: string
- retry: string
- more: string
- pinned: string
- snapshotHint: string
- installHint: string
- results: (count: number) => string
- back: string
- };
connectors: {
title: string
connect: string
diff --cc apps/desktop/src/i18n/zh-hant.ts
index 2ef86a08372,975f75d3e16..ba844499117
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@@ -3,51 -3,6 +3,12 @@@ import { defineFieldCopy } from '@/app/
import { defineLocale } from './define-locale'
export const zhHant = defineLocale({
+ externalOpenFailed: {
+ title: '無法開啟此連結',
+ message: '沒有註冊用於開啟此位址的瀏覽器。請複製連結並手動開啟。',
+ copyUrl: '複製連結',
+ close: '關閉'
+ },
- catalog: {
- listView: '清單檢視',
- cardView: '卡片檢視',
- installTitle: (name: string) => `安裝「${name}」?`,
- installDescription: '此技能將於新的工作階段中可用。請僅安裝可信來源的內容。',
- installTo: '安裝至',
- thisComputer: '這部電腦',
- installing: '正在安裝…',
- installComplete: (name: string) => `已安裝「${name}」`,
- destinationChanged: '安裝目標已變更。請關閉此對話框並重新開啟安裝連結。',
- browse: '瀏覽',
- installed: '已安裝',
- searchSkills: '搜尋技能',
- searchPlugins: '搜尋外掛',
- allSources: '所有來源',
- allCategories: '所有分類',
- about: '簡介',
- author: '作者',
- source: '來源',
- category: '分類',
- version: '版本',
- platforms: '支援的平台',
- requires: '相依項目',
- tools: '工具',
- hooks: '掛鉤',
- repository: '程式碼儲存庫',
- documentation: '文件',
- noResults: '沒有符合的項目',
- tryAnother: '請嘗試其他搜尋或清除篩選條件。',
- clearFilters: '清除篩選條件',
- loadFailed: '無法載入目錄',
- retry: '再試一次',
- more: '顯示更多',
- pinned: '已審核的提交',
- snapshotHint: '內容來自 Hermes 目錄。瀏覽時不會連線至來源程式碼儲存庫。',
- installHint: '安裝前請檢查原始碼。變更將於新的工作階段生效。',
- results: (count: number) => `${count.toLocaleString('zh-Hant')} 個結果`,
- back: '返回結果'
- },
sessionImport: {
title: '從其他應用程式繼續',
subtitle: '將對話匯入 Hermes,接著上次的進度繼續。',
diff --cc apps/desktop/src/i18n/zh.ts
index 31adf4ce578,b019d9c876e..d909ff3a945
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@@ -3,51 -3,6 +3,12 @@@ import { defineFieldCopy } from '@/app/
import { defineLocale } from './define-locale'
export const zh = defineLocale({
+ externalOpenFailed: {
+ title: '无法打开此链接',
+ message: '没有注册用于打开此地址的浏览器。请复制链接并手动打开。',
+ copyUrl: '复制链接',
+ close: '关闭'
+ },
- catalog: {
- listView: '列表视图',
- cardView: '卡片视图',
- installTitle: (name: string) => `安装“${name}”?`,
- installDescription: '此技能将在新会话中可用。请仅安装可信来源的内容。',
- installTo: '安装到',
- thisComputer: '此电脑',
- installing: '正在安装…',
- installComplete: (name: string) => `已安装“${name}”`,
- destinationChanged: '安装目标已更改。请关闭此对话框并重新打开安装链接。',
- browse: '浏览',
- installed: '已安装',
- searchSkills: '搜索技能',
- searchPlugins: '搜索插件',
- allSources: '所有来源',
- allCategories: '所有分类',
- about: '简介',
- author: '作者',
- source: '来源',
- category: '分类',
- version: '版本',
- platforms: '支持的平台',
- requires: '依赖项',
- tools: '工具',
- hooks: '钩子',
- repository: '代码仓库',
- documentation: '文档',
- noResults: '没有匹配项',
- tryAnother: '请尝试其他搜索或清除筛选条件。',
- clearFilters: '清除筛选条件',
- loadFailed: '无法加载目录',
- retry: '重试',
- more: '显示更多',
- pinned: '已审核的提交',
- snapshotHint: '内容来自 Hermes 目录。浏览时不会连接来源代码仓库。',
- installHint: '安装前请检查源代码。更改将在新会话中生效。',
- results: (count: number) => `${count.toLocaleString('zh')} 个结果`,
- back: '返回结果'
- },
connectors: {
title: '连接你的应用',
connect: '连接',
diff --cc tests/agent/lsp/test_workspace.py
index 801148cc356,e9051d95482..6af70d3c082
--- a/tests/agent/lsp/test_workspace.py
+++ b/tests/agent/lsp/test_workspace.py
@@@ -79,20 -66,45 +67,54 @@@ def test_resolve_workspace_for_file_use
assert gated is True
+ def test_resolve_workspace_for_file_survives_deleted_cwd(tmp_path: Path, monkeypatch):
+ """A removed process cwd must read as "no anchor", not raise — the LSP
+ workspace resolver runs inside a write tool and must never break a write
+ that already landed on disk."""
+ repo = tmp_path / "repo"
+ (repo / ".git").mkdir(parents=True)
+ file_path = repo / "x.py"
+ file_path.write_text("")
+ scratch = tmp_path / "scratch"
+ scratch.mkdir()
+ monkeypatch.chdir(scratch)
+ scratch.rmdir()
+ with pytest.raises(OSError):
+ os.getcwd()
+
+ root, gated = resolve_workspace_for_file(str(file_path))
+ assert root == str(repo)
+ assert gated is True
+ # The diagnostics path logs through eventlog; its cwd-relative shortener must
+ # not raise either, or the write succeeds with diagnostics silently dropped.
+ from agent.lsp.eventlog import _short_path
+ assert _short_path(str(file_path)) == str(file_path)
def test_normalize_path_expands_tilde(monkeypatch):
- monkeypatch.setenv("HOME", "/home/user")
+ # expanduser keys off USERPROFILE on native Windows, HOME elsewhere —
+ # set the var the running host actually consults (host-native rule:
+ # never fake the platform).
+ if sys.platform == "win32":
+ monkeypatch.setenv("USERPROFILE", r"C:\Users\fakeuser")
+ expected_base = r"C:\Users\fakeuser"
+ else:
+ monkeypatch.setenv("HOME", "/home/user")
+ expected_base = "/home/user"
p = normalize_path("~/x.py")
- assert p == os.path.abspath("/home/user/x.py")
+ assert p == os.path.abspath(os.path.join(expected_base, "x.py"))
+
+
+ def test_find_git_worktree_cache_is_capped(tmp_path: Path, monkeypatch):
+ """The start-dir cache resets past _WORKSPACE_CACHE_CAP instead of growing per distinct dir touched."""
+ import agent.lsp.workspace as ws
+
+ monkeypatch.setattr(ws, "_WORKSPACE_CACHE_CAP", 4)
+ for i in range(6):
+ d = tmp_path / f"d{i}"
+ d.mkdir()
+ assert find_git_worktree(str(d)) is None
+ assert len(ws._workspace_cache) <= 4
diff --cc tests/gateway/test_shutdown_forensics.py
index 4ff1ad2947b,8bd69e6380e..b6b4776e836
--- a/tests/gateway/test_shutdown_forensics.py
+++ b/tests/gateway/test_shutdown_forensics.py
@@@ -127,13 -127,17 +127,17 @@@ class TestArgvFreePersistence
# ---------------------------------------------------------------------------
class TestSpawnAsyncDiagnostic:
- # The diagnostic wraps its script in GNU coreutils ``timeout`` and the script
- # body is Linux-only (``ps -eo ... comm``, ``/proc/loadavg``, ``dmesg``,
- # ``pstree``). On hosts without ``timeout`` (macOS) Popen raises and the
- # producer returns None by design (fail-soft), so the spawn can only be
- # observed on Linux.
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_spawns_subprocess_and_writes_output(self, tmp_path):
+ self._assert_diagnostic_written(tmp_path)
+
+ @pytest.mark.macos_only
+ def test_spawns_without_gnu_timeout_on_macos(self, tmp_path):
+ """Stock macOS has no ``timeout`` binary and BSD ``ps``; the diagnostic still lands."""
+ self._assert_diagnostic_written(tmp_path)
+
+ @staticmethod
+ def _assert_diagnostic_written(tmp_path):
log_path = tmp_path / "diag.log"
pid = sf.spawn_async_diagnostic(log_path, "SIGTERM", timeout_seconds=3.0)
assert pid is not None and pid > 0
@@@ -157,8 -161,12 +161,12 @@@
contents = log_path.read_text(encoding="utf-8", errors="replace")
assert "shutdown diagnostic" in contents
assert "SIGTERM" in contents
+ lines = contents.splitlines()
+ ps_section = lines[lines.index("--- ps (top 60 by cpu, comm only) ---") + 1:]
+ assert ps_section and ps_section[0].split()[:2] == ["PID", "PPID"], \
+ "ps column header must lead the listing, not sort as a 0.0-cpu row"
- @pytest.mark.linux_only
+ @pytest.mark.platforms("linux")
def test_diagnostic_log_omits_child_argv_and_is_owner_only(self, tmp_path, child_with_secret_argv):
"""The detached ps/pstree walk must not write any process's argv to disk, and the log
(even one created 0644 by an earlier release) ends up owner-only."""
diff --cc tests/plugins/memory/test_hindsight_provider.py
index b00f6fa68e7,93a429464e5..0659473faa5
--- a/tests/plugins/memory/test_hindsight_provider.py
+++ b/tests/plugins/memory/test_hindsight_provider.py
@@@ -1694,4 -1755,25 +1694,25 @@@ class TestMultiplexBackgroundScope
if t.name == "hindsight-daemon-start":
t.join(timeout=5)
assert created == ["p1-secret"]
- assert "Daemon started successfully" in (home / "logs" / "hindsight-embed.log").read_text()
+ p.shutdown()
+
+
+ def test_append_mode_trims_retained_turns_without_dropping_any(provider, monkeypatch):
+ """Append retains ship only the delta, so retained turns leave `_session_turns` (a never-ending
+ session no longer pins every turn) while every turn is still shipped exactly once."""
+ provider._auto_retain = True
+ provider._retain_every_n_turns = 3
+ monkeypatch.setattr(provider, "_ensure_writer", lambda: None)
+ monkeypatch.setattr(provider, "_register_atexit", lambda: None)
+ monkeypatch.setattr(provider, "_resolve_retain_target", lambda doc: ("doc", "append"))
+ shipped: list[str] = []
+ monkeypatch.setattr(provider, "_make_turn_retain_job",
+ lambda turns, **kw: (lambda: shipped.extend(turns)))
+ provider._retain_queue = MagicMock(put=lambda job: job())
+
+ for i in range(7):
+ provider.sync_turn(f"user {i}", f"assistant {i}")
+
+ assert len(provider._session_turns) == 1 # only the un-retained tail (turn 7)
+ assert provider._last_retained_turn_count == 0
+ assert len(shipped) == 6 and len(set(shipped)) == 6
diff --cc website/docs/user-guide/features/plugins.md
index 8739bfb8a90,9ccabad476f..47f8067ca96
--- a/website/docs/user-guide/features/plugins.md
+++ b/website/docs/user-guide/features/plugins.md
@@@ -379,73 -378,8 +378,52 @@@ hermes plugins remove my-plugi
hermes plugins enable my-plugin # add to allow-list
hermes plugins disable my-plugin # remove from allow-list + add to disabled
hermes plugins capabilities [my-plugin] # declared vs granted capabilities
+hermes plugins check-updates # read-only: is any installed plugin outdated?
+hermes plugins adopt my-plugin # track a self-cloned plugin dir (read its git origin)
+hermes plugins trust-update-url my-plugin # confirm a changed update_url after review
```
+### Update checks and provenance
+
+Hermes records Git install source and revision in `.install-metadata.json`.
+Unpinned tracked installs compare the saved source's remote HEAD, or a matching
+saved `update_url` feed. Pinned installs remain pinned. Self-cloned directories
+need `hermes plugins adopt NAME` before they become tracked installations.
+Manually copied or provenance-drifted directories receive diagnostic guidance.
+Pip entry-point plugins can report an owning distribution's available version;
+that check does not turn them into Git-managed installs.
+
+`hermes plugins check-updates` leaves plugin files unchanged. A scheduled gateway
+check runs when `plugins.auto_update_check_hours` is due: default 24 hours,
+`0` disables it. Its receipt is available through `hermes pm status` and the
+desktop sync-status view. This is not a hard once-per-day limit if you configure
+a different interval.
+
+By default, updates require `hermes plugins update NAME`. Setting
+`plugins.auto_apply: true` opts tracked Git plugins into unattended updates.
+Both routes use the update security scan. Auto-apply does not manage pinned,
+manual, drifted, or pip-distribution rows.
+
+If a manifest changes or introduces `update_url`, Hermes refuses the new address
+until you approve it with `hermes plugins trust-update-url NAME`. This is a
+feed-source check, not a sandbox against already trusted plugin code.
+
+### Dependency preparation and preservation
+
+Python dependency installation has a separate consent/admission step.
+`plugins install --enable` does not bypass that step. A declined or
+non-interactive dependency install can leave the plugin installed but disabled.
+Node sidecar dependencies have a separate prompt and remain plugin-local.
+
+PM prepares Python dependencies with core and the enabled plugin set before
+publishing the new environment and configuration. A resolution failure preserves
+the previous selection. Restart Hermes when a new selected environment is not
+yet active in the running process.
+
+Ordinary Hermes application updates preserve user plugin directories, including
+wrapper files and external sidecar links. Explicit plugin updates or removals
+can change those files. See [Package management](../../reference/package-management.md)
+and the [plugin authoring guide](../../developer-guide/plugins/index.md#lazy-install-optional-python-dependencies).
- ### Installed and Browse in Desktop
-
- Open **Capabilities → Plugins**. **Installed** reads the app's desktop-plugin
- registry and the selected profile's actual agent-plugin state, combining both
- halves in one row where appropriate. It is not a list of catalog entries
- assumed to be installed. **Browse** is a native catalog view, not an embedded
- website; it uses the same **Installed / Browse** tabs as Skills, with search
- at the top and the tab switch and actions on one row. Browse defaults to cards,
- with list and card icons at the right of the filters. The layout choice is shared
- with Skills and remembered. Click a card to read its details; Install opens the
- existing review-then-install dialog.
-
- Desktop and the public [Plugin Catalog](/plugins) consume the same CDN
- snapshot, [`/docs/api/plugins.json`](https://hermes-agent.nousresearch.com/docs/api/plugins.json).
- The public alias serves the same data as Desktop's fetch URL,
- `https://nousresearch.github.io/hermes-agent/docs/api/plugins.json`. The docs
- build generates it from `plugin-catalog/*.yaml` and cached star counts. The
- same publish also supplies the removed-entry list used by the installer.
- Browsing does not query GitHub live or fetch source repos;
- the installer retrieves code only as part of the separate install flow.
-
### One-click install links (Desktop)
Hermes Desktop registers the `hermes://` URL scheme, so a website, README, or