Skip to content

chore: Add INFO-level logging for hook_config debugging#2099

Draft
xingyaoww wants to merge 1 commit intomainfrom
debug-hook-config-logging
Draft

chore: Add INFO-level logging for hook_config debugging#2099
xingyaoww wants to merge 1 commit intomainfrom
debug-hook-config-logging

Conversation

@xingyaoww
Copy link
Collaborator

@xingyaoww xingyaoww commented Feb 17, 2026

Summary

Add INFO-level logging at key points to trace hook_config flow through the system.

Background

When debugging hook deployment issues in OpenHands PR #12773, we found that:

  1. ✅ App-server loads hooks from workspace correctly
  2. ✅ App-server sends hook_config in StartConversationRequest
  3. ❓ Agent-server receives the request but hooks don't execute

Changes

Add logging to trace hook_config at three key points:

1. conversation_service.py

  • Log when request is received (shows if hook_config exists in request)
  • Log when StoredConversation is created (shows if hook_config was deserialized)

2. event_service.py

  • Log when LocalConversation is created with hook_config from stored

3. local_conversation.py

  • Log _pending_hook_config during plugin loading
  • Log final_hook_config after merging with plugin hooks
  • Log hook processor creation success
  • Log when stop hooks are checked (on agent FINISHED)
  • Log stop hook execution result

Expected Log Output

With these changes, we should see logs like:

Creating StoredConversation - request has hook_config: True, hook_config value: {...}
StoredConversation created - stored.hook_config: HookConfig(...)
Creating LocalConversation with hook_config from stored: HookConfig(...)
LocalConversation created with _pending_hook_config: HookConfig(...)
_ensure_plugins_loaded: _pending_hook_config=HookConfig(...)
_ensure_plugins_loaded: final_hook_config=HookConfig(...)
Hook processor created successfully, has_stop_hooks=True
Agent FINISHED - checking stop hooks. _hook_processor=True
Running stop hooks...
Stop hook result: should_stop=True, feedback=...

Testing

This is a debugging change - the new logging will help identify where hook_config is being lost or why hooks aren't executing.

Related to: OpenHands/OpenHands#12773

@xingyaoww can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:407b24d-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-407b24d-python \
  ghcr.io/openhands/agent-server:407b24d-python

All tags pushed for this build

ghcr.io/openhands/agent-server:407b24d-golang-amd64
ghcr.io/openhands/agent-server:407b24d-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:407b24d-golang-arm64
ghcr.io/openhands/agent-server:407b24d-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:407b24d-java-amd64
ghcr.io/openhands/agent-server:407b24d-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:407b24d-java-arm64
ghcr.io/openhands/agent-server:407b24d-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:407b24d-python-amd64
ghcr.io/openhands/agent-server:407b24d-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:407b24d-python-arm64
ghcr.io/openhands/agent-server:407b24d-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:407b24d-golang
ghcr.io/openhands/agent-server:407b24d-java
ghcr.io/openhands/agent-server:407b24d-python

About Multi-Architecture Support

  • Each variant tag (e.g., 407b24d-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 407b24d-python-amd64) are also available if needed

Add logging at key points to trace hook_config flow:
- conversation_service.py: Log when StoredConversation is created
- event_service.py: Log when LocalConversation receives hook_config
- local_conversation.py: Log hook processor initialization and stop hook execution

This helps debug issues where hooks are not being executed despite
being loaded from workspace.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions
Copy link
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server
   conversation_service.py3399771%66–72, 159, 165, 173–174, 183–186, 195, 204, 217, 219–220, 222–223, 226–227, 234–235, 268, 271, 282–286, 288–291, 294–299, 377–379, 385–389, 392–393, 397–401, 404–405, 409–413, 416–417, 420–428, 435–436, 440, 442–443, 448–449, 455–456, 462–464, 469, 477, 480–483, 485, 506, 697
   event_service.py3269570%56–57, 76–78, 82–87, 90–93, 108, 212, 231, 288–289, 293, 301, 304, 350–351, 358, 367, 369, 373–375, 379, 388–389, 391, 395, 401, 403, 411–416, 546, 561, 563–564, 568, 582–584, 586, 590–593, 597–600, 608–611, 616–619, 630–631, 633–640, 642–643, 652–653, 655–656, 663–664, 666–667, 671, 677, 694–695, 698–699
openhands-sdk/openhands/sdk/conversation/impl
   local_conversation.py3382792%233, 277, 282, 310, 378, 430, 479, 487–489, 493–494, 587–588, 591, 737, 745, 747, 758, 760–762, 944, 949–952
TOTAL14082243082% 

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.

2 participants

Comments