Skip to content

The agent that grows with you

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

ethernetc9bd7459c2b3
diff --cc apps/desktop/src/app/messaging/index.test.tsx
index 46b80f283e0,90caac9a1db..a1f95d34139
--- a/apps/desktop/src/app/messaging/index.test.tsx
+++ b/apps/desktop/src/app/messaging/index.test.tsx
@@@ -126,7 -116,9 +126,7 @@@ async function renderMessaging()
}
describe('MessagingView profile scope', () => {
- it('follows the active profile instead of targeting primary when there is no override', async () => {
+ it('names the active profile explicitly instead of sending an unscoped request', async () => {
- const { $settingsScopeOverride } = await import('@/store/settings-scope')
-
$settingsScopeOverride.set(null)
getMessagingPlatforms.mockResolvedValue({ platforms: [platform()] })
diff --cc hermes_cli/doctor_state.py
index 049afbcac2f,60972cdf4e3..68a8736ffcb
--- a/hermes_cli/doctor_state.py
+++ b/hermes_cli/doctor_state.py
@@@ -655,6 -569,12 +686,12 @@@ def _check_profiles(should_fix: bool, f
if not wrapper.is_file():
continue
with warn_on_error(""):
- _m = _re.search(r"hermes -p (\S+)", wrapper.read_text(encoding="utf-8"))
+ _m = _re.search(r"hermes -p (\S+)", wrapper.read_text(encoding="utf-8-sig"))
if _m and not profile_exists(_m.group(1)):
check_warn(f"Orphan alias: {wrapper.name} → profile '{_m.group(1)}' no longer exists")
+ # Same helper as the multiplex migration preflight, so doctor names the duplicates that make
+ # `hermes gateway migrate --multiplex` refuse (and made pre-multiplex standalone gateways race).
+ from hermes_cli.gateway_migrate import duplicate_credential_findings
+ for line in duplicate_credential_findings():
+ check_warn("Duplicate platform credential across profiles", f"({line})")
+ f.manual_issues.append(line)
diff --cc scripts/run_tests_parallel.py
index 804700c5198,504802c9eb1..21178fd246e
mode 100644,100755..100644
--- a/scripts/run_tests_parallel.py
+++ b/scripts/run_tests_parallel.py
@@@ -58,12 -58,29 +58,34 @@@ from concurrent.futures import ThreadPo
from pathlib import Path
from typing import Dict, List, Optional, Tuple
+# The CI lane selector owns the platforms() spec resolver; share it so the
+# "skipped on this host" note and the lanes can never disagree.
+sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
+from scripts.ci.list_os_marked_tests import gated_specs, spec_hosts # noqa: E402
+
+
+ def _sweep_killed_run_roots(root: str) -> None:
+ """Remove per-file temp roots older runs left behind. Each attempt deletes its own root
+ in ``finally``, but a runner that is SIGKILLed (a tool timeout, a stray pkill) never gets
+ there and leaks one root per in-flight worker; nothing else looks at this directory, so
+ 983 of them (3.4 GB) accumulated on one host in three days. Idle for a day = dead."""
+ try:
+ from hermes_constants_scratch import prune_idle_entries
+ except ImportError: # runner invoked from outside the repo root
+ return
+ prune_idle_entries(Path(root), 24, frozenset())
+
+
+ def _rmtree_force(path: str) -> None:
+ def _chmod_retry(fn, p, _exc):
+ try:
+ os.chmod(os.path.dirname(p) if fn is os.rmdir or fn is os.listdir else p, 0o700)
+ os.chmod(p, 0o700)
+ fn(p)
+ except OSError:
+ pass
+ shutil.rmtree(path, onerror=_chmod_retry)
+
-
def _runner_scratch_root() -> str:
"""Per-run temp roots live on DISK, never the system temp dir: a full-suite run writes
gigabytes of tmp_path fixtures and /tmp is RAM-backed tmpfs on many Linux hosts. /var/tmp is
@@@ -568,12 -578,10 +590,13 @@@ def _run_one_file_once
finally:
# Delete the temp root for this attempt. Nothing reads it after the
# subprocess exits. More than 3000 of them fill the disk of the
- # runner over one suite.
- shutil.rmtree(temproot, ignore_errors=True)
+ # runner over one suite. Permission fixtures leave read-only dirs
+ # behind; make them writable and retry instead of skipping them.
+ _rmtree_force(temproot)
+ if rc not in (0, 5) and not output.strip():
+ output = f"pytest child exited {rc} (0x{rc & 0xffffffff:08x}) with no output: {file}\n"
+
if rc == 5:
# No tests collected in THIS file — legitimate per-file: a
# platform-gated or fully-marker-filtered file (e.g. a win32-only
diff --cc tests/test_scratch_dir.py
index 0aa5ae93495,99dcad8dc58..bfbcd0ab985
--- a/tests/test_scratch_dir.py
+++ b/tests/test_scratch_dir.py
@@@ -46,19 -46,26 +46,26 @@@ def test_bootstrap_import_exports_scrat
assert out.stdout.split() == [expected, expected]
- def test_prune_removes_only_stale_top_level_entries(tmp_path):
+ def test_prune_removes_idle_entries_and_keeps_trees_written_deep_inside(tmp_path):
+ """Idle retention: an entry goes when nothing in its subtree was written within the window;
+ a tree whose only recent write is three levels down is still in use and stays, even though
+ its top-level mtime is ancient (a directory's mtime ignores writes below its children)."""
scratch = get_scratch_dir(tmp_path, prune=False)
- stale, fresh = scratch / "stale", scratch / "fresh.txt"
- stale.mkdir()
- (stale / "f").write_text("x", encoding="utf-8")
+ idle, live, fresh = scratch / "idle", scratch / "live", scratch / "fresh.txt"
+ deep = live / "lane" / "wt"
+ deep.mkdir(parents=True)
+ idle.mkdir()
+ (idle / "f").write_text("x", encoding="utf-8")
+ (deep / "log").write_text("x", encoding="utf-8")
fresh.write_text("y", encoding="utf-8")
- ancient = time.time() - 100 * 3600
- os.utime(stale, (ancient, ancient))
+ ancient = time.time() - 30 * 3600
+ for path in (idle, idle / "f", live, live / "lane", deep):
+ os.utime(path, (ancient, ancient))
assert prune_scratch_dir(scratch) == 1
- assert not stale.exists() and fresh.exists()
+ assert not idle.exists() and live.exists() and fresh.exists()
[email protected](sys.platform == "win32", reason="POSIX directory modes")
[email protected]("posix") # POSIX directory modes
class TestScratchDirPermissionPolicy:
"""get_scratch_dir must honor the home permission policy instead of a blanket 0700:
an explicit HERMES_HOME_MODE and a managed/shared home win (#117347)."""
diff --cc tui_gateway/model_switch.py
index 917957dbaf0,849702344e8..423e4ae44e8
--- a/tui_gateway/model_switch.py
+++ b/tui_gateway/model_switch.py
@@@ -78,12 -78,12 +78,14 @@@ def _profile_runtime_scope_tokens(profi
overlay = None
scopes.home = set_hermes_home_override(str(home))
else:
- # No home override: the launch home IS get_hermes_home() (``_profile_home`` answers None for
- # "already the launch profile"); only its secrets (+ terminal policy under multiplex) need binding.
+ # The launch home IS get_hermes_home() (``_profile_home`` answers None for "already the
+ # launch profile"); single-profile, only its secrets need binding. Once multiplexing is
+ # active the override is bound too: an unset override is the "unbound context" signal
+ # plugin runtime bindings and per-home slots fail closed on (#118538).
+ # Resolved at call time like the launch state.db handle: a harness that re-homes the process
+ # after import must not have the import-time home's ``.env`` read on every turn.
from tui_gateway.launch_profile_policy import launch_secret_scope, launch_terminal_env
- home = Path(_hermes_home)
+ home = _launch_home()
secrets = launch_secret_scope(home)
scopes.secret = set_secret_scope(secrets)
if not is_multiplex_active():