Can hooks not access secrets? Is this intentional?...
# openhands-cloud
e
Can hooks not access secrets? Is this intentional? Bc this session was absolutely created after I added this to the secret store
m
Good question. Perhaps something to check
@fresh-machine-37269 can you check if hooks can access secrets? If no, open an issue for that. The hook should have access to the secret of the conversation
👀 1
f
🤖 On it! View progress here: oss-agent-canvas.ngrok.dev/conversations/…
✅ Done! Checked the SDK source (openhands-sdk 1.58.2, matching current main): no, hooks cannot access secrets today.
HookExecutor.execute()
builds the hook's subprocess env from
sanitized_env()
plus a few
OPENHANDS_*
vars (project dir, session id, event type, tool name) — the conversation's
SecretRegistry
is never consulted, and there are zero references to secrets anywhere in
openhands/sdk/hooks/
. So
$MY_API_KEY
in a hook command resolves to empty, even though the same secret works when the agent runs it via
execute_command
(which name-scans commands and injects matching secrets). Agent hooks also spawn their sub-conversation without forwarding secrets. The frustrating part is that
SecretRegistry.get_all_secrets_as_env_vars()
already exists exactly for opaque consumers that can't be name-scanned (the ACP CLI uses it) — hooks are the same kind of consumer but the hook path never calls it. I verified no existing issue covered this and filed one: github.com/OpenHands/software-agent-sdk/issues/6966 (labeled bug + hooks). It includes the code-level findings, repro steps, and a suggested fix (thread the conversation's
SecretRegistry
through
create_hook_callback
→
HookManager
→
HookExecutor
, inject via
get_all_secrets_as_env_vars()
, and route through
track_exported_values()
so hook stdout stays masked in
HookExecutionEvent
).
e
okay a related issue which is stopping my work around which i have been struggling with for a few weeks is that the setup.sh isn’t running, so despite Me putting in workarounds for things like missing secrets, none of my setup is getting set up: github.com/OpenHands/enterprise/issues/41
I would work on fixing it, but I know Enterprise Repo doesn’t want open source contributions.
anyone i can/should tag in the thread?
m
The fix is in the sdk so it should not be a problem ;)
I mean you can open a pr to fix it
e
i’ll give it a shot
I am quite certain now that this issue is in the enterprise repo, not the sdk. Are you sure its in the SDK?
m
Yes, pretty sure 🙂 Because the definition of the hooks is in the sdk. But perhaps there is also something small to do in enterprise but not sure 100%
e
@modern-fireman-99755 attempted! github.com/OpenHands/software-agent-sdk/pull/7145
there is still an enterprise portion, but this is the sdk part
m
Left some comments 🙂