fix(gateway): detect launchd-managed restart path#24898
Draft
bagelcode-jhkim wants to merge 50 commits into
Draft
fix(gateway): detect launchd-managed restart path#24898bagelcode-jhkim wants to merge 50 commits into
bagelcode-jhkim wants to merge 50 commits into
Conversation
Protect local /qopen forum-topic session work before Hermes upstream update.\n\nTargeted test: python -m pytest tests/gateway/test_telegram_question_sessions.py -o 'addopts=' -q (cherry picked from commit b197eb95ad45441c9e49030a78f97775703a11d4)
(cherry picked from commit 687c9e0e0b7c7160e23d99140611e85234200bd1)
(cherry picked from commit 0fa60aa3a421cbb4cbae49729f56a79ba0ae71aa)
(cherry picked from commit d720712bd2908b7c2427500bcf9bde03ade1bace)
(cherry picked from commit c37128eb3d2d8955c12ac6e048f6af24c5d07959)
(cherry picked from commit 9dca280d09b91034f4c45accd0fd43d29043cea9)
(cherry picked from commit 57ba5aa32b6ada334666e9df7e882d1ec9e251ce)
(cherry picked from commit 81223cb15a51002c5c3c7114162b7f8741fbf037)
(cherry picked from commit 4d9e59c7178a064fb55a679c7ba2b5d10f4e7cdc)
(cherry picked from commit c920bced6f240614327adb42ab310a08c5ad7e4a)
Prevent auxiliary title generation from treating the ChatGPT Codex backend URL as a generic custom OpenAI endpoint when provider=openai-codex.\n\nRegression test: python -m pytest tests/agent/test_auxiliary_client.py -o 'addopts=' -q (cherry picked from commit a49cbfa8bf40ebd2dcb81482ea8978cb52713477)
Add Telegram DecisionCard v0 support for Mina decision queues.\n\n- Render one decision per inline-keyboard message\n- Persist active cards so callbacks survive gateway restarts/script sends\n- Authorize callback users and record choice outcomes to decision_queue JSONL\n- Edit resolved cards and remove active state after selection\n\nTested: python -m pytest tests/gateway/test_telegram_decision_cards.py tests/gateway/test_telegram_question_sessions.py tests/gateway/test_telegram_topic_mode.py tests/gateway/test_telegram_approval_buttons.py tests/gateway/test_telegram_thread_fallback.py -o 'addopts=' -q (cherry picked from commit a11798be122cdf316f33a8a16c8a48f8dd6af32e)
Track the remaining Telegram question-session/topic changes separately from DecisionCard v0.\n\n- Bridge top-level telegram.question_sessions config into PlatformConfig.extra\n- Treat /qopen-created Q topics as auto-title eligible lanes\n- Rename Q forum topics when Hermes auto-generates a session title\n\nTested: python -m pytest tests/gateway/test_telegram_question_sessions.py tests/gateway/test_telegram_topic_mode.py tests/gateway/test_telegram_decision_cards.py -o 'addopts=' -q (cherry picked from commit 13c9e11ae0edd275d8eca9b63f7dae906c63628a)
(cherry picked from commit 8465eaa57bb089798d96fc936287b4edf0a4cbea)
(cherry picked from commit 0cbbc606861b239b0fa33f49361907691b30369a)
(cherry picked from commit ba02b87a105d5771520ff3b30db6bab5e9724cfa)
Add Telegram-native typing indicators on processing start, refresh them during long-running tasks, and stop the refresh on completion/disconnect.\n\nAlso let Telegram reactions and typing UX flags resolve directly from PlatformConfig.extra with env precedence, and bridge top-level telegram config keys into extra.\n\nTests:\n- venv/bin/python -m pytest tests/gateway/test_telegram_reactions.py -o 'addopts=' -q\n- venv/bin/python -m pytest tests/gateway/test_telegram_question_sessions.py tests/gateway/test_telegram_thread_fallback.py tests/gateway/test_telegram_decision_cards.py tests/gateway/test_telegram_text_batching.py -o 'addopts=' -q\n- venv/bin/python -m pytest tests/gateway/test_telegram_*.py -o 'addopts=' -q
Protect local Google Meet interaction diagnostics before Hermes upstream update.\n\nIncludes Playwright trace/video/interaction artifacts, safer Gemini consent blocking, direct caption-setting guards, and a tested stay-prompt DOM fallback that avoids Leave controls.\n\nTargeted test: venv/bin/python -m pytest tests/plugins/test_google_meet_plugin.py tests/plugins/test_google_meet_node.py -o 'addopts=' -q -> 115 passed, 3 warnings.
Protect Joohyun local Hermes runtime fixes before further updates. Changes: - restore Telegram typing indicators while capping stale native typing duration - add durable Telegram progress updates for long-running turns - preserve typing-disabled guard for direct base keep-typing calls - add Google Meet listen-only / Gemini consent / early-exit hardening Verification: - ./venv/bin/python -m pytest tests/gateway/test_telegram_reactions.py tests/plugins/test_google_meet_plugin.py -o 'addopts=' -q - 100 passed
Disable gateway /update by default so live messaging sessions cannot update/restart the checkout inline. Operators must run the safe out-of-band apply workflow unless HERMES_GATEWAY_ALLOW_INLINE_UPDATE=1 is explicitly set.\n\nTest: python -m pytest tests/gateway/test_update_command.py -o 'addopts=' -q
Gateway startup can run multiple kanban migrators against the same board DB. If one process adds max_retries after another observed a stale schema snapshot, SQLite raises duplicate column name. Re-check the live schema and treat that race as success.\n\nTests: python -m pytest tests/hermes_cli/test_kanban_core_functionality.py tests/hermes_cli/test_kanban_db.py tests/gateway/test_update_command.py tests/gateway/test_update_streaming.py -o 'addopts=' -q
Avoid creating default asyncio loops for sync tests that do not need them, and make update/slack gateway warning checks use async test lifecycles so pytest does not report unclosed loop/socket ResourceWarnings.\n\nTest: python -m pytest tests/gateway/test_update_command.py tests/gateway/test_update_streaming.py tests/hermes_cli/test_kanban_core_functionality.py::test_migration_tolerates_concurrent_duplicate_column_race tests/agent/test_auxiliary_client.py::TestAuxiliaryTaskProviderModel tests/gateway/test_platform_base.py::TestExtractMedia::test_media_tag_placeholder_is_documentation_not_attachment tests/gateway/test_slack.py::TestAppMentionHandler::test_app_mention_registered_on_connect -o 'addopts=' -W error::ResourceWarning -q
Add MEM0_BASE_URL support via a lightweight REST adapter for self-hosted mem0 while preserving hosted MemoryClient behavior.\n\nTargeted test: python -m pytest tests/plugins/memory/test_mem0_v2.py tests/agent/test_memory_user_id.py -o 'addopts=' -q
Add strict self-host mem0 search controls for Joohyun shadow-memory experiments: project/agent filters, candidate expansion config, local lexical rerank, admin-key auth header support, and metadata-preserving search output.\n\nVerification: ./venv/bin/python -m pytest tests/plugins/memory/test_mem0_v2.py tests/agent/test_memory_user_id.py -o 'addopts=' -q (39 passed).\nSelf-host smoke: Mac mini mem0 via SSH tunnel with MEM0_STRICT_SEARCH=true returned 5 results with source_id metadata.
Add mem0_shadow_search as an explicit shadow-memory tool lane for comparing self-hosted mem0 recall without cutting over the live memory provider.\n\nVerification:\n- ./venv/bin/python -m pytest tests/tools/test_mem0_shadow_tool.py tests/plugins/memory/test_mem0_v2.py tests/agent/test_memory_user_id.py tests/test_toolsets.py -o 'addopts=' -q\n- Mac mini loopback self-host smoke via SSH tunnel returned 5 shadow results with strict filters and preserved source metadata.
Expose /skill as a Telegram inline-keyboard picker so gateway users can search and load installed skills without relying on the native slash-command menu cap.\n\nVerification:\npython -m pytest tests/gateway/test_skill_picker_command.py tests/gateway/test_telegram_approval_buttons.py tests/hermes_cli/test_commands.py -o 'addopts=' -q\n164 passed in 1.16s
Add Joohyun/Mina design-taste-skill and visual-quality-harness to the curated Telegram native slash menu list so they survive the 100-command Bot API cap.\n\nVerification:\n- python -m pytest tests/hermes_cli/test_commands.py::TestTelegramMenuCommands::test_pinned_telegram_skills_survive_menu_cap -o 'addopts=' -q\n- Telegram Bot API setMyCommands/getMyCommands smoke confirmed both commands present.
Cron deliveries sent via the live Telegram adapter now include Quick Action metadata so recurring job outputs can expose one-tap Save/Todo/Delegate/Discard buttons.\n\nAlso adds a scheduler regression test for cron quick action metadata.
Add hermes qa / quick-actions commands for listing, showing, promoting, and discarding Telegram Quick Action routing candidates. Promotions are ledger-only pending execution, preserving the candidate-first gate before Cortex/wiki/Kanban mutation. Also timestamp active Quick Action payloads and prune stale timestamped entries on save.\n\nVerification:\npython -m py_compile hermes_cli/quick_actions.py hermes_cli/main.py gateway/platforms/telegram.py\npytest -q -o 'addopts=' -n 0 tests/hermes_cli/test_quick_actions.py tests/gateway/test_telegram_quick_actions.py tests/cron/test_scheduler.py
- add timeout fallback redelegation support and diagnostics to delegate_task - format /qa list as Telegram-friendly review cards - map Ollama Cloud reasoning_effort and update aux default Tests: - python -m pytest tests/hermes_cli/test_quick_actions.py tests/gateway/test_qa_command.py tests/tools/test_delegate_subagent_timeout_diagnostic.py -q --tb=short -o 'addopts=' - python -m compileall -q plugins/model-providers/ollama-cloud/__init__.py tools/delegate_tool.py hermes_cli/quick_actions.py gateway/run.py - python -m pytest tests/gateway/test_reasoning_command.py -q --tb=short -o 'addopts='
Add a short-lived one-shot restart approval marker so approved CLI restarts can be consumed by the running launchd gateway after SIGUSR1. Bound gateway stop/restart notifications so Telegram delivery stalls cannot block restart completion. Prefer launchd-scoped graceful restart with force fallback, and hard-block gateway-origin inline service-control commands from terminal tool execution.\n\nVerified with:\n- venv/bin/python -m pytest tests/gateway/test_restart_approval.py tests/gateway/test_gateway_shutdown.py tests/hermes_cli/test_gateway_service.py::TestLaunchdServiceRecovery tests/tools/test_gateway_inline_service_control_guard.py -o 'addopts=' -q\n- venv/bin/python -m py_compile gateway/restart.py gateway/run.py hermes_cli/gateway.py tools/terminal_tool.py\n\nLive smoke: Joohyun manually ran hermes gateway restart --approved and confirmed Telegram response recovered after restart.
Quick Action review callbacks promoted/discarded candidates using the active Hermes home, but refreshed the review card with list_candidates() defaulting to the process home. Pass get_hermes_home() through so temp/profile homes and tests keep remaining candidates visible.\n\nTest: python -m pytest tests/gateway/test_update_command.py tests/gateway/test_update_streaming.py tests/gateway/test_telegram_quick_actions.py tests/gateway/test_telegram_decision_cards.py -o 'addopts=' -q
- fix Anthropic OAuth usage utilization parsing as percent values - parse Codex additional_rate_limits such as GPT-5.3-Codex-Spark - fall back Codex usage monitoring to credential pool entries - record credential id/label for session insights breakdown Tests: - venv/bin/python -m pytest tests/test_account_usage.py tests/test_hermes_state.py tests/agent/test_insights.py -o 'addopts=' -q
Allow custom providers to carry max_tokens, request_overrides, and extra_body through CLI and gateway runtime routing. Keep gateway request_overrides out of runtime kwargs to avoid duplicate AIAgent constructor arguments. Verification: - python -m py_compile hermes_cli/config.py hermes_cli/runtime_provider.py cli.py gateway/run.py agent/transports/chat_completions.py run_agent.py - python -m pytest tests/hermes_cli/test_custom_provider_context_length.py tests/hermes_cli/test_custom_provider_model_switch.py tests/gateway/test_model_command_custom_providers.py tests/gateway/test_fast_command.py tests/gateway/test_request_overrides_routing.py -q -o 'addopts='
Add job-level reasoning_effort support for cron create/update/listing and scheduler execution precedence.\n\nAlso align cron script empty-output test with current scheduler contract and add focused regression coverage for reasoning overrides.\n\nVerification:\n- pytest tests/cron/test_jobs.py tests/cron/test_scheduler.py tests/cron/test_cron_script.py tests/cron/test_cron_reasoning_override.py -q -o 'addopts='\n- live smoke: mina-surprise-artifact-lab produced /Users/joohyunkim/.hermes/cron/output/252e53cfad96/2026-05-11_15-21-56.md with last_status=ok, model=gpt-5.4, provider=openai-codex, reasoning_effort=high
Resolve Anthropic OAuth usage checks through Hermes credential-pool entries when singleton/env auth is absent, and render extra-usage credits in the same dollar-oriented shape Joohyun sees in the UI.\n\nVerification:\n- pytest tests/test_account_usage.py -q -o 'addopts='
- make OpenRouter auth status reflect env-backed runtime credentials\n- keep quota watchdog aligned with proactive OpenRouter credits usage\n- add focused tests for OpenRouter account usage and auth status
Collaborator
|
Duplicate of #19940 — same XPC_SERVICE_NAME-based launchd detection for the gateway restart path. That PR is a focused 2-file fix; this one bundles 60+ unrelated file changes. |
This was referenced May 13, 2026
This was referenced May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
XPC_SERVICE_NAMEin addition to systemd'sINVOCATION_ID/restartthrough the service restart path when running under macOS launchdRoot cause
On macOS, Telegram-triggered
/restartwas treated as a manual detached restart because the gateway only checkedINVOCATION_IDto detect service management. launchd does not set that env var, so the process exited cleanly andlaunchddid not automatically bring it back.Verification
./venv/bin/python -m pytest -q tests/gateway/test_restart_notification.py./venv/bin/python -m pytest -q tests/e2e/test_platform_commands.py -k 'plaintext_restart_gateway'hermes gateway restart --approvedrestarted the launchd-managed gateway successfully on macOSNotes
tests/e2e/test_platform_commands.pyalready has unrelated existing/newfailures in this working tree; not introduced by this patch