feat(integration): prepaid billing, engine UI, credits console, direct tasks, v2 final
- Prepaid credit system: org wallet, debit on usage, chat gate, admin credit console - Engine UI: /manager, /tasks, /tasks/[id], /workforce, /dashboard, /traces pages - Direct task creation (HTTP POST /tasks, MCP tasks_create) at pending_manager_review - Pause/resume/cancel/answer actions in engine API and UI - Employee cap (7 per org default), review pipeline guard (active reviewer required) - Scheduler: wide window prevents org starvation; archived employees excluded from cap - Tenant isolation: project-id cross-org 404, engine never uses another tenant's sandbox - Order route fix: manager built with pipeline states + employee profiles - Contract extension: ModelGrantPort.get_org_policy with DefaultOrgPolicy - Engine event types in @agy/contracts (task.step, task.gate, run.log, run.tool, team.changed) - api-engine.ts typed client; api-credit.ts client - Alembic migration c4d5e6f7a8b9: prepaid credit + engine UI tables - 859 tests passed, 1 skipped; ruff/mypy/tsc/eslint/vitest all green Refs: PLAN-v2.md §9 (T1–T43), todo-v2-final.md
This commit is contained in:
@@ -429,25 +429,27 @@ async def test_a_failed_task_run_is_persisted_with_its_tenant(
|
||||
seeded, client: AsyncClient, session_factory, monkeypatch
|
||||
):
|
||||
"""A task that cannot run is a tenant-visible problem, so the row must name
|
||||
the organization — otherwise nobody can find it in the console."""
|
||||
the organization — otherwise nobody can find it in the console.
|
||||
|
||||
Decision D-D: the legacy drain is the path under test, so the task is a pre-v2 row
|
||||
(no pipeline state); a task made over HTTP is the engine's now.
|
||||
"""
|
||||
from app.application.services.workforce_service import WorkforceService
|
||||
from app.workers.ai_runtime import AiRuntimeWorker
|
||||
from tests.test_workers import _make_org_with_employee
|
||||
from tests.legacy_tasks import legacy_task
|
||||
from tests.test_workers import _make_org_with_employee, _owner_of
|
||||
|
||||
org_id, headers, project_id, employee_id = await _make_org_with_employee(
|
||||
org_id, _headers, project_id, employee_id = await _make_org_with_employee(
|
||||
client, "errlog-worker@example.com"
|
||||
)
|
||||
task_id = (
|
||||
await client.post(
|
||||
f"/api/organizations/{org_id}/tasks",
|
||||
json={
|
||||
"title": "کاری که شکست میخورد",
|
||||
"project_id": project_id,
|
||||
"assigned_employee_id": employee_id,
|
||||
},
|
||||
headers=headers,
|
||||
)
|
||||
).json()["id"]
|
||||
task_id = await legacy_task(
|
||||
session_factory,
|
||||
org_id,
|
||||
await _owner_of(session_factory, org_id),
|
||||
title="کاری که شکست میخورد",
|
||||
project_id=project_id,
|
||||
assigned_employee_id=employee_id,
|
||||
)
|
||||
|
||||
async def _boom(*args, **kwargs):
|
||||
raise RuntimeError("provider returned a malformed response")
|
||||
|
||||
Reference in New Issue
Block a user