From 3ce5d5289cec53967a792d8faa6592f54cb48140 Mon Sep 17 00:00:00 2001 From: forthfate Date: Mon, 9 Nov 2026 12:18:09 +0900 Subject: [PATCH 1/2] chore: prepare v0.13.0 release --- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ frontend/package.json | 2 +- package.json | 2 +- pyproject.toml | 2 +- uv.lock | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c91117d..07073ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,35 @@ All notable changes to OpenOrbit are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project uses [Semantic Versioning](https://semver.org/). +## [0.13.0] - 2026-11-09 + +### Added + +- Added public Persona-to-tool-AI conversations to Run detail, including + Persona sessions, iteration-aware timestamps, sanitized tool summaries, and + linked screenshot or HTML evidence. +- Split Persona speech from action planning so a persistent Persona can express + its user perspective while a separate bounded role selects from rendered safe + actions. +- Added an optional allow-listed auto-commit policy for isolated AI proposal + branches. It never pushes, merges, deploys, or writes to the evaluated + repository. +- Added AI usage and rate-limit monitoring by model profile. +- Added retained Orbit Assistant chat history and a reusable browser-network + settlement helper for browser journeys. + +### Changed + +- Repositioned the README around persistent Persona intent, bounded action + agents, public evidence, and reviewable improvements. + +### Fixed + +- Localized Conversation timestamps, kept Run-history updates responsive, and + prevented duplicate Persona conversation sessions. +- Improved MCP fallback behavior, bounded MCP pipeline responses, and made the + Orbit Assistant more resilient to transient initialization failures. + ## [0.12.9] - 2026-09-26 ### Fixed diff --git a/frontend/package.json b/frontend/package.json index 8a34fae..61cdae7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "agent-improvement-console-ui", "private": true, - "version": "0.12.9", + "version": "0.13.0", "type": "module", "scripts": { "dev": "vite", diff --git a/package.json b/package.json index 2b2818f..5926e82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openorbit", - "version": "0.12.9", + "version": "0.13.0", "description": "Open control plane for recurring AI automations", "license": "MIT", "type": "module", diff --git a/pyproject.toml b/pyproject.toml index aea8350..4a3b597 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "openorbit" -version = "0.12.9" +version = "0.13.0" description = "Open control plane for recurring AI automations" readme = "README.md" license = "MIT" diff --git a/uv.lock b/uv.lock index 7b13d0c..42df54e 100644 --- a/uv.lock +++ b/uv.lock @@ -950,7 +950,7 @@ wheels = [ [[package]] name = "openorbit" -version = "0.12.9" +version = "0.13.0" source = { editable = "." } dependencies = [ { name = "fastapi" }, From 9d3b1afcda79493a981fb8cbc6bb3fd1a2470b76 Mon Sep 17 00:00:00 2001 From: forthfate Date: Mon, 9 Nov 2026 14:49:27 +0900 Subject: [PATCH 2/2] feat: automate managed asset issue improvements --- backend/app/main.py | 19 +- backend/app/store.py | 334 +++++++++++++++++++- frontend/src/domain/models.ts | 2 +- frontend/src/features/builds/page.tsx | 6 +- frontend/src/features/improvements/page.tsx | 17 +- frontend/src/features/issues/page.tsx | 98 ++++-- frontend/src/locales/languages/en.json | 20 +- frontend/src/locales/languages/ja.json | 20 +- frontend/src/locales/languages/ko.json | 20 +- frontend/src/theme-overrides.css | 3 +- 10 files changed, 496 insertions(+), 43 deletions(-) diff --git a/backend/app/main.py b/backend/app/main.py index 8612615..f5c78c2 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -573,7 +573,9 @@ class BuildCreate(BaseModel): candidates_per_iteration: int = Field(default=2, ge=2, le=8) approval_score: int = Field(ge=0, le=10) require_human_approval_before_apply: bool = False - agent_apply_policy: Literal["review_required", "auto_commit_branch"] = "review_required" + agent_apply_policy: Literal["review_required", "auto_commit_branch", "auto_apply_managed_assets"] = ( + "review_required" + ) agent_auto_commit_allowed_paths: list[str] = Field(default_factory=list, max_length=32) executor_type: str = Field( default="local", pattern=r"^(local|remote-http)$" @@ -614,6 +616,12 @@ class AgentIssueDecision(BaseModel): decision: Literal["approve", "reject"] +class AgentProposalCreate(BaseModel): + """Create isolated coding-agent proposals for selected Issue rows.""" + + proposal_ids: list[str] = Field(min_length=1, max_length=20) + + class RunnerAssetUpdate(BaseModel): name: str = Field(min_length=1, max_length=120) description: str = Field(min_length=1, max_length=500) @@ -1663,6 +1671,15 @@ def list_issue_management_items_v1(): return store.issue_management_items() +@app.post( + "/api/v1/issue-management/agent-proposals", + tags=["Improvements"], + operation_id="createIssueManagementAgentProposals", +) +def create_issue_management_agent_proposals_v1(values: AgentProposalCreate): + return safely(lambda: store.create_issue_management_agent_proposals(values.proposal_ids)) + + @app.get( "/api/v1/issue-management/{proposal_id}/diff", tags=["Improvements"], diff --git a/backend/app/store.py b/backend/app/store.py index fb8654c..311d9f6 100644 --- a/backend/app/store.py +++ b/backend/app/store.py @@ -1,6 +1,7 @@ from __future__ import annotations import base64 +import fnmatch import hashlib import io import json @@ -26,6 +27,7 @@ import requests import yaml from opentelemetry.trace import Status, StatusCode +from orbit_sdk import RunnerContext from orbit_sdk.visual import definition_for_runner_template from orbit import load_bundle @@ -203,6 +205,7 @@ def __init__(self, *, recover_interrupted_runs: bool = False) -> None: self._test_sessions: dict[str, Run] = {} self._runner_graph_drafts: dict[str, tuple[str, float]] = {} self._lock = threading.Lock() + self._issue_management_lock = threading.Lock() if recover_interrupted_runs: self._recover_interrupted_runs() self.tracer = configure_telemetry(TELEMETRY) @@ -2742,6 +2745,245 @@ def _save_issue_management_records(self, values: dict[str, dict[str, Any]]) -> N ) temporary.replace(ISSUE_MANAGEMENT) + @staticmethod + def _manual_agent_task(item: dict[str, Any], build: dict[str, Any]) -> str: + """Build a bounded coding-agent task from retained Issue evidence.""" + issue = item.get("proposal") if isinstance(item.get("proposal"), dict) else {} + evidence = { + "id": item.get("proposal_id"), + "title": item.get("title"), + "category": item.get("category"), + "rationale": item.get("decision_rationale"), + "proposal": issue, + } + return "\n".join( + ( + "You are the autonomous improvement agent for OpenOrbit managed assets.", + "Work only on the single Issue below. Inspect the repository and make one atomic, evidence-backed fix.", + "You are in an isolated proposal worktree for the OpenOrbit AppData assets. Change only runner, prompt, template, or non-secret configuration assets. Do not modify data, artifacts, browser profiles, credentials, or the evaluated product repository. Do not commit, push, reset, or modify files outside this worktree.", + f"Build purpose: {str(build.get('purpose') or '')}", + f"Managed prompt path: {str(build.get('managed_prompt_path') or build.get('prompt_bundle') or '')}", + f"Issue evidence: {json.dumps(evidence, ensure_ascii=False)}", + "Validate the change proportionately. If you made a meaningful change, finish with exactly one line: ORBIT_AGENT_FEEDBACK: .", + ) + ) + + def _improvement_repository(self) -> Path: + """Return the AppData Git repository used for managed-asset proposals.""" + repository = APP_DATA.resolve() + git_directory = repository / ".git" + if git_directory.exists(): + return repository + ignore = repository / ".gitignore" + if not ignore.exists(): + ignore.write_text( + "data/\nartifacts/\nrunner-assets/\nrunner-state/\nagent-worktrees/\n" + "config/persona-login.json\nconfig/issue-management.yaml\n__pycache__/\n*.pyc\n", + encoding="utf-8", + ) + subprocess.run( + ["git", "init", "-b", "main", str(repository)], + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + subprocess.run( + ["git", "add", "--all"], + cwd=repository, + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + has_head = subprocess.run( + ["git", "rev-parse", "--verify", "HEAD"], + cwd=repository, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + if has_head.returncode != 0: + subprocess.run( + [ + "git", + "-c", + "user.name=OpenOrbit", + "-c", + "user.email=openorbit@local", + "commit", + "-m", + "orbit: initialize managed assets", + ], + cwd=repository, + check=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + return repository + + def create_issue_management_agent_proposals(self, proposal_ids: list[str]) -> dict[str, Any]: + """Queue one review-required worktree proposal for each selected Issue.""" + identifiers = list(dict.fromkeys(str(value).strip() for value in proposal_ids if str(value).strip())) + if not identifiers: + raise ValueError("at least one issue-management item is required") + items = {str(item["proposal_id"]): item for item in self.issue_management_items()} + missing = [proposal_id for proposal_id in identifiers if proposal_id not in items] + if missing: + raise KeyError(missing[0]) + provider = str(self.application_settings().get("coding_agent_provider") or "none") + if provider == "none": + raise ValueError( + "configure a Coding Agent in Application settings before requesting an AI improvement" + ) + queued: list[str] = [] + with self._issue_management_lock: + records = self._issue_management_records() + for proposal_id in identifiers: + item = items[proposal_id] + if not str(item.get("run_id") or "").strip(): + raise ValueError(f"Issue {proposal_id} has no source run") + self._improvement_repository() + record = records.setdefault( + proposal_id, {"status": "unreviewed", "comments": [], "events": []} + ) + job = record.get("agent_job") if isinstance(record.get("agent_job"), dict) else {} + if str(job.get("status") or "") in {"queued", "running"}: + continue + if record.get("proposal_action") == "pending" and isinstance( + record.get("agent_change"), dict + ): + raise ValueError(f"Issue {proposal_id} already has a proposal awaiting review") + record.pop("agent_change", None) + record.pop("proposal_commit", None) + record["proposal_action"] = "pending" + record["agent_job"] = { + "status": "queued", + "provider": provider, + "recorded_at": now().isoformat(), + } + record.setdefault("events", []).append( + {"type": "agent_proposal_queued", "recorded_at": now().isoformat()} + ) + queued.append(proposal_id) + self._save_issue_management_records(records) + for proposal_id in queued: + threading.Thread( + target=self._generate_issue_management_agent_proposal, + args=(proposal_id, provider), + daemon=True, + ).start() + return {"queued": queued, "skipped": [value for value in identifiers if value not in queued]} + + def _generate_issue_management_agent_proposal(self, proposal_id: str, provider: str) -> None: + """Generate a proposal off-request-thread and retain its review patch.""" + try: + item = next( + value for value in self.issue_management_items() if value["proposal_id"] == proposal_id + ) + build = self.build(str(item["build_id"])) + repository = self._improvement_repository() + resources = { + "build": {**build, "agent_apply_policy": "review_required"}, + "test_cases": build.get("test_cases", []), + } + environment = dict(os.environ) + environment["ORBIT_RUN_ID"] = f"issue-{hashlib.sha256(proposal_id.encode()).hexdigest()[:16]}" + environment["ORBIT_RUNNER_RESOURCES"] = base64.b64encode( + json.dumps(resources, ensure_ascii=False).encode("utf-8") + ).decode("ascii") + with self._issue_management_lock: + records = self._issue_management_records() + record = records.setdefault( + proposal_id, {"status": "unreviewed", "comments": [], "events": []} + ) + record["agent_job"] = { + "status": "running", + "provider": provider, + "recorded_at": now().isoformat(), + } + record.setdefault("events", []).append( + {"type": "agent_proposal_started", "recorded_at": now().isoformat()} + ) + self._save_issue_management_records(records) + + context = RunnerContext( + phase="after_each", + target_repository=repository, + mode="run", + loop_index=1, + environment=environment, + ) + agent = context.run_ai_agent(self._manual_agent_task(item, build), provider=provider) + proposal = agent.get("proposal") if isinstance(agent.get("proposal"), dict) else {} + feedback = str(agent.get("feedback") or "").strip() + changed_files = agent.get("changed_files") if isinstance(agent.get("changed_files"), list) else [] + if not feedback or not changed_files or not str(proposal.get("diff") or ""): + raise ValueError("coding agent completed without a reviewable change") + agent_change = { + "feedback": feedback, + "changed_files": [str(path) for path in changed_files], + "diff": str(proposal.get("diff") or ""), + "diff_artifact": proposal.get("diff_artifact"), + "base_revision": str(proposal.get("base_revision") or ""), + "branch": str(proposal.get("branch") or ""), + "worktree_path": str(proposal.get("worktree_path") or ""), + "source_repository": str(repository), + "fingerprint": str(proposal.get("fingerprint") or ""), + } + with self._issue_management_lock: + records = self._issue_management_records() + record = records.setdefault( + proposal_id, {"status": "unreviewed", "comments": [], "events": []} + ) + record["agent_change"] = agent_change + record["agent_job"] = { + "status": "ready", + "provider": provider, + "recorded_at": now().isoformat(), + } + record.setdefault("events", []).append( + {"type": "agent_proposal_ready", "recorded_at": now().isoformat()} + ) + self._save_issue_management_records(records) + if build.get("agent_apply_policy") == "auto_apply_managed_assets": + allowed = [ + str(path) + for path in build.get("agent_auto_commit_allowed_paths", []) + if str(path).strip() + ] + if not allowed or any( + not any(fnmatch.fnmatch(str(path), pattern) for pattern in allowed) + for path in changed_files + ): + raise ValueError( + "automatic approval requires every changed managed asset to match an allowed path" + ) + self.decide_agent_issue(proposal_id, "approve") + except Exception as error: + with self._issue_management_lock: + records = self._issue_management_records() + record = records.setdefault( + proposal_id, {"status": "unreviewed", "comments": [], "events": []} + ) + record["agent_job"] = { + "status": "failed", + "error": str(error)[:1_000], + "recorded_at": now().isoformat(), + } + record.setdefault("events", []).append( + { + "type": "agent_proposal_failed", + "recorded_at": now().isoformat(), + "error": str(error)[:1_000], + } + ) + self._save_issue_management_records(records) + + def _auto_queue_issue_improvements(self, proposal_ids: list[str]) -> None: + """Best-effort automatic proposal creation; failures remain visible per Issue.""" + try: + self.create_issue_management_agent_proposals(proposal_ids) + except Exception: + return + def issue_management_items(self) -> list[dict[str, Any]]: records = self._issue_management_records() proposals = self.proposal_lifecycles() @@ -2777,7 +3019,10 @@ def issue_management_items(self) -> list[dict[str, Any]]: # management-level tombstone, not deletion of the underlying run. if record.get("status") == "deleted": continue - agent_change = (proposal.get("proposal") or {}).get("agent_change") or {} + proposal_value = deepcopy(proposal.get("proposal") or {}) + if isinstance(record.get("agent_change"), dict): + proposal_value["agent_change"] = record["agent_change"] + agent_change = proposal_value.get("agent_change") or {} review = agent_change.get("review") if isinstance(agent_change, dict) else None review_comment = [] if isinstance(review, dict) and str(review.get("summary") or "").strip(): @@ -2793,12 +3038,14 @@ def issue_management_items(self) -> list[dict[str, Any]]: values.append( { **proposal, + "proposal": proposal_value, "management_status": record.get("status", "unreviewed"), "proposal_action": record.get("proposal_action", "pending"), - "proposal_branch": str( - ((proposal.get("proposal") or {}).get("agent_change") or {}).get("branch") or "" - ), + "proposal_branch": str(agent_change.get("branch") or ""), "proposal_commit": str(record.get("proposal_commit") or ""), + "agent_job": record.get("agent_job") + if isinstance(record.get("agent_job"), dict) + else None, "assigner": record.get("assigner", ""), "comments": [*review_comment, *record.get("comments", [])], "management_events": [*review_comment, *record.get("events", [])], @@ -2907,7 +3154,9 @@ def decide_agent_issue(self, proposal_id: str, decision: str) -> dict[str, Any]: worktree_root = (APP_DATA / "agent-worktrees").resolve() if worktree_root not in worktree.parents: raise ValueError("agent proposal worktree is outside Orbit storage") - source_repository = Path(self._load(str(item.get("run_id") or "")).repository).resolve() + source_repository = Path(str(agent_change.get("source_repository") or APP_DATA)).resolve() + if source_repository != APP_DATA.resolve(): + raise ValueError("agent proposal source repository must be OpenOrbit AppData") if not source_repository.is_dir(): raise ValueError("agent proposal source repository is no longer available") records = self._issue_management_records() @@ -2921,6 +3170,33 @@ def decide_agent_issue(self, proposal_id: str, decision: str) -> dict[str, Any]: if decision == "approve": if not worktree.is_dir(): raise ValueError("agent proposal worktree is no longer available") + base_revision = str(agent_change.get("base_revision") or "").strip() + if not base_revision: + raise ValueError("agent proposal has no base revision") + source_status = subprocess.run( + ["git", "status", "--porcelain"], + cwd=source_repository, + check=True, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ).stdout.strip() + if source_status: + raise ValueError( + "source repository has uncommitted changes; review and apply the proposal after it is clean" + ) + source_head = subprocess.run( + ["git", "rev-parse", "HEAD"], + cwd=source_repository, + check=True, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ).stdout.strip() + if source_head != base_revision: + raise ValueError( + "source repository changed since this proposal was generated; create a fresh proposal" + ) changed = subprocess.run( ["git", "diff", "--quiet", "--"], cwd=worktree, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) @@ -2948,9 +3224,36 @@ def decide_agent_issue(self, proposal_id: str, decision: str) -> dict[str, Any]: commit = subprocess.run( ["git", "rev-parse", "HEAD"], cwd=worktree, check=True, text=True, stdout=subprocess.PIPE ).stdout.strip() + try: + subprocess.run( + ["git", "merge", "--ff-only", branch], + cwd=source_repository, + check=True, + text=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + except subprocess.CalledProcessError as error: + raise ValueError( + error.stderr.strip() or "could not apply proposal to the source branch" + ) from error + subprocess.run( + ["git", "worktree", "remove", "--force", str(worktree)], + cwd=source_repository, + check=False, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + subprocess.run( + ["git", "branch", "-D", branch], + cwd=source_repository, + check=False, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) record.update({"proposal_action": "approved", "proposal_commit": commit, "status": "resolved"}) record["events"].append( - {"type": "proposal_approved", "branch": branch, "commit": commit, "recorded_at": timestamp} + {"type": "proposal_applied", "branch": branch, "commit": commit, "recorded_at": timestamp} ) else: subprocess.run( @@ -4813,6 +5116,25 @@ def supervisor_result(result: object) -> object: } ) self._save(run) + build = self.build(run.build_id) if run.build_id else {} + if ( + stage == "issue_assessment" + and build.get("agent_apply_policy") == "auto_apply_managed_assets" + ): + record_index = len(run.supervisor_results) - 1 + issue_ids = [ + f"{run.id}:{iteration}:{record_index}:{index}" + for index, proposal in enumerate( + [*result["improvements"], *result["reported_issues"]] + ) + if not str(proposal.get("known_issue_id") or "").strip() + and str((proposal.get("evaluation") or {}).get("approval") or "pending").lower() + != "rejected" + ] + if issue_ids: + threading.Thread( + target=self._auto_queue_issue_improvements, args=(issue_ids,), daemon=True + ).start() self._review_cycle_improvement(run, iteration, result, settings, provider) span.set_attribute("orbit.supervisor.improvements", len(result["improvements"])) span.set_attribute("orbit.supervisor.reported_issues", len(result["reported_issues"])) diff --git a/frontend/src/domain/models.ts b/frontend/src/domain/models.ts index 6e3b103..dfc6d9a 100644 --- a/frontend/src/domain/models.ts +++ b/frontend/src/domain/models.ts @@ -24,7 +24,7 @@ export type Improvement = { id:string; title:string; baseline_score:number; curr export type CycleIntervention = { id:string;build_id?:string;build_name?:string;run_id?:string;iteration?:number;diagnosis?:string;target:string;title:string;rationale:string;proposed_change:string;risk:'low'|'medium'|'high';validation:string;rollback:string;status:string;created_at:string } export type ProposalEvent = {id:string;event_type?:'decision';proposal_id:string;decision?:'pending'|'acceptable'|'accepted'|'rejected';rationale?:string;recorded_at:string;iteration?:number;phase?:string;run_id?:string} export type ProposalLifecycle = {proposal_id:string;title:string;target:string;category:'accuracy_grounding'|'safety_privacy'|'task_completion'|'user_experience'|'other';proposal:Record;decision:'pending'|'acceptable'|'accepted'|'rejected';decision_rationale:string;status:'proposed'|'acceptable'|'accepted'|'rejected';score?:number|null;issue_evaluation?:SupervisorEvaluation|null;build_id?:string;build_name?:string;run_id?:string;iteration?:number;personas?:string[];recorded_at?:string;data_files?:SavedDataFile[];events:ProposalEvent[]} -export type IssueManagementItem = ProposalLifecycle & {personas?:string[];management_status:'unreviewed'|'reviewing'|'in_progress'|'resolved'|'deferred';proposal_action?:'pending'|'approved'|'rejected';proposal_branch?:string;proposal_commit?:string;assigner?:string;comments:{body:string;recorded_at:string;assigner?:string;verification_run_id?:string}[];management_events:{type:string;status?:string;body?:string;assigner?:string;recorded_at:string;verification_run_id?:string}[]} +export type IssueManagementItem = ProposalLifecycle & {personas?:string[];management_status:'unreviewed'|'reviewing'|'in_progress'|'resolved'|'deferred';proposal_action?:'pending'|'approved'|'rejected';proposal_branch?:string;proposal_commit?:string;agent_job?:{status:'queued'|'running'|'ready'|'failed';provider?:string;error?:string;recorded_at?:string}|null;assigner?:string;comments:{body:string;recorded_at:string;assigner?:string;verification_run_id?:string}[];management_events:{type:string;status?:string;body?:string;assigner?:string;recorded_at:string;verification_run_id?:string}[]} export type ImprovementAnalytics = { window_hours:number; operational_summary:{feedback:number;acceptable:number;issues:number;average_score:number|null;score_delta:number|null}; feedback_by_build:{build_id:string;name:string;feedback_count:number}[]; iteration_trends:{build_id:string;name:string;points:{run_id:string;iteration:number;recorded_at:string;acceptable_count:number;feedback_count:number;score:number|null}[]}[]; active_evaluations:{time:string;count:number}[]; feedback_status:{build_id:string;name:string;proposed:number;acceptable:number;rejected:number}[]; issue_severity:{time:string;low:number;medium:number;high:number;critical:number}[]; run_health:{build_id:string;name:string;succeeded:number;failed:number;cancelled:number;running:number}[] } export type OrbitLog = { time:string; name:string; status:string; message:string } export type Settings = { profile_name:string; provider:string; model:string; endpoint:string; region:string; secret_env:string; aws_profile?:string;created_at?:string } diff --git a/frontend/src/features/builds/page.tsx b/frontend/src/features/builds/page.tsx index 7514196..e107b09 100644 --- a/frontend/src/features/builds/page.tsx +++ b/frontend/src/features/builds/page.tsx @@ -65,7 +65,7 @@ type Draft = { candidates_per_iteration: number; approval_score: number; require_human_approval_before_apply: boolean; - agent_apply_policy: "review_required" | "auto_commit_branch"; + agent_apply_policy: "review_required" | "auto_commit_branch" | "auto_apply_managed_assets"; agent_auto_commit_allowed_paths: string[]; enabled: boolean; }; @@ -116,6 +116,7 @@ type BuildWizardCopy = { agentApplyPolicy: LabelCopy; agentApplyReview: string; agentApplyCommit: string; + agentApplyAuto: string; agentAllowedPaths: LabelCopy; name: string; next: string; @@ -612,9 +613,10 @@ function Direct({ - {d.agent_apply_policy === "auto_commit_branch" && + {(d.agent_apply_policy === "auto_commit_branch" || d.agent_apply_policy === "auto_apply_managed_assets") && setD({ ...d, agent_auto_commit_allowed_paths: e.target.value.split(",").map((value) => value.trim()).filter(Boolean) })} /> } diff --git a/frontend/src/features/improvements/page.tsx b/frontend/src/features/improvements/page.tsx index c69b074..b2f6e78 100644 --- a/frontend/src/features/improvements/page.tsx +++ b/frontend/src/features/improvements/page.tsx @@ -103,6 +103,7 @@ type ImprovementCopy = { personaJourneys: string; personaJourneysHint: string; noPersonaJourneys: string; + noPersonaEvidence: string; personaGoal: string; currentAction: string; currentDecision: string; @@ -346,7 +347,21 @@ function PersonaJourneyTimeline({ )} :

{t.noPersonaJourneys}

} - {selectedEvent && setSelectedEvent(null)} title={`${selectedEvent.persona} · ${t.iteration} #${selectedEvent.iteration}`} runId={selectedEvent.run.id} iteration={selectedEvent.iteration} artifacts={selectedArtifacts} />} + {selectedEvent && (selectedArtifacts.length ? ( + setSelectedEvent(null)} title={`${selectedEvent.persona} · ${t.iteration} #${selectedEvent.iteration}`} runId={selectedEvent.run.id} iteration={selectedEvent.iteration} artifacts={selectedArtifacts} /> + ) : ( + setSelectedEvent(null)}> +
+

{t.noPersonaEvidence}

+
+ {selectedEvent.goal &&
{t.personaGoal}
{selectedEvent.goal}
} + {selectedEvent.action &&
{t.currentAction}
{selectedEvent.action}
} + {selectedEvent.decision &&
{t.currentDecision}
{selectedEvent.decision}
} + {selectedEvent.nextAction &&
{t.nextAction}
{selectedEvent.nextAction}
} +
+
+
+ ))} ; } function Card({ diff --git a/frontend/src/features/issues/page.tsx b/frontend/src/features/issues/page.tsx index 54f7cd7..c2ea8e4 100644 --- a/frontend/src/features/issues/page.tsx +++ b/frontend/src/features/issues/page.tsx @@ -9,7 +9,7 @@ import { SectionInfo } from "../../components/ui/section-info"; import { EvidenceViewer, visualEvidenceArtifacts } from "../../components/ui/evidence-viewer"; import { PanelHeader } from "../../components/ui/page-header"; import { intlLocales, localeMessages, locales, type Locale } from "../../locales"; -import { ListFilter, Trash2 } from "lucide-react"; +import { ListFilter, Sparkles, Trash2 } from "lucide-react"; import { RunDetailTabs } from "../evaluations/run-detail-tabs"; import { UnifiedDiff } from "../evaluations/run-detail-change-panels"; import { ConfirmDialog } from "../../components/ui/confirm-dialog"; @@ -79,6 +79,18 @@ type Copy = { rejectAndRemove: string; agentProposalCommitted: string; agentProposalRemoved: string; + autoImprove: string; + autoImproveTitle: string; + autoImproveDescription: string; + autoImproveQueued: string; + agentJobQueued: string; + agentJobRunning: string; + agentJobFailed: string; + agentJobReady: string; + agentJobQueuedShort: string; + agentJobRunningShort: string; + agentJobFailedShort: string; + agentJobReadyShort: string; }; const statuses = [ "unreviewed", @@ -115,13 +127,14 @@ export function IssueManagementSection({ [filtersOpen, setFiltersOpen] = useState(false), [selected, setSelected] = useState(null), [agentDiff, setAgentDiff] = useState<{ proposalId: string; value: string } | null>(null), - [modalTab, setModalTab] = useState<"details" | "history">("details"), + [modalTab, setModalTab] = useState<"details" | "agent" | "history">("details"), [comment, setComment] = useState(""), [assigner, setAssigner] = useState(""), [managementStatus, setManagementStatus] = useState("unreviewed"), [run, setRun] = useState(""), [selectedIssueIds, setSelectedIssueIds] = useState>(new Set()), [deleteSelectionOpen, setDeleteSelectionOpen] = useState(false), + [autoImproveOpen, setAutoImproveOpen] = useState(false), [page, setPage] = useState(1), [pageSize, setPageSize] = useState(15); const filterMenu = useRef(null); @@ -133,6 +146,11 @@ export function IssueManagementSection({ load(); api("/api/runs").then(setRuns).catch(() => setRuns([])); }, [buildId]); + useEffect(() => { + if (!items.some((item) => item.agent_job?.status === "queued" || item.agent_job?.status === "running")) return; + const timer = window.setInterval(load, 2_500); + return () => window.clearInterval(timer); + }, [items]); useEffect(() => { if (!selected || !selected.proposal.agent_change) return; api<{ diff: string }>(`/api/v1/issue-management/${encodeURIComponent(selected.proposal_id)}/diff`) @@ -257,6 +275,16 @@ export function IssueManagementSection({ }) .catch((error) => onNotice(error.message, "warning")); }; + const confirmAutoImprove = () => { + const proposalIds = [...selectedIssueIds]; + setAutoImproveOpen(false); + api<{ queued: string[] }>("/api/v1/issue-management/agent-proposals", "POST", { proposal_ids: proposalIds }) + .then(({ queued }) => { + load(); + onNotice(t.autoImproveQueued.replace("{count}", String(queued.length)), "success"); + }) + .catch((error) => onNotice(error.message, "warning")); + }; const toggleManagedStatus = (status: string) => { setPage(1); @@ -353,6 +381,17 @@ export function IssueManagementSection({ ), sortValue: (x) => x.management_status, }, + { + id: "agent-status", + header: t.autoImprove, + render: (x) => x.agent_job ? ( + + ) : "—", + sortValue: (x) => x.agent_job?.status ?? "", + }, ]; const filterCount = managedStatuses.size + decisions.size; return ( @@ -440,6 +479,14 @@ export function IssueManagementSection({
{t.selected.replace("{count}", String(selectedIssueIds.size))} +
setDeleteSelectionOpen(false)} onConfirm={confirmDeleteSelected} /> + setAutoImproveOpen(false)} + onConfirm={confirmAutoImprove} + /> @@ -529,25 +588,6 @@ export function IssueManagementSection({

{selected.decision_rationale}

)} - {selected.proposal.agent_change && ( -
-

{t.agentProposalDiff}

- {agentDiff?.proposalId === selected.proposal_id && agentDiff.value ? :

{t.noAgentProposalChanges}

} -
- )} - {selected.proposal.agent_change && ( -
-

{t.agentProposalBranch}

-

{selected.proposal_branch || "—"}

- {selected.proposal_commit &&

{t.committed}: {selected.proposal_commit}

} - {selected.proposal_action === "pending" && ( -
- - -
- )} -
- )}