-
Notifications
You must be signed in to change notification settings - Fork 52.5k
fix: honor approvals.timeout across CLI and ACP #13088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tomgreeEn
wants to merge
1
commit into
NousResearch:main
Choose a base branch
from
tomgreeEn:fix/approval-timeout-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+66
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ def make_approval_callback( | |
| request_permission_fn: Callable, | ||
| loop: asyncio.AbstractEventLoop, | ||
| session_id: str, | ||
| timeout: float = 60.0, | ||
| timeout: float | None = None, | ||
| ) -> Callable[[str, str], str]: | ||
| """ | ||
| Return a hermes-compatible ``approval_callback(command, description) -> str`` | ||
|
|
@@ -38,8 +38,17 @@ def make_approval_callback( | |
| loop: The event loop on which the ACP connection lives. | ||
| session_id: Current ACP session id. | ||
| timeout: Seconds to wait for a response before auto-denying. | ||
| If None, use Hermes approvals.timeout config. If <= 0, wait indefinitely. | ||
| """ | ||
|
|
||
| if timeout is None: | ||
| try: | ||
| from tools.approval import _get_approval_timeout | ||
|
|
||
| timeout = float(_get_approval_timeout()) | ||
| except Exception: | ||
| timeout = 60.0 | ||
|
|
||
| def _callback(command: str, description: str) -> str: | ||
| options = [ | ||
| PermissionOption(option_id="allow_once", kind="allow_once", name="Allow once"), | ||
|
|
@@ -58,7 +67,10 @@ def _callback(command: str, description: str) -> str: | |
|
|
||
| try: | ||
| future = asyncio.run_coroutine_threadsafe(coro, loop) | ||
| response = future.result(timeout=timeout) | ||
| if timeout is not None and timeout <= 0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An indefinite wait for |
||
| response = future.result() | ||
| else: | ||
| response = future.result(timeout=timeout) | ||
| except (FutureTimeout, Exception) as exc: | ||
| logger.warning("Permission request timed out or failed: %s", exc) | ||
| return "deny" | ||
|
|
||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extend the configured timeout to the ACP edit approval requester as well. Current main constructs that independent bridge in
acp_adapter/server.py:1425; it still defaults to 60 seconds inacp_adapter/edit_approval.py:290, so edits would retain the reported bug.