Skip to content

stage-346: 10-PR contributor batch — stale-stream guard extension + guarded worktree remove + CSP report collector + perf + i18n + ctl fix - #2180

Merged
nesquena-hermes merged 25 commits into
masterfrom
stage-346
May 13, 2026
Merged

nesquena-hermes merged 25 commits into
masterfrom
stage-346

Conversation

@nesquena-hermes

Copy link
Copy Markdown
Collaborator

stage-346 — 10-PR contributor batch (v0.51.53)

Nathan's "no high-risk merges today" directive: 10 low/medium-low-risk PRs ship; 6 deferred to tomorrow; 10 still on hold.

Composition

PR Author LOC Closes Surface
#2158 franksong2702 43 #2154 api/streaming.py — stale-stream guard extension (closes my Opus follow-up issue from yesterday)
#2156 franksong2702 710 refs #2057 Guarded POST /api/session/worktree/remove with 5 fail-closed checks
#2159 franksong2702 135 #2157 Clear stale active_stream_id on /api/sessions
#2160 franksong2702 200 #2095 CSP report collector endpoint + Report-To header
#2161 franksong2702 160 #2098 Localize 5 Logs severity keys for 8 locales
#2166 franksong2702 127 Consolidate session post-render into single pass (perf)
#2170 franksong2702 119 Skip CLI metadata lookup for native session loads (perf)
#2173 franksong2702 20 #2172 ctl.sh: recognize wrapper-launched daemons via persisted PYTHON_EXE
#2175 Michaelyklam 31 refs #2155 Soften "X segments" → "X prior turn(s)" English copy
#2176 MrFant 3 Handle dict model entries in _apply_provider_prefix

Total: +1567 / -150 across 29 files + 1 stage-346 maintainer-fix commit.

Stage-346 maintainer fix

  • server.py CSP-report auth carve-out scoped to POST only — Opus SHOULD-FIX defense-in-depth. PR Add CSP report collector endpoint #2160's carve-out (parsed.path != "/api/csp-report" and not check_auth) bypassed auth for all write methods on that path. Currently harmless (PATCH/DELETE fall through to CSRF 403 or routing 404), but scoping the bypass to POST is a one-line clarity win. 6-test CSP suite still passes.

What's deferred to tomorrow

PR LOC Why defer
#2149 464 CLI session-scan cache invalidation — high-risk.
#2151 599 CONFLICTING with #2158. Needs rebase after master settles.
#2167 381 Security-critical api/auth.py rewrite (PBKDF2 caching + key separation + Secure cookie + rate-limit locking) with a documented breaking change for settings.json.password_hash users. Needs explicit maintainer policy decision.
#2164 35 CI 3.11+3.13 FAILED (real test failures, not master drift).
#2171 230 CI 3.13 FAILED on test_ctl_script.py that #2173 fixes — after #2173 lands, contributor can rebase.
#2174 37 Behavior-policy change (show_cli_sessions default flip + auto-import). Needs explicit OK.

Verification

  • Full pytest: 5332 passed, 11 skipped, 1 xfailed, 2 xpassed in 99s (was 5307 — +25 net new tests)
  • run-browser-tests.sh: 20/20 QA + 11/11 API checks PASSED
  • Live UI smoke test on 8789 (fresh isolated env, zero JS errors):
    • CSP report endpoint: POST /api/csp-report returns 204 ✓; Report-To header advertised ✓; report-uri /api/csp-report in CSP header ✓
    • Worktree remove: 400 on missing session_id ✓; 154 i18n entries for worktree-remove keys across all locales ✓
    • Lineage badge: ${n} prior turn${n === 1 ? '' : 's'} template visible ✓
    • 30 occurrences of logs_severity_* localized values ✓
    • postProcessRenderedMessages in ui.js (3 refs) ✓
    • /api/models returns 200 with dict-shaped entries ✓
  • python -m py_compile clean on all modified .py files
  • node --check clean on all modified .js files
  • Merge-conflict markers: zero in any modified file
  • Opus advisor: SHIP. Three nits, one applied inline (CSP carve-out scoping). Two deferred to follow-up issues (per-IP key growth in CSP rate-limit dict; worktree-remove race window documented as known limitation for any future UI force toggle).

Stats

30 files changed, 1580 insertions(+), 151 deletions(-)

Closes

Refs #2057 slice 2 (via #2156); refs #2155 (via #2175).

Frank Song and others added 25 commits May 13, 2026 09:11
Backend:
- POST /api/session/worktree/remove — removes a session's git worktree
- Guards: stream/terminal lock, dirty/untracked without force
- remove_worktree_for_session() in api/worktrees.py

Frontend:
- 'Remove Worktree' context menu item + confirm modal
- i18n keys for all 11 locales

Tests:
- 5 tests: clean remove, missing worktree, no-path, route success, 404
When a provider's 'models' config contains dicts (e.g. {"id": "x", "label": "y"})
instead of plain strings, _apply_provider_prefix() crashes with:
  AttributeError: 'dict' object has no attribute 'startswith'

This happens because the list comprehension at line 3505 passes the raw dict
as the model ID. The fix extracts 'id' and 'label' from dict entries while
keeping string entries as-is.

Fixes the /api/models and /api/onboarding/status 500 errors.
fix: handle dict model entries in provider models list
Soften session lineage count badge (refs #2155)
Fix ctl Python wrapper ownership (closes #2172)
Fix stale stream exception writeback guards (closes #2154)

# Conflicts:
#	CHANGELOG.md
Localize logs severity filters (closes #2098)

# Conflicts:
#	CHANGELOG.md
Skip CLI metadata lookup for native session loads

# Conflicts:
#	CHANGELOG.md
Fix stale stream state in session list (closes #2157)

# Conflicts:
#	CHANGELOG.md
Add CSP report collector endpoint (closes #2095)
Consolidate session post-render processing

# Conflicts:
#	CHANGELOG.md
Issue #2057 Slice 2: Add guarded worktree remove action
…report auth bypass to POST only

Opus advisor flagged that PR #2160's CSP-report auth carve-out covered all
write methods on the path, not just POST. Currently harmless (PATCH/DELETE
fall through to CSRF 403 or routing 404), but defense-in-depth — scope the
bypass to its actual use case.

CSP report regression suite (6 tests) still passes.
@nesquena-hermes
nesquena-hermes merged commit fdbbb0d into master May 13, 2026
3 checks passed
@nesquena-hermes
nesquena-hermes deleted the stage-346 branch May 13, 2026 07:20
SysAdminDoc pushed a commit to SysAdminDoc/hermes-webui that referenced this pull request Jun 26, 2026
stage-346: 10-PR contributor batch — stale-stream guard extension + guarded worktree remove + CSP report collector + perf + i18n + ctl fix
bernyforce pushed a commit to bernyforce/hermes-webui that referenced this pull request Jul 29, 2026
stage-346: 10-PR contributor batch — stale-stream guard extension + guarded worktree remove + CSP report collector + perf + i18n + ctl fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants