Skip to content

Pass automation owner IDs to SDK conversations#169

Open
neubig wants to merge 2 commits into
mainfrom
neubig/automation-owner-attribution
Open

Pass automation owner IDs to SDK conversations#169
neubig wants to merge 2 commits into
mainfrom
neubig/automation-owner-attribution

Conversation

@neubig

@neubig neubig commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

  • export AUTOMATION_USER_ID and AUTOMATION_ORG_ID into automation run environments
  • have prompt/plugin presets pass AUTOMATION_USER_ID to Conversation(...) when the installed SDK supports the user_id parameter
  • avoid breaking older installed SDK versions by detecting Conversation.__new__ support before passing user_id
  • add dispatcher coverage for the exported owner env vars

Dependency

Testing

  • python3 -m py_compile openhands/automation/dispatcher.py openhands/automation/presets/prompt/sdk_main.py openhands/automation/presets/plugin/sdk_main.py tests/test_disable_automation.py
  • git diff --check

Issue

Closes #173

This PR description update was created by an AI agent (OpenHands) on behalf of Graham Neubig.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🚀 Deploy Preview PR Created/Updated

A deploy preview has been created/updated for this PR.

Deploy PR: https://github.com/OpenHands/deploy/pull/4547
Automation SHA: f30c222a0dd802d67c4f84d0ef89014cae0a8468
Last updated: Jun 08, 2026, 08:46:28 PM ET

Once the deploy PR's CI passes, the automation service will be deployed to the feature environment.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Coverage

all-hands-bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review complete.

This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here.

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Taste Rating

🟡 Acceptable — Works but could be cleaner

Analysis

[CRITICAL ISSUES]
None — the implementation is sound and the backward-compatibility check is prudent.

[IMPROVEMENT OPPORTUNITIES]

  • [openhands/automation/presets/plugin/sdk_main.py, Lines 138-143] Defensive Pattern: The _conversation_supports_user_id() helper uses inspect.signature(Conversation.__new__) at runtime. While this works, it's fragile — it depends on Conversation.__new__ not changing signature for unrelated reasons. A cleaner alternative might be to check the SDK version or feature flag, but given this is a compatibility shim for the transition period, this approach is acceptable.

  • [tests/test_preset_router.py, Lines 840-841] Test Fragility: The assertion checks for a specific JSON formatting. If the template later uses different quoting, this test may break. Consider checking for structural content instead.

[STYLE NOTES]
None — code is clean and follows existing patterns.

[TESTING GAPS]

  • The test additions in test_disable_automation.py correctly verify the new env vars are passed through. Consider adding a test for the _conversation_supports_user_id() fallback path to ensure backward compatibility is exercised.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟢 LOW
    The change is additive and defensive. Env vars are passed through to the execution context, and the SDK integration has a graceful fallback for older versions. No breaking changes to existing functionality.

VERDICT:

Worth merging: Core logic is sound, minor suggestions provided

KEY INSIGHT:

The backward-compatibility pattern (_conversation_supports_user_id()) is appropriate for the transition period but should be revisited once all deployed SDKs support the user_id parameter.


This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation.

@all-hands-bot

Copy link
Copy Markdown
Contributor

👀 OpenHands is reviewing this pull request.

Conversation: https://nestable-nonremittably-sha.ngrok-free.dev/conversations/f252821d-6fe5-4fbb-8770-14cf5a5c6295


This comment was generated by an AI agent (OpenHands) on behalf of the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track PR #169: Pass automation owner IDs to SDK conversations

2 participants