feat(adt-server): wire safe_execute hooks from environment URLs#146
Conversation
When ADT_SERVER_MCP_SAFE_EXECUTE_ENABLED=true, the adt-server binary now falls back to HTTP-based default hooks when explicit consume/report functions are not supplied: - ADT_SERVER_MCP_AUTHORIZATION_CONSUMER_URL -> consumeExecutionAuthorization - ADT_SERVER_MCP_OUTCOME_REPORTER_URL -> reportExecutionOutcome Both endpoints receive a POST with a JSON body and an Authorization Bearer header. Non-2xx responses are treated as denied/rejected outcomes. Also unset the new env vars in docker-entrypoint.adt-server.sh when MCP is disabled so orphaned safe_execute settings do not abort startup.
Original prompt from Petr
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for adt-cli canceled.
|
|
View your CI Pipeline Execution ↗ for commit 340ddf4
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 19 |
| Duplication | 10 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |



Summary
createAdtServerMcpOptionsnow provides sensible defaultconsumeExecutionAuthorizationandreportExecutionOutcomeimplementations whenADT_SERVER_MCP_SAFE_EXECUTE_ENABLED=trueand explicit hooks are not supplied. Deployments only need to set two URLs:ADT_SERVER_MCP_AUTHORIZATION_CONSUMER_URLADT_SERVER_MCP_OUTCOME_REPORTER_URLBoth endpoints receive a
POSTwith the hook payload as JSON plus anAuthorization: Bearer <authorizationToken>header. A non-2xx response is treated as a denied/rejected outcome.If either URL is missing (and no explicit hook is passed), startup still aborts with the existing
deployment-owned authorization and outcome hookserror, preserving the fail-closed behavior.Also updates
docker-entrypoint.adt-server.shto unset the new env vars whenADT_SERVER_MCP_ENABLED=false, so disabled MCP does not accidentally leave orphanedsafe_executesettings.Verification
node --import tsx --test packages/adt-server/tests/mcp-runtime.test.ts— 13/13 passingbunx nx lint adt-server— passingbunx nx build adt-server— passingRelates to #144.
Link to Devin session: https://app.devin.ai/sessions/287b8498d06b43dbb42f08caa958d478
Requested by: @ThePlenkov
Summary by cubic
Adds HTTP-based default safe_execute hooks to
adt-serverso deployments can provide two URLs instead of custom hook code. Preserves fail-closed startup and cleans up safe_execute env vars when MCP is disabled.New Features
consumeExecutionAuthorizationandreportExecutionOutcomefromADT_SERVER_MCP_AUTHORIZATION_CONSUMER_URLandADT_SERVER_MCP_OUTCOME_REPORTER_URLwhenADT_SERVER_MCP_SAFE_EXECUTE_ENABLED=trueand no explicit hooks are passed.ADT_SERVER_MCP_ENABLED=false.Migration
ADT_SERVER_MCP_SAFE_EXECUTE_ENABLED=true. Otherwise, provide custom hooks.Written for commit 340ddf4. Summary will update on new commits.