feat(research): isolate candidates and add reviewed paper promotion
This commit is contained in:
parent
26b97265c6
commit
25b5cbf481
128 changed files with 13038 additions and 1388 deletions
|
|
@ -10,6 +10,10 @@ Unreviewed code is built/imported/evaluated in an OS-restricted process or conta
|
|||
|
||||
Trusted registered/reviewed artifacts can run beside NAPI in a worker for speed. Moving an artifact into that tier requires an explicit operator action, never an AI-supplied trust flag. If the sandbox is unavailable, reject untrusted execution; do not silently downgrade.
|
||||
|
||||
Implementation clarification (A02/A04): the trusted **research** path is limited to server-registered built-ins. Catalog approval never changes a candidate's isolated research execution. A separate immutable human paper-promotion receipt may authorize the exact candidate factory in the paper host after held-out/cost evidence and financial-build parity checks. That action is a deliberate trust decision; paper starts unbound/halted, and live remains unavailable.
|
||||
|
||||
The first isolation profile is a local Linux x86_64 Docker scratch image containing the installed Bun runtime, trusted protocol host and independent Rust PID1 guardian. It has no host/data mounts or network, uses cgroup limits and a restricted unprivileged child, and dies on supervisor disconnect or a monotonic deadline. Version the image, host, guardian, runtime and policy in retained requests. A standalone restricted transpiler accepts self-contained TypeScript; no dependency installation, remote build service, JavaScript VM security claim or second simulator is introduced.
|
||||
|
||||
## Evidence
|
||||
|
||||
[Current role model](../../../../libs/core/di/src/http/security.ts#L4) is a small operator boundary, not research isolation. [Current registry dependencies](../../../../apps/stock/orchestrator/src/strategies/StrategyRegistry.ts#L7) expose execution services that the new decision API must not expose.
|
||||
|
|
|
|||
|
|
@ -110,3 +110,16 @@ Validation reports (R08) are immutable experiment-owned outputs, not research fi
|
|||
|
||||
|
||||
R01 now retains immutable bundled JavaScript and exact dependency locks with source/build metadata. Three tables support editable strategy metadata, immutable versions and append-only reviews. The offline seed command registers only locally packaged built-ins; HTTP uploads/clones remain candidates. Catalog parameter validation never evaluates code, and all versions remain explicitly non-runnable. R02 may deliver catalog/forms before R05, but version-based execution requires R05; arbitrary candidates additionally require A02. Review approval is evidence, not activation. Original TS source and complete run reproducibility remain outside this catalog-only claim.
|
||||
|
||||
|
||||
## A04 execution: human-reviewed paper promotion
|
||||
|
||||
The `/paper` workflow retains an immutable deployment before any account is bound. Select a sealed chronological or walk-forward **test** run and a fully completed standalone cost study from the same source dataset, strategy version, parameters, risk policy and research build. Review the exact retained code, including AI-originated code, and approve its catalog version separately. Supply a new account/session identity and explicit future feed, intraday observation cadence, risk clock and venue sessions; the platform does not infer them. Financial settings come from the selected saved cost scenario. Preview shows the exact evidence, paper-host identity and limitations; **Create halted deployment** records the promotion without activating trading. An uncertain response freezes the draft: use **Retry same promotion receipt**, which retains the original input and key.
|
||||
|
||||
To use an explicit paper host, build the orchestrator with `bun run --cwd apps/stock/orchestrator build` and apply the registered database migrations. Configure `services.orchestrator.defaultMode: paper`, durable PostgreSQL, and `services.orchestrator.paperDeploymentHost: { enabled: true }`; do not also configure `canonicalPaper`. An optional `deploymentId` binds that immutable deployment at startup but never activates it. Keep research workers in their separate research role. This configuration is opt-in; promotion does not change application defaults.
|
||||
|
||||
The web API requires an explicitly configured `ORCHESTRATOR_URL`. Both services must enable authentication, share the configured administrator credential (`STOCK_BOT_ADMIN_TOKEN`), and explicitly allow the browser origin through `STOCK_BOT_ALLOWED_ORIGINS`; the orchestrator verifies forwarded operator sessions. The original operator credential and Origin are checked at both ends. Development auth bypass, research-agent credentials and service tokens cannot authorize promotion, binding or activation. A missing host or mismatched origin is an unavailable/error state, never a fallback to service privilege.
|
||||
|
||||
Open the saved deployment, **Bind halted host**, connect the trusted feed, inspect readiness/recovery diagnostics, then explicitly **Activate paper**. Recovery of pending work requires the displayed acknowledgment. Restart preserves the same account cash, positions, owner checkpoints and execution journal; it does not recopy historical capital or strategy state. Use **Halt paper** before intervention. Later review revocation blocks new binding/activation but does not halt a running session automatically. Historical evidence and halt remain accessible.
|
||||
|
||||
Paper-host, native engine, dependency and runtime artifacts must remain immutable while running. Drift fails closed and requires restart; changed build/evidence requires a newly reviewed deployment and a new account, not an in-place account reset. Research and paper must share the native financial build, while their worker/host bundles have separate identities. Human promotion explicitly permits these exact bytes to run as trusted paper-host code; the research candidate sandbox does not extend to paper. Paper starts from factory state, uses quotes/displayed size rather than historical Open/volume fills, currently accepts one intraday strategy/asset, and has no live broker. Holdouts and cost sensitivity are retained evidence, not a performance guarantee.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue