HERMES-GIELIE/api
nesquena-hermes 44ead2a73d
fix(context): bound non-git project-context file walk at the workspace (#4164) (#4231)
* fix(#4164): bound project-context file walk in non-git workspaces

_project_context_candidates mirrored the agent's _find_hermes_md exactly,
including the bug that 'stop_at = git_root' is None in a non-git tree —
so the walk 'for directory in [cwd, *cwd.parents]: ... if stop_at and
directory == stop_at: break' never broke and ran to filesystem root.
A workspace at /tmp/x/project/subdir could surface /tmp/x/HERMES.md
(a file outside the workspace) in the Memory > Project Context tab.

Fix: when no git root is found, treat the workspace itself as the stop
boundary. The cwd is still scanned (preserving in-workspace AGENTS.md /
HERMES.md behavior), but parents are skipped — we never walk into the
user's home directory or /tmp.

Git workspaces are unchanged (still walk up to the git root). The
existing test_3866 walk-to-git-root test still passes.

The issue notes the agent-side walk in agent/prompt_builder._find_hermes_md
should be bounded the same way for full parity; that lives in a separate
repo (hermes-agent), so this PR fixes only the WebUI side. Until the
agent ships the same bound, the WebUI tab will under-report context
files that live above a non-git workspace — strictly less surprising
than the previous over-report.

tests/test_issue4164_bound_non_git_project_context_walk.py (4 tests) pins:
- non-git workspace does not leak a parent HERMES.md
- non-git workspace still reads in-workspace context files
- git workspace walk-to-git-root is unchanged
- workspace-level HERMES.md wins, parent copy doesn't appear even shadowed

All 10 existing test_3866_project_context_memory_section tests still pass.

Closes #4164.

* chore(release): stamp v0.51.428 (Release OO) for #4164

---------

Co-authored-by: Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
Co-authored-by: nesquena-hermes <agent@nesquena-hermes>
2026-06-14 23:22:29 -07:00
..
__init__.py
agent_health.py Release v0.51.260 — Release IB (stage-r8) (#3614) 2026-06-04 15:21:41 -07:00
agent_sessions.py fix(#3930): push source filters into agent session scans 2026-06-11 16:59:18 -04:00
auth.py harden(#4023): apply Opus security findings — verify-side name-pattern gate + require handler when auth enabled 2026-06-12 07:37:48 +00:00
background.py
background_process.py [HELD — independent review pending] Release v0.51.340 — bg_task agent wakeup (trio #2968+#2971+#2979) (#3867) 2026-06-08 22:36:18 -07:00
clarify.py feat: add distinct attention request sound 2026-05-30 19:40:40 +00:00
commands.py Merge #4112 (skill bundles in WebUI slash commands, #4087) onto master 2026-06-13 23:13:28 +00:00
compression_anchor.py fix(sidebar): keep newer continuation visible over older snapshot 2026-05-28 13:38:06 -06:00
config.py Release ON: show_cli_sessions default-on for new installs (#3988) + symlink delete/rename guard (#4217) (#4230) 2026-06-14 23:06:22 -07:00
dashboard_probe.py
extensions.py
gateway_chat.py Apply Codex fix: gateway done-payload uses _session_payload_with_full_messages too (sibling of streaming done/error sites) + test 2026-06-14 20:38:43 +00:00
gateway_watcher.py Release v0.51.256 — Release HX (stage-r4) (#3596) 2026-06-04 12:28:06 -07:00
goals.py
helpers.py Merge #4028 (align profile cookie env var with HERMES_WEBUI_ prefix) onto master 2026-06-13 07:20:58 +00:00
kanban_bridge.py Release v0.51.348 — Release LL (Phase 0 hotfix: timeout regression + data-loss + leaks) (#3917) 2026-06-10 01:12:48 -07:00
metering.py
models.py Release OL: empty-pending session-save guard (#4205) + cron-reply fix (#3975) (#4219) 2026-06-14 19:39:26 -07:00
oauth.py Release v0.51.330 — Release KT (#3716 api docstring backfill, partial) (#3841) 2026-06-08 12:22:22 -07:00
onboarding.py
passkeys.py Release v0.51.270 — Release IL (stage-u1 — un-hold batch: #3517 #3624 #3613) (#3674) 2026-06-05 11:35:26 -07:00
paths.py fix(profiles): avoid config import cycle 2026-06-01 05:05:16 +00:00
plugin_providers.py Release v0.51.270 — Release IL (stage-u1 — un-hold batch: #3517 #3624 #3613) (#3674) 2026-06-05 11:35:26 -07:00
plugins.py fix(#2622): plugin card UX — legible Open button, single badge, visible toggle + reject protocol-relative tab.path 2026-06-02 03:58:02 +00:00
profiles.py fix(profiles): scope the detached models-rebuild worker to the active profile (#3957) 2026-06-11 01:41:24 +00:00
providers.py fix(providers): claim probe workers under the pool lock (#3787) 2026-06-13 16:42:43 -04:00
request_diagnostics.py
rollback.py
route_approvals.py fix(approval): extract _webui_mirror_token literal into named constant 2026-06-14 17:48:37 +00:00
routes.py fix(context): bound non-git project-context file walk at the workspace (#4164) (#4231) 2026-06-14 23:22:29 -07:00
run_journal.py fix(streaming): tighten tool limit terminal guards 2026-06-12 10:03:31 +08:00
runner_client.py harden: runner client rejects non-http(s) base_url + no redirect-follow (#3073) 2026-05-31 17:49:26 +00:00
runtime_adapter.py
session_discoverability.py
session_events.py perf(sidebar): cache and single-flight /api/sessions payloads (#3791) 2026-06-13 22:36:25 -04:00
session_lifecycle.py Release v0.51.256 — Release HX (stage-r4) (#3596) 2026-06-04 12:28:06 -07:00
session_ops.py Release v0.51.276 — Release IR (stage-p3e — preserve manually-named session titles #3542) (#3682) 2026-06-05 13:34:54 -07:00
session_recovery.py Release v0.51.329 — Release KS (#3814 O(n) index map + #3815 startup recovery skip) (#3840) 2026-06-08 11:49:26 -07:00
skill_usage.py
startup.py
state_sync.py fix: use Optional[T] for default None parameters in state_sync.py 2026-06-01 17:20:17 +00:00
streaming.py fix: keep settled stream message counts consistent 2026-06-14 20:33:56 +00:00
system_health.py
terminal.py Release v0.51.304 — Release JT (stage-p2a — un-held terminal reaper + opt-in Docker GPU) (#3757) 2026-06-06 18:04:16 -07:00
todo_state.py Release v0.51.261 — Release IC (stage-r11) (#3616) 2026-06-04 16:46:20 -07:00
turn_journal.py Release v0.51.326 — Release KP (#3618 + #3802 + #3762 + #3810) (#3816) 2026-06-07 23:18:51 -07:00
updates.py fix(#4085): surface dirty install state in update-check payload 2026-06-13 06:05:06 +00:00
upload.py Release v0.51.326 — Release KP (#3618 + #3802 + #3762 + #3810) (#3816) 2026-06-07 23:18:51 -07:00
usage.py
webui_session_db.py Release v0.51.305 — Release JU (stage-p2b — dormant unified-SessionDB adapter) (#3759) 2026-06-06 18:16:07 -07:00
workspace.py Release v0.51.296 — stage-3731 (remote-workspace blocked-root security fix #3731) (#3744) 2026-06-06 13:49:59 -07:00
workspace_git.py Release v0.51.311 — Release KA (brick-wave: workspace Git RCE hardening #3769 + stale-snapshot sidebar visibility #3770) (#3776) 2026-06-07 08:05:30 -07:00
worktrees.py