-
Notifications
You must be signed in to change notification settings - Fork 0
feat: AUTO_CODE_AUTONOMY single knob + Phase 1 capability grants #267
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0533639
feat: introduce per-provider autonomy policy
f212aa1
Merge remote-tracking branch 'origin/develop' into feat/autonomy-per-…
3fb3d98
feat: route direct API autonomous gate through AutonomyPolicy
c6e4bc4
feat: route qa_reviewer and qa_fixer through the runtime layer
affe5b0
feat: split runtime capability from policy promotion
e099b7b
feat: move runtime artifacts to .auto-claude/runtime with legacy fall…
f1859b1
docs: ADR-006 propose user-facing autonomy levels
bbf4dba
feat: implement ADR-006 user-facing autonomy level
360eac1
feat: per-provider native tool capability for Ollama and ZhipuAI
c75d37b
feat: declared native tool capability for OpenAI/OpenRouter/LiteLLM/G…
1a2cc5c
feat: MCP execution capability grant + per-server execution smoke
9bcef83
feat: mutating subagents capability/policy wiring (Phase 1.2)
6d68f21
feat: cross-platform sandbox skeleton + capability/policy wiring (Pha…
1f4c689
Merge remote-tracking branch 'origin/develop' into feat/autonomy-per-…
a259b24
style: fix ruff findings on PR-touched files
e278d0d
style: apply ruff format on PR-touched files
af72c83
fix: address PR #267 review (CodeRabbit + CodeQL)
OBenner 49de67d
fix: restore GoogleProvider class structure (_google_model_identifier…
OBenner 0e534f8
fix: GoogleAgentSession.provider_supports_native_tools defaults to Tr…
OBenner 3891406
style: ruff format for google.py (line wrap)
OBenner 1740fca
feat: wire mcp_execution_smoke into provider e2e suite + sandbox refa…
OBenner 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
49 changes: 46 additions & 3 deletions
49
apps/backend/agents/runtime/adapters/direct_api_autonomous.py
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 |
|---|---|---|
| @@ -1,11 +1,54 @@ | ||
| """Direct API autonomous runtime adapter.""" | ||
| """Direct API autonomous runtime adapter. | ||
|
|
||
| from ..capabilities import RuntimeCapabilities | ||
| This adapter wraps the Generic Edit engine and advertises its honest | ||
| capability set (:meth:`RuntimeCapabilities.promoted_edit`) plus a | ||
| :class:`RuntimePolicy` that flips ``promoted_to_full_autonomous`` to | ||
| ``True``. The factory selects this adapter only when the | ||
| :func:`resolve_direct_api_autonomous_gate` evidence gate passes for the | ||
| caller's provider, so the promotion is always backed by recorded e2e and | ||
| reliability evidence rather than by a hardcoded capability claim. | ||
|
|
||
| Phase 1.1: when ``AUTO_CODE_AUTONOMY=safe`` (or ``bold``), or when the | ||
| operator opts in via ``AUTO_CODE_EXTERNAL_MCP_CLIENT=true``, the runtime | ||
| also flips ``mcp_execution_enabled`` so direct providers honestly | ||
| declare an ``mcp`` capability. The flag is computed from | ||
| :func:`resolve_autonomy_settings` rather than hardcoded so explicit | ||
| low-level env overrides keep winning. | ||
| """ | ||
|
|
||
| from collections.abc import Mapping | ||
|
|
||
| from core.autonomy_level import resolve_autonomy_settings | ||
|
|
||
| from ..capabilities import RuntimeCapabilities, RuntimePolicy | ||
| from .generic_edit import GenericEditRuntimeSession | ||
|
|
||
|
|
||
| def _build_runtime_policy( | ||
| env: Mapping[str, str] | None = None, | ||
| ) -> RuntimePolicy: | ||
| """Build the runtime policy for a promoted direct-API session.""" | ||
| settings = resolve_autonomy_settings(env=env) | ||
| return RuntimePolicy( | ||
| promoted_to_full_autonomous=True, | ||
| mcp_execution_enabled=settings.external_mcp_client_enabled, | ||
| mutating_subagents_enabled=settings.mutating_subagents_enabled, | ||
| sandbox_enabled=settings.sandbox_enabled, | ||
| ) | ||
|
|
||
|
|
||
| class DirectApiAutonomousRuntimeSession(GenericEditRuntimeSession): | ||
| """Promoted direct-provider runtime backed by the Generic Edit engine.""" | ||
|
|
||
| name = "direct_api_autonomous" | ||
| capabilities = RuntimeCapabilities.direct_api_autonomous() | ||
| capabilities = RuntimeCapabilities.promoted_edit() | ||
|
|
||
| @property | ||
| def runtime_policy(self) -> RuntimePolicy: # type: ignore[override] | ||
| """Resolve the runtime policy lazily so env changes take effect. | ||
|
|
||
| Built per-call rather than at class instantiation time so tests | ||
| and operators that flip ``AUTO_CODE_AUTONOMY`` between sessions | ||
| see the updated grant without needing to reinstantiate. | ||
| """ | ||
| return _build_runtime_policy() |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.