Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

Merge pull request #1162 from avibe-bot/codex-integrate-org-into-master

Max94cc05cc9416
diff --cc core/scheduled_tasks.py
index 5957b9c56,fd222794b..4b28094be
--- a/core/scheduled_tasks.py
+++ b/core/scheduled_tasks.py
@@@ -2065,10 -1948,22 +2085,24 @@@ class ScheduledTaskStore
expect,
queued_run=queued_run,
expected_uncanceled_run_id=expected_uncanceled_run_id,
+ expected_schedule_generation=expected_schedule_generation,
+ expected_terminal_run_id=expected_terminal_run_id,
)
+ def suspend_task(self, task_id: str, *, error: str) -> bool:
+ """Atomically disable a definition before an unsafe execution boundary."""
+
+ self.maybe_reload()
+ task = self._tasks.get(task_id)
+ if task is None:
+ return False
+ expect = self._read_state(task)
+ task.enabled = False
+ task.last_run_at = _utc_now_iso()
+ task.last_error = error
+ task.updated_at = _utc_now_iso()
+ return self._write_task(task, expect)
+
class TaskExecutionStore:
def __init__(self, root: Optional[Path] = None):
@@@ -8188,16 -7863,18 +8222,26 @@@ class ScheduledTaskService
#: which is what stops the same failure being reported twice.
escalation_run_id: Optional[str] = None
try:
+ from storage.resource_access_service import (
+ REMOTE_AUTONOMOUS_HARNESS_DISABLED_CODE,
+ metadata_has_remote_resource_context,
+ )
+
+ if (
+ request.request_type not in {"task_run", "scheduled"}
+ and metadata_has_remote_resource_context(request.metadata)
+ ):
+ raise PermissionError(REMOTE_AUTONOMOUS_HARNESS_DISABLED_CODE)
if request.request_type in {"task_run", "scheduled"}:
- self.store.maybe_reload()
+ # A scheduled one-shot is retired in the same SQLite transaction
+ # that created this Run. Only that transaction stamps the Run as
+ # its owner; cron fires keep the invalidation-aware fast path.
+ consumed_generation = task_schedule_generation(request.metadata)
+ consumed_one_shot = consumed_generation is not None
+ if consumed_one_shot:
+ self.store.load()
+ else:
+ self.store.maybe_reload()
task = self.store.get_task(request.task_id or "")
if task is None:
raise ValueError(f"task '{request.task_id}' not found")
@@@ -8889,8 -8538,12 +8936,13 @@@
execution_id: str,
disable_one_shot: bool,
agent_id: Optional[str] = None,
+ schedule_generation: Optional[dict[str, str]] = None,
) -> TaskExecutionResult:
+ from storage.resource_access_service import (
+ REMOTE_AUTONOMOUS_HARNESS_DISABLED_CODE,
+ metadata_has_remote_resource_context,
+ )
+
error: Optional[str] = None
complete_on_return = True
reconcile_delivery_on_return = False
diff --cc vibe/ui_server.py
index df5a4c3ca,036504758..bb21b2028
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@@ -4182,24 -4794,16 +4794,29 @@@ def _task_resume_blocked_response(exc)
)
+def _task_schedule_retired_response(exc):
+ from core.services import settings as settings_service
+
+ lang = settings_service.load_config_or_default().language
+ return _coded_error_response(
+ exc.code,
+ t("error.taskScheduleRetired.message", lang),
+ 409,
+ hint=t("error.taskScheduleRetired.hint", lang, id=exc.definition_id),
+ details={"task_id": exc.definition_id},
+ )
+
+
def _show_page_error_response(exc):
code = getattr(exc, "code", "invalid_show_page_request")
+ if code == "resource_access_forbidden":
+ status = 403
# A conflict (not a malformed request) when the page is in the wrong state or
# the chosen suffix is already claimed.
- status = 409 if code in {"not_public", "share_id_taken"} else 400
+ elif code in {"not_public", "share_id_taken"}:
+ status = 409
+ else:
+ status = 400
return _coded_error_response(code, str(exc), status)