Fix OAuth callbacks and extension module loading#1
Open
xlr8harder wants to merge 1 commit into
Open
Conversation
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
This fixes two harn runtime issues found while dogfooding
harn-gibsonas a harn extension:sys.modulesbefore executing them, matching normal import behavior.Why
Interactive
/loginfor theopenai-codexprovider currently fails because the OAuth provider expectscallbacks.onAuth, but interactive mode passes{"onAuth": ...}. This produces:'dict' object has no attribute 'onAuth'Separately, extension files are executed via
exec_module()without being inserted intosys.modules. Some standard Python machinery, including dataclasses with postponed annotations, expectssys.modules[cls.__module__]to exist during class creation. Without that, valid extension code can fail during load.Changes
SimpleNamespace.sys.modulesbeforeexec_module().sys.modulesentry, or removes the temporary entry, if extension execution fails.Testing
Ran targeted regressions:
uv run --no-sync --all-packages pytest tests/test_coding_agent/test_interactive_mode_foundation.py::test_show_login_dialog_only_collects_manual_code_for_callback_providers tests/test_coding_agent/ test_resources_and_extensions.py::test_extension_loader_registers_modules_for_dataclass_annotations -qResult:
2 passed