diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 9ab2423d0058b12a6351871bdcf545120ccb4876..976780f2b05595fa56e22514ff56a0dc245c2df6 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,7 +1,7 @@
{
// Runs the whole product in a GitHub Codespace (a cloud machine with 8 GB of memory), so full browser runs work
// without a laptop or a paid server. The application starts by itself; open the forwarded port 8800.
- "name": "Patch Testing Co-worker (demo)",
+ "name": "Trio Co-Worker (demo)",
"build": { "dockerfile": "../Dockerfile", "context": ".." },
"hostRequirements": { "cpus": 2, "memory": "8gb" },
// root inside this throwaway machine: avoids file-ownership differences between the image and the Codespace
@@ -18,7 +18,7 @@
},
"forwardPorts": [8800],
"portsAttributes": {
- "8800": { "label": "Patch Testing Co-worker", "onAutoForward": "openBrowser" }
+ "8800": { "label": "Trio Co-Worker", "onAutoForward": "openBrowser" }
},
"postStartCommand": "sh .devcontainer/start.sh"
}
diff --git a/.devcontainer/start.sh b/.devcontainer/start.sh
index 9e414baf8bfa757b49351e4a61cfa9cfb718d6e8..300cb14220b3b612df6b22ef1adb657ec362b746 100644
--- a/.devcontainer/start.sh
+++ b/.devcontainer/start.sh
@@ -27,7 +27,7 @@ else
fi
echo ""
-echo " Patch Testing Co-worker is running."
+echo " Trio Co-Worker is running."
echo " Open the PORTS tab, then the globe icon next to port 8800."
echo " Sign in with user: admin password: $(cat /data/demo-password.txt)"
echo ""
diff --git a/Dockerfile b/Dockerfile
index 3e608568b83990ea80c90767527ec521983675c1..4b1dd9237a2388b40da0966ecdbabe44a1f61cd6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-# Patch Testing Co-worker: one application image (web app + API + workflow worker + test executor + practice pod).
+# Trio Co-Worker: one application image (web app + API + workflow worker + test executor + practice pod).
# Build from the project root: docker build -t patch-coworker:1.0.0 .
# Run with deploy/docker-compose.yml (adds Temporal and an HTTPS proxy). All customer data lives in the /data volume.
diff --git a/README.md b/README.md
index fd24be49401a91728f03aefdb000bebc4a6a7cc4..f66447d5cecbe7cd00b0414895ae2aedb7026c56 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
---
-title: Patch Testing Co-worker
+title: Trio Co-Worker
emoji: "đ§Ș"
colorFrom: indigo
colorTo: gray
@@ -8,7 +8,9 @@ app_port: 8800
pinned: false
---
-# Patch Testing Co-worker
+

+
+# Trio Co-Worker
A team of AI agents that checks whether a quarterly Oracle Fusion patch is safe: it researches what the patch
changes, chooses test scenarios, runs them in a real browser, analyses failures and produces a Ready / Not ready
diff --git a/config/coworker.yaml b/config/coworker.yaml
index 3391e64f5e9f82e05b1ff396cbdefd683044f2a2..aa21b79960e2dfe7fec0170d75f166f86e2c6d2a 100644
--- a/config/coworker.yaml
+++ b/config/coworker.yaml
@@ -1,4 +1,4 @@
-# Fusion Patch Testing co-worker: NON-SECRET configuration (env vars and .env override every key; env wins).
+# Trio Co-Worker: NON-SECRET configuration (env vars and .env override every key; env wins).
# Secrets never go here: they live in the vault (var/secrets/vault.json or FPT_SECRET_* env).
# The only pod in this project is the LOCAL MOCK app (mock-app/, 127.0.0.1:3100). It is not Oracle Fusion.
diff --git a/coworker/README.md b/coworker/README.md
index e4f0fc735964df292a1d36c1f9a338b341cd38f4..ad8a35cce900338e464f18767bb4e46989cb2757 100644
--- a/coworker/README.md
+++ b/coworker/README.md
@@ -1,4 +1,4 @@
-# Fusion Patch Testing co-worker (pilot)
+# Trio Co-Worker (pilot)
> **Mock app, not Oracle Fusion.** The only "pod" is the local mock (`mock-app/`, http://127.0.0.1:3100). No Oracle Fusion
> pod, credentials or client data exist in this project. Every report, the web app and the desktop app say so.
@@ -24,7 +24,7 @@ fpt.cmd down & rem stop what `up` started (
| `fpt.cmd up` / `down` | Temporal + worker (when `orchestrator: temporal`) + mock (if down) + backend (`/` = app, `/api` = API, `/api/docs` = OpenAPI UI). Builds `web/dist` if missing |
| `fpt.cmd web-dev` | Vite dev server on http://127.0.0.1:5173 proxying `/api` to :8800 (start the API with `fpt.cmd api`) |
| `fpt.cmd desktop` | Electron app in local mode (spawns the backend on a free port) |
-| `fpt.cmd package` | builds `web/dist`, then the NSIS installer `desktop\dist\FPT Co-worker Setup 1.0.0.exe` (unsigned) |
+| `fpt.cmd package` | builds `web/dist`, then the NSIS installer `desktop\dist\Trio Co-Worker Setup 1.0.0.exe` (unsigned) |
| `fpt.cmd create-user --username U --role viewer\|consultant\|qa_approver\|admin [--password-env VAR \| --password-stdin]` | local user |
| `fpt.cmd test` | coworker pytest + coworker selftest + architecture selftest (27) + triage tests (71) |
| `fpt.cmd selftest [--live]` | offline end-to-end checks (35); `--live` adds 3 real P2P cases in Chromium against the mock |
diff --git a/coworker/__main__.py b/coworker/__main__.py
index 493a27bff4904699d71bc0f31c11f6bc2253a770..8a82fc52f27123bfc5e0eae545076f85381f5240 100644
--- a/coworker/__main__.py
+++ b/coworker/__main__.py
@@ -205,7 +205,7 @@ def cmd_up(a) -> int:
if loopback_ok(url + "/api/ready", timeout=2):
break
time.sleep(0.5)
- print(f"\nFusion Patch Testing co-worker is up: {url} (API docs {url}/api/docs)", flush=True)
+ print(f"\nTrio Co-Worker is up: {url} (API docs {url}/api/docs)", flush=True)
if cfg.orchestrator == "temporal":
print(f"Temporal Web UI: {cfg.temporal_ui_url} (worker log var/logs/worker.out.log)", flush=True)
print("Target: mock app on " + cfg.pod_base_url + " -- MOCK APP, NOT ORACLE FUSION. Ctrl+C or `fpt.cmd down` to stop.", flush=True)
@@ -346,16 +346,16 @@ def cmd_state(a) -> int:
return 0
if a.action == "restore":
if (cfg.home / "fpt.sqlite").exists():
+ (cfg.home / statesync.FAILED_MARKER).unlink(missing_ok=True) # a stale marker from an earlier start
print(f"{cfg.home} already has data: nothing restored")
return 0
# the egress gate needs an audit log; while FPT_HOME is still empty it writes to a throwaway one
with tempfile.TemporaryDirectory() as tmp:
scratch = build_services(cfg.model_copy(update={"fpt_home": Path(tmp)}))
client = sb.Supabase(cfg, scratch.egress, None)
- try:
- done = statesync.restore(cfg, client)
- except sb.SupabaseError as e:
- print(f"state restore failed: {e}")
+ done, err = statesync.restore_at_boot(cfg, client)
+ if err:
+ print(f"state restore failed (saving to the bucket is paused until the next start): {err}")
return 0 if a.soft else 1
print("state restored from Supabase Storage" if done else "no saved state yet: starting empty")
return 0
diff --git a/coworker/api/app.py b/coworker/api/app.py
index 2eb5aed66122793ff9a69e6457ffb7c6c94f2bbc..f7ec870730afeef1f533bd8e2748c7cf0c3ca6ae 100644
--- a/coworker/api/app.py
+++ b/coworker/api/app.py
@@ -15,7 +15,7 @@ from ..graph.services import Services, build_services
from ..platform.scheduler import Scheduler
from . import errors
from .middleware import RequestContext, setup_logging
-from .routes import admin, auth, chat, consultant, gates, live, llm, pods, review, runs, screens
+from .routes import admin, assistant, auth, chat, consultant, gates, live, llm, pods, review, runs, screens
from .runner import RunManager
log = logging.getLogger("fpt.api")
@@ -73,7 +73,7 @@ def create_app(svc: Services | None = None, cfg: Settings | None = None, *, back
if syncer:
syncer.stop()
- app = FastAPI(title="Fusion Patch Testing Co-worker API", version=VERSION, lifespan=lifespan,
+ app = FastAPI(title="Trio Co-Worker API", version=VERSION, lifespan=lifespan,
description="Pilot backend. Runs ONLY against the local mock app, not Oracle Fusion.",
docs_url="/api/docs", redoc_url=None, openapi_url="/api/openapi.json")
app.state.svc, app.state.runs, app.state.scheduler, app.state.inline_worker = svc, run_mgr, sched, not background
@@ -85,7 +85,7 @@ def create_app(svc: Services | None = None, cfg: Settings | None = None, *, back
app.add_middleware(RequestContext)
api = APIRouter(prefix="/api")
- for r in (auth.router, runs.router, gates.router, review.router, admin.router, pods.router, screens.router, consultant.router, live.router, chat.router, llm.router):
+ for r in (auth.router, runs.router, gates.router, review.router, admin.router, pods.router, screens.router, consultant.router, live.router, chat.router, assistant.router, llm.router):
api.include_router(r)
app.include_router(api)
diff --git a/coworker/api/routes/admin.py b/coworker/api/routes/admin.py
index bc99a4f7b9febf7ab22e0a5f8015e48ff57ed41c..1e21e6dacd5354dc74b7a9d07e95c9f3ab037ae7 100644
--- a/coworker/api/routes/admin.py
+++ b/coworker/api/routes/admin.py
@@ -43,6 +43,9 @@ def ready(request: Request):
syncer = getattr(request.app.state, "syncer", None)
body["saved_state"] = {"on": syncer is not None, "last_saved_at": (svc.extra.get("state_last") or {}).get("saved_at"),
"ok": syncer.last_error is None if syncer else None}
+ if syncer is not None:
+ from ...platform import statesync
+ body["saved_state"]["paused"] = statesync.restore_failed(svc.cfg.home) # the boot restore failed: not saving, to protect the saved copy
if not ok:
import json
return Response(json.dumps(body), status_code=503, media_type="application/json")
@@ -113,6 +116,12 @@ def schedule_create(body: ScheduleIn, request: Request, user: Principal = Depend
raise ApiError(422, "VALIDATION", "interval schedules need every_minutes")
if body.kind == "daily" and not body.at:
raise ApiError(422, "VALIDATION", "daily schedules need at (HH:MM, UTC)")
+ if body.kind in ("monthly", "quarterly") and not (body.at and body.day):
+ raise ApiError(422, "VALIDATION", f"{body.kind} schedules need day (1-28) and at (HH:MM, UTC)")
+ if body.kind == "quarterly" and not body.month:
+ raise ApiError(422, "VALIDATION", "quarterly schedules need month (the first month of the cycle, 1-12)")
+ if body.pod_id is not None and not request.app.state.svc.db.one("SELECT id FROM pods WHERE id=?", (body.pod_id,)):
+ raise ApiError(422, "VALIDATION", "that test environment does not exist")
s = request.app.state.scheduler.create(body.model_dump(), user.username)
request.app.state.svc.audit.append("schedule.created", actor=user.username, payload=s)
return s
diff --git a/coworker/api/routes/assistant.py b/coworker/api/routes/assistant.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1f500176043ebe475336e7aa8833a564f549157
--- /dev/null
+++ b/coworker/api/routes/assistant.py
@@ -0,0 +1,50 @@
+"""/api/assistant: "Ask a question" answered by the Hermes assistant (platform/hermes.py), a separate service.
+
+Off by default (FPT_HERMES_ENABLED): then /ask answers 409 HERMES_OFF and the web app keeps using the built-in chat
+(/api/chat). Same permission as the built-in chat ("read"); rate limited per user. Mock app, not Oracle Fusion."""
+from __future__ import annotations
+
+from fastapi import APIRouter, Depends, Request
+from pydantic import BaseModel, ConfigDict, Field
+
+from ...platform import hermes
+from ..auth import Principal, require
+from ..errors import ApiError
+
+router = APIRouter(prefix="/assistant", tags=["assistant"])
+
+
+class AskIn(BaseModel):
+ model_config = ConfigDict(extra="forbid")
+ question: str = Field(min_length=1, max_length=hermes.MAX_QUESTION)
+ conversation_id: str | None = Field(default=None, max_length=80)
+
+
+class AskOut(BaseModel):
+ answer: str
+ conversation_id: str
+ model: str
+
+
+class AssistantStatus(BaseModel):
+ enabled: bool
+ configured: bool
+ reachable: bool | None = None
+
+
+@router.post("/ask", response_model=AskOut)
+def ask(body: AskIn, request: Request, user: Principal = Depends(require("read"))):
+ """Ask Hermes one question. Pass the returned conversation_id to continue the same conversation.
+ Errors: 409 HERMES_OFF, 503 HERMES_NOT_CONFIGURED, 502 HERMES_UNREACHABLE / HERMES_KEY_REJECTED / HERMES_ERROR,
+ 504 HERMES_TIMEOUT, 429 RATE_LIMITED, 404 NOT_FOUND (unknown or someone else's conversation)."""
+ try:
+ return hermes.ask(request.app.state.svc, user, body.question, body.conversation_id)
+ except hermes.HermesError as e:
+ headers = {"Retry-After": str(e.retry_after)} if e.retry_after else None
+ raise ApiError(e.status, e.code, e.detail, headers=headers) from e
+
+
+@router.get("/status", response_model=AssistantStatus)
+def status(request: Request, user: Principal = Depends(require("read"))):
+ """Whether the Hermes assistant is on, configured (URL and key present) and reachable (checked at most once a minute)."""
+ return hermes.status(request.app.state.svc)
diff --git a/coworker/api/schemas.py b/coworker/api/schemas.py
index 1c37a7ba70a41cd3bc7315f67f45dba6d289e10c..5aa4908de2a784a055923f5e8c3542fb72fd7eb2 100644
--- a/coworker/api/schemas.py
+++ b/coworker/api/schemas.py
@@ -144,6 +144,7 @@ class PodRow(BaseModel):
base_url: str
environment: str
modules: list[str]
+ from_server_settings: bool = False # defined by FPT_FUSION_BASE_URL: re-created at every start, cannot be deleted in the app
notes: str | None = None
enabled: bool
is_default: bool
@@ -261,9 +262,13 @@ class KillIn(Strict):
class ScheduleIn(Strict):
- kind: Literal["interval", "daily"]
+ kind: Literal["interval", "daily", "monthly", "quarterly"]
every_minutes: int | None = Field(default=None, ge=1, le=7 * 24 * 60)
at: str | None = Field(default=None, pattern=r"^\d{2}:\d{2}$")
+ day: int | None = Field(default=None, ge=1, le=28) # monthly / quarterly: day of the month (UTC)
+ month: int | None = Field(default=None, ge=1, le=12) # quarterly: the first month of the cycle (runs again every third month)
+ pod_id: int | None = None # the test environment to run on (default: the server's default pod)
+ patch_id: str | None = Field(default=None, max_length=40) # the patch name to record, e.g. 26C or 2026-10
modules: list[str] = Field(default_factory=list)
include_p2: bool = False
playwright_mode: Literal["live", "stub"] = "live"
diff --git a/coworker/config.py b/coworker/config.py
index 8ec640a66311cb2a742fac5fb4e58ccc46f533ce..9d58bb16544f4866cccc83ec1049fef6effd0844 100644
--- a/coworker/config.py
+++ b/coworker/config.py
@@ -37,7 +37,7 @@ class Settings(BaseSettings):
web_dist: Path = Field(default=ROOT / "web" / "dist", validation_alias=_alias("fpt_web_dist", "web_dist"))
oidc_issuer: str = ""
# shown in the menu and on the sign-in page (a reseller or customer can set its own)
- product_name: str = Field("Patch Testing Co-worker", validation_alias=_alias("fpt_product_name", "product_name"))
+ product_name: str = Field("Trio Co-Worker", validation_alias=_alias("fpt_product_name", "product_name"))
org_name: str = Field("", validation_alias=_alias("fpt_org_name", "org_name"))
# ---- Supabase (optional): identity provider for sign-in / registration, and storage for the encrypted state archive.
@@ -126,6 +126,9 @@ class Settings(BaseSettings):
ollama_model: str = "llava-phi3:latest"
llm_frontier: Literal["off", "stub", "frontier"] = "off"
frontier_base_url: str = ""
+ # With no model settings saved in the app, an https FRONTIER_BASE_URL plus a key in the secrets (FPT_SECRET_FRONTIER_API_KEY)
+ # switches the external model on at start-up, so a restart or a lost snapshot cannot silently turn the AI off.
+ frontier_auto: bool = Field(True, validation_alias=_alias("fpt_frontier_auto", "frontier_auto"))
frontier_model: str = "mistral-large-2512"
frontier_timeout_s: float = Field(120.0, validation_alias=_alias("fpt_frontier_timeout_s", "frontier_timeout_s"))
frontier_max_tokens: int = Field(4096, validation_alias=_alias("fpt_frontier_max_tokens", "frontier_max_tokens"))
@@ -165,12 +168,27 @@ class Settings(BaseSettings):
chat_rate_per_minute: int = 20
chat_action_ttl_s: int = 600
+ # Hermes assistant ("Ask a question" answered by the Hermes Agent Space, OpenAI-compatible /v1). Off by default: the
+ # built-in chat stays in use. The API key is a secret (vault HERMES_API_KEY / env FPT_SECRET_HERMES_API_KEY), never here.
+ hermes_url: str = Field("", validation_alias=_alias("fpt_hermes_url", "hermes_url"))
+ hermes_enabled: bool = Field(False, validation_alias=_alias("fpt_hermes_enabled", "hermes_enabled"))
+ hermes_timeout_s: float = Field(120.0, validation_alias=_alias("fpt_hermes_timeout_s", "hermes_timeout_s"))
+ hermes_rate_per_minute: int = Field(6, validation_alias=_alias("fpt_hermes_rate_per_minute", "hermes_rate_per_minute"))
+
+ # An Oracle Fusion TEST pod that exists from the environment: created at start-up when the saved data has none, so a
+ # restart or a lost snapshot never removes it. Its test user comes from the secrets FPT_SECRET_FUSION_USERNAME and
+ # FPT_SECRET_FUSION_PASSWORD (never from a setting). Unset = pods are managed in the app only.
+ fusion_base_url: str = Field("", validation_alias=_alias("fpt_fusion_base_url", "fusion_base_url"))
+ fusion_name: str = Field("Oracle Fusion test pod", validation_alias=_alias("fpt_fusion_name", "fusion_name"))
+ fusion_environment: str = Field("test", validation_alias=_alias("fpt_fusion_environment", "fusion_environment"))
+ fusion_modules: list[str] = Field(default_factory=lambda: ["AP"], validation_alias=_alias("fpt_fusion_modules", "fusion_modules"))
+
patch_watch_enabled: bool = True
patch_watch_interval_s: int = 300
patch_watch_autostart: bool = False
scheduler_tick_s: int = 30
- @field_validator("research_allowed_domains", "cors_origins", "local_llm_hosts", "live_view_block_modules", mode="before")
+ @field_validator("research_allowed_domains", "cors_origins", "local_llm_hosts", "live_view_block_modules", "fusion_modules", mode="before")
@classmethod
def _csv(cls, v):
if isinstance(v, str):
diff --git a/coworker/graph/nodes/report.py b/coworker/graph/nodes/report.py
index d4af59a8013f962701febce74197cb9e6dbc9aad..68b455236dbe10aef0da189ee40dfcbed60698c8 100644
--- a/coworker/graph/nodes/report.py
+++ b/coworker/graph/nodes/report.py
@@ -13,6 +13,7 @@ from ...adapters.pdf import html_to_pdf
from ...config import MOCK_BANNER
from ...llm.base import LLMRequest, Sensitivity
from ...llm.schemas import ExecSummary
+from ...platform import brand
from .triage import run_triage
STUB_BANNER = "STUB RUN: synthetic results from p2p_graph.py stubs. No browser, no mock-app, no Fusion. Not evidence of anything."
@@ -77,11 +78,13 @@ def reporter(state, config, svc) -> dict:
bundle = out / "bundle.html"
bundle.write_text(
"Go/no-go bundle " + _html.escape(m) + ""
+ + brand.header_html() +
f"{_html.escape(MOCK_BANNER.upper())}
"
f"{_html.escape(m)}: {_html.escape(s['decision'])} (decision source: {_html.escape(report_rule.DECISION_SOURCE)})
"
f"Executive summary
{_html.escape(summary_text)}
Summary route: {resp.route.value}/{_html.escape(resp.model)}
"
- + (inner.group(1) if inner else body) + "", encoding="utf-8")
+ + (inner.group(1) if inner else body) + brand.footer_html(MOCK_BANNER + ".") + "