Skip to content

feat(agent): autonomy-levels framework (#773) - #840

Merged
JSONbored merged 1 commit into
mainfrom
feat/agent-autonomy-levels
Jun 17, 2026
Merged

feat(agent): autonomy-levels framework (#773)#840
JSONbored merged 1 commit into
mainfrom
feat/agent-autonomy-levels

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Closes #773. The first Wave 2 / agent-layer (Phase 0) piece — the deny-by-default dial everything else reads before acting.

What

  • AutonomyLevel (observe → suggest → propose → auto_with_approval → auto) + AgentActionClass (review/request_changes/approve/merge/close/label) + AutonomyPolicy (per-action-class map).
  • src/settings/autonomy.tsresolveAutonomy(autonomy, actionClass): the single gate the action layer (feat(agent): maintainer write-actions layer (request-changes/approve/merge/close/label) #778) consults before any write action. Returns observe for any unset or malformed class (deny-by-default). Plus isActingAutonomyLevel, autonomyRequiresApproval, normalizeAutonomyPolicy. Pure + 100% covered.
  • Persisted on repository_settings as a JSON map (migration 0042, default '{}'), mirroring commandAuthorization; parsed + resolved through the existing yml > DB > defaults resolver. Settable from .gittensory.yml via the settings: block (a malformed block never blanks the DB-configured policy). Surfaced in the GET /settings OpenAPI shape.

Scope boundary

This establishes the dial + the gate + persistence. The richer autoMaintain config block (merge/close policy, requireApprovals) + dashboard write are #774; the action layer that consults resolveAutonomy is #778. Nothing here takes any action — it's pure config + a resolver.

Verification

typecheck clean · migration guard (0001..0042, no dup) · full suite 2009 passed, 1 skipped (pre-existing pngjs visual-agent skip) · OpenAPI regenerated + drift-clean · UI lint clean · the new module is 100% covered and every changed wiring line is covered.

# .gittensory.yml
settings:
  autonomy:
    merge: auto_with_approval
    label: auto

Note: migration 0042 is shared with the open #833 (reviewer-routing) — whichever merges second rebases + renumbers.

Relates #768 (Phase 0), #774 (autoMaintain config builds on this), #778 (write-actions consume resolveAutonomy).

The first Wave-2 / Phase-0 piece: a graduated autonomy dial the whole
agent layer reads before acting. Deny-by-default.

- AutonomyLevel (observe -> suggest -> propose -> auto_with_approval ->
  auto) + AgentActionClass (review/request_changes/approve/merge/close/
  label) + AutonomyPolicy (per-action-class map) types.
- src/settings/autonomy.ts: resolveAutonomy(autonomy, actionClass) — THE
  single gate the action layer (#778) consults; returns 'observe' for any
  unset/malformed class (deny-by-default). Plus isActingAutonomyLevel,
  autonomyRequiresApproval, normalizeAutonomyPolicy. Pure + 100% covered.
- Persisted on repository_settings as a JSON map (migration 0042,
  default '{}' = deny-by-default), mirroring commandAuthorization; parsed
  + resolved through the existing yml > DB > defaults resolver. Resolvable
  from .gittensory.yml via the settings: block (a malformed block never
  blanks the DB-configured policy). Surfaced in the GET /settings OpenAPI
  shape.

The richer autoMaintain config block (merge/close policy, requireApprovals)
+ dashboard write are #774; the action layer that consults resolveAutonomy
is #778.

NOTE: migration 0042 is also used by the open #833 (reviewer-routing) —
whichever merges second rebases + renumbers.
@dosubot dosubot Bot added the size:M label Jun 17, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 17, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui ca6691e Commit Preview URL

Branch Preview URL
Jun 17 2026, 09:15 PM

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #840 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 17, 2026
@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

gittensory · advisory review

Reviewed 11 changed file(s) — two independent AI reviewers.

Changed files (11)
  • apps/gittensory-ui/public/openapi.json
  • migrations/0042_agent_autonomy.sql
  • src/db/repositories.ts
  • src/db/schema.ts
  • src/openapi/schemas.ts
  • src/settings/autonomy.ts
  • src/signals/focus-manifest.ts
  • src/types.ts
  • test/unit/autonomy.test.ts
  • test/unit/data-spine.test.ts
  • test/unit/focus-manifest.test.ts

Suggested action:Safe to merge — both reviewers found no blocking issues.

Reviewer A · gpt-oss-120b — recommends ✅ merge
The PR introduces a graduated autonomy framework for agent actions, adding schema, DB column, normalization utilities, and comprehensive tests. The changes are well‑scoped, type‑safe, and do not introduce forbidden public terms or security concerns.

Suggestions

  • Update any API documentation to mention the new autonomy field.
  • Verify that the new migration runs in CI and production environments.
  • Consider adding a brief comment in the OpenAPI JSON about the purpose of the autonomy property for future maintainers.

Worth double-checking

  • Ensure the migration is applied before any code that expects the autonomy_json column.
  • Confirm that exposing the autonomy policy via public API does not unintentionally reveal internal configuration details.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR adds an agent autonomy framework with per-action-class levels (observe/suggest/propose/auto_with_approval/auto) and deny-by-default behavior. It includes DB migration, type definitions, API schema updates, normalization logic, and comprehensive unit tests. The implementation correctly enforces deny-by-default via empty policy fallback and validates inputs. No public/private boundary violations are evident as the autonomy settings contain only non-sensitive action/level strings.

Suggestions

  • Consider adding a comment in normalizeAutonomyPolicy clarifying that dropping invalid entries is intentional (deny-by-omission).
  • In focus-manifest.ts, the comment could explicitly note that Object.keys(autonomy).length > 0 prevents overriding DB policy with empty manifests.

Worth double-checking

  • Verify that the autonomy field in RepositorySettings is never returned in public API responses that might expose configuration details (though content is non-sensitive).
  • Ensure the migration's NOT NULL DEFAULT '{}' works correctly with existing rows (no risk detected as it's additive).

Before = production · After = this PR's preview deploy.

Route Viewport Before After
/ desktop before desktop after desktop
mobile before mobile after mobile

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.58%. Comparing base (b2162f7) to head (ca6691e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #840   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files          98       99    +1     
  Lines       14196    14215   +19     
  Branches     5172     5178    +6     
=======================================
+ Hits        13711    13730   +19     
  Misses        105      105           
  Partials      380      380           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 13c042b into main Jun 17, 2026
22 checks passed
@JSONbored
JSONbored deleted the feat/agent-autonomy-levels branch June 17, 2026 21:15
@github-actions github-actions Bot mentioned this pull request Jun 18, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agent): autonomy-levels framework (observe→…→auto)

1 participant