Skip to content

perf(process): wake waiters on background completion - #45831

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-29d12107
Jun 14, 2026
Merged

teknium1 merged 1 commit into
mainfrom
hermes/hermes-29d12107

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

process(action="wait") now wakes as soon as a background process is moved to finished instead of waiting for the next 1-second polling tick.

Changes

  • tools/process_registry.py: add a per-session completion event, signal it from _move_to_finished(), and have wait() block on the event with the existing timeout cap.
  • tests/tools/test_process_registry.py: add a regression test proving wait() returns promptly when completion happens from another thread.

Validation

Check Result
RED test before implementation failed: wait() took 1.001s
Targeted regression passed: 1 passed in 0.17s
Process wait smoke passed: exited successfully in ~238ms including shell startup
Targeted suite 99 passed in 2.2s

Notes

  • Preserves timeout, interrupt, detached-session refresh, local-exit reconciliation, and completion-consumed behavior.
  • The untracked .plans/speed-optimization-audit.md is intentionally not included in this PR.

Infographic

Wake on Completion

@teknium1
teknium1 force-pushed the hermes/hermes-29d12107 branch from ca144b2 to ee0c24d Compare June 13, 2026 21:43
@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/hermes-29d12107 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 10887 on HEAD, 10893 on base (✅ -6)

🆕 New issues: none

✅ Fixed issues (1):

Rule Count
invalid-argument-type 1
First entries
tools/process_registry.py:1099: [invalid-argument-type] invalid-argument-type: Argument to bound method `ProcessRegistry._reconcile_local_exit` is incorrect: Expected `ProcessSession`, found `ProcessSession | None`

Unchanged: 5722 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/perf Performance improvement or optimization P2 Medium — degraded but workaround exists comp/tools Tool registry, model_tools, toolsets tool/code-exec execute_code sandbox labels Jun 13, 2026
@teknium1
teknium1 merged commit 1106879 into main Jun 14, 2026
28 checks passed
@teknium1
teknium1 deleted the hermes/hermes-29d12107 branch June 14, 2026 04:11
AIalliAI pushed a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
T02200059 pushed a commit to T02200059/hermes-agent that referenced this pull request Jun 18, 2026
xyshanren pushed a commit to xyshanren/hermes-agent-cn that referenced this pull request Jun 25, 2026
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
Methodician added a commit to Methodician/hermes-agent that referenced this pull request Jul 4, 2026
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P2 Medium — degraded but workaround exists tool/code-exec execute_code sandbox type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants