Commit Graph

3617 Commits

Author SHA1 Message Date
Alexander Whitestone
69e10967bd feat: session garbage collection (#315)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 14s
Add garbage_collect() method to SessionDB that cleans up empty and
trivial sessions based on age:
- Empty sessions (0 messages) older than 24h
- Trivial sessions (1-5 messages) older than 7 days
- Sessions with >5 messages kept indefinitely

Add `hermes sessions gc` CLI command with:
- --empty-hours (default: 24)
- --trivial-days (default: 7)
- --trivial-max (default: 5)
- --source filter
- --dry-run preview mode
- --yes skip confirmation

The dry-run flow: preview what would be deleted, ask for confirmation,
then execute. Handles child session FK constraints properly.

7 tests covering: empty/trivial deletion, active session protection,
substantial session preservation, dry-run, source filtering, and child
session handling.

Closes #315
2026-04-13 17:30:39 -04:00
Alexander Whitestone
992498463e fix: gateway config debt - validation, defaults, fallback chain checks (#328)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 1m32s
- Expand validate_config_structure() to catch:
  - fallback_providers format errors (non-list, missing provider/model)
  - session_reset.idle_minutes <= 0 (causes immediate resets)
  - session_reset.at_hour out of 0-23 range
  - API_SERVER enabled without API_SERVER_KEY
  - Unknown root-level keys that look like misplaced custom_providers fields
- Add _validate_fallback_providers() in gateway/config.py to validate
  fallback chain at gateway startup (logs warnings for malformed entries)
- Add API_SERVER_KEY check in gateway config loader (warns on unauthenticated endpoint)
- Expand _KNOWN_ROOT_KEYS to include all valid top-level config sections
  (session_reset, browser, checkpoints, voice, stt, tts, etc.)
- Add 13 new tests for fallback_providers and session_reset validation
- All existing tests pass (47/47)

Closes #328
2026-04-13 17:29:20 -04:00
Alexander Whitestone
ec3cd2081b fix(poka-yoke): add tool fixation detection (#310)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 26s
Detect when the same tool is called 5+ times consecutively and inject
a nudge advising the agent to diversify its approach.

Evidence from empirical audit:
- Top marathon session (qwen, 1643 msgs): execute_code streak of 20
- Opus session (1472 msgs): terminal streak of 10

The nudge fires every 5 consecutive calls (5, 10, 15...) so it
persists without being spammy. Tracks independently in both
sequential and concurrent execution paths.
2026-04-13 10:16:11 -04:00
Alexander Whitestone
110642d86a fix(poka-yoke): add circuit breaker for error cascading (#309)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 28s
After 3 consecutive tool errors, inject a warning into the tool result
advising the agent to switch strategies. Escalates at 6 and 9+ errors.

Empirical data from audit:
- P(error | prev error) = 58.6% vs P(error | prev success) = 25.2%
- 2.33x cascade amplification factor
- Max observed streak: 31 consecutive errors

Intervention tiers:
- 3 errors: advisory warning (try different tool, use terminal, simplify)
- 6 errors: urgent stop (halt retries, investigate or switch)
- 9+ errors: terminal-only recovery path

Tracks errors in both sequential and concurrent execution paths.
2026-04-13 10:12:24 -04:00
a547552ff7 Merge pull request 'fix(cron): guard against interpreter shutdown in run_job() and tick()' (#355) from fix/cron-interpreter-shutdown-352 into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 27s
Merge PR #355: fix(cron): guard against interpreter shutdown in run_job() and tick()
2026-04-13 07:32:06 +00:00
Alexander Whitestone
d6bd3bc10a fix(cron): guard against interpreter shutdown in run_job() and tick()
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 27s
Fixes #352

Problem: When the gateway restarts, Python's interpreter enters
shutdown phase while the last cron tick is still processing jobs.
ThreadPoolExecutor.submit() raises RuntimeError("cannot schedule
new futures after interpreter shutdown") for every remaining job.
This cascades through the entire tick queue.

Fix (two-part):
1. run_job(): Wrap ThreadPoolExecutor creation + submit in try/except.
   On RuntimeError, fall back to synchronous execution (same thread)
   so the job at least attempts instead of dying silently.
2. tick(): Check sys.is_finalizing() before each job. If the
   interpreter is shutting down, stop processing immediately
   instead of wasting time on doomed ThreadPoolExecutor.submit() calls.
2026-04-13 03:22:10 -04:00
7a577068f0 Merge pull request 'fix(cron): ensure ticker thread starts and monitor for death (#342)' (#345) from fix/cron-ticker-startup into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 25s
Auto-merge #345
2026-04-13 07:15:28 +00:00
Alexander Whitestone
cb9214cae0 fix(cron): ensure ticker thread starts and monitor for death
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 27s
Issue #342: Cron ticker thread not starting in gateway

Root cause: asyncio.get_running_loop() can raise RuntimeError in edge cases,
and ticker thread can die silently without restart.

Fix:
1. Wrap get_running_loop() in try/except with fallback
2. Add explicit logger.info when ticker starts
3. Add async monitor that restarts ticker if it dies
4. Log PID and thread name for debugging
2026-04-13 03:02:36 -04:00
eecff3fbf6 Merge pull request 'ci: add skills index workflow (rescued from #307)' (#335) from feat/skills-index-workflow into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 26s
2026-04-13 04:26:28 +00:00
Alexander Whitestone
4210412bef ci: add skills index workflow
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 37s
2026-04-13 00:23:59 -04:00
c8739e0970 Merge pull request 'feat: add research paper project scaffolder' (#308) from feat/research-paper-scaffolder into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 25s
Merge PR #308: feat: add research paper project scaffolder
2026-04-13 02:56:17 +00:00
6c358ae603 docs: add scaffolder quick start to Phase 0
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 28s
2026-04-13 02:52:32 +00:00
8450c4a8f5 feat: add research paper project scaffolder 2026-04-13 02:51:32 +00:00
0677bbd9d7 fix: support required cron tool choice
Some checks failed
Forge CI / smoke-and-build (push) Has been cancelled
Merge PR #306: fix: support required cron tool choice
2026-04-13 02:33:39 +00:00
Alexander Whitestone
9b950bb897 fix: support required cron tool choice
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 39s
2026-04-12 22:14:47 -04:00
a3452d2c66 purge: remove Anthropic from hermes-agent config layer (#305)
Some checks failed
Forge CI / smoke-and-build (push) Failing after 26s
2026-04-13 02:02:00 +00:00
039d2ab88c Merge pull request 'purge: remove .claw/ OpenClaw session artifacts' (#304) from perplexity/openclaw-purge-claw-dir into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 24s
2026-04-13 01:36:02 +00:00
6b036a76fc purge: add .claw/ to .gitignore
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 29s
2026-04-13 01:34:26 +00:00
c2eff61025 purge: remove OpenClaw session artifact session-1775534636684-0.jsonl 2026-04-13 01:34:23 +00:00
250e79b8c9 purge: remove OpenClaw session artifact session-1775533542734-0.jsonl 2026-04-13 01:34:21 +00:00
abe321736e Merge pull request 'fix: muda cleanup and cost guardrails' (#303) from fix/muda-cleanup-and-guardrails into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 24s
2026-04-13 00:58:46 +00:00
ccc2fc3280 feat: implement guardrails in AIAgent
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 27s
2026-04-13 00:54:55 +00:00
455b0c87b1 feat: add cost and safety guardrails
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 31s
2026-04-13 00:31:51 +00:00
669c25b2bb fix: move TEST_OPTIMIZATION_GUIDE.md to docs/reports/ 2026-04-13 00:31:49 +00:00
4f2e75f228 fix: move TEST_OPTIMIZATION_GUIDE.md to docs/reports/ 2026-04-13 00:31:48 +00:00
6da28ef92d fix: move TEST_ANALYSIS_REPORT.md to docs/reports/ 2026-04-13 00:31:46 +00:00
bb905d3bf9 fix: move TEST_ANALYSIS_REPORT.md to docs/reports/ 2026-04-13 00:31:44 +00:00
51c20bb6c6 fix: move SECURITY_MITIGATION_ROADMAP.md to docs/reports/ 2026-04-13 00:31:42 +00:00
df8e87bf7c fix: move SECURITY_MITIGATION_ROADMAP.md to docs/reports/ 2026-04-13 00:31:41 +00:00
8495bff72f fix: move SECURITY_FIXES_CHECKLIST.md to docs/reports/ 2026-04-13 00:31:39 +00:00
90c9549408 fix: move SECURITY_FIXES_CHECKLIST.md to docs/reports/ 2026-04-13 00:31:36 +00:00
ee1ce608b2 fix: move SECURITY_AUDIT_REPORT.md to docs/reports/ 2026-04-13 00:31:34 +00:00
32f0065ad0 fix: move SECURITY_AUDIT_REPORT.md to docs/reports/ 2026-04-13 00:31:31 +00:00
703e3f2676 fix: move PERFORMANCE_OPTIMIZATIONS.md to docs/reports/ 2026-04-13 00:31:29 +00:00
4d78858180 fix: move PERFORMANCE_OPTIMIZATIONS.md to docs/reports/ 2026-04-13 00:31:27 +00:00
e8cf56b25b fix: move PERFORMANCE_HOTSPOTS_QUICKREF.md to docs/reports/ 2026-04-13 00:31:24 +00:00
6e846fa082 fix: move PERFORMANCE_HOTSPOTS_QUICKREF.md to docs/reports/ 2026-04-13 00:31:23 +00:00
b1faef42f6 fix: move PERFORMANCE_ANALYSIS_REPORT.md to docs/reports/ 2026-04-13 00:31:21 +00:00
aa71670f8d fix: move PERFORMANCE_ANALYSIS_REPORT.md to docs/reports/ 2026-04-13 00:31:19 +00:00
f2159d4103 feat: consolidate release notes into CHANGELOG.md 2026-04-13 00:31:17 +00:00
359ca0491f fix: move RELEASE_v0.2.0.md to CHANGELOG.md 2026-04-13 00:31:15 +00:00
eae08e8c01 fix: move RELEASE_v0.3.0.md to CHANGELOG.md 2026-04-13 00:31:13 +00:00
4c3dbfe51f fix: move RELEASE_v0.4.0.md to CHANGELOG.md 2026-04-13 00:31:11 +00:00
d3e92f2b2d fix: move RELEASE_v0.5.0.md to CHANGELOG.md 2026-04-13 00:31:08 +00:00
e301dd97e5 fix: move RELEASE_v0.6.0.md to CHANGELOG.md 2026-04-13 00:31:06 +00:00
26a41b84b6 fix: move RELEASE_v0.7.0.md to CHANGELOG.md 2026-04-13 00:31:03 +00:00
f6d2f36a34 Merge pull request '[SECURITY] Provider Allowlist Guard — runtime banned-provider enforcement' (#302) from perplexity/provider-allowlist into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 25s
2026-04-13 00:27:18 +00:00
986076b808 Add provider allowlist guard — runtime enforcement of banned providers
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 29s
2026-04-13 00:27:10 +00:00
47c510c6f3 Merge pull request 'feat: poka-yoke: block tool hallucination (#294)' (#301) from fix/json-repair-for-tool-calls into main
Some checks failed
Forge CI / smoke-and-build (push) Failing after 27s
2026-04-12 22:55:40 +00:00
Alexander Whitestone
a318c389fe feat: poka-yoke: block tool hallucination before API calls (#294)
Some checks failed
Forge CI / smoke-and-build (pull_request) Failing after 25s
Validates tool names against valid_tool_names before execution.
Both sequential and concurrent paths checked.

When model hallucinates non-existent tool:
- Logs warning with tool name
- Returns error listing available tools
- Does NOT make API call (saves budget)
2026-04-12 18:55:27 -04:00