Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/architecture/rfcs/monorepo-distribution-split-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4024,3 +4024,41 @@ producer/consumer pipeline. Research- or replan-associated Todos still enter the
load its implementations; a disabled policy does not remove that remaining
loading dependency. Complete D2/D5 closure, real-model Host/context continuity, progressive controls,
comparable complete cost, R1/M3 and C1 default cutover remain unqualified.

### 2026-11-14 — Disabled research composition resolves before execution loading

The existing Explore configuration module now owns the composition policy for
the documented scalar modes and unchanged public-safe identifier validation. Research execution and evidence
reuse that owner; their established exports remain available. Native terminal
qualification checks the current source and resolves the same policy before
loading research execution. The original applicability, source, qualification,
writer, lease, CAS, receipt and cleanup rules remain in their existing owners.

Fresh-process File/SQLite cases complete and independently read back ordinary
and generic-replan results without research execution or graph implementations
when composition is disabled, including an explicit Goal-off override. Enabled
and inheritance-only configurations retain selected dependency failures with no
completion or receipt. Invalid modes and scope identifiers remain rejected;
an unavailable execution implementation cannot hide those configuration errors.
After an enabled dependency failure, an explicitly disabled current source can
complete the same failed operation once and replay its receipt; stale source
requests remain refused. Both retained baseline backend probes fail on the
original loading dependency, while the same candidate fixtures pass.

The same 21 policy and 13 identifier observations retain full return values and
error details. An independently built Core wheel, installed alone, passes the
same File/SQLite fault and recovery paths with production bytes equal to source.
The delta also passes selected authority/context/recovery combinations with
C1 #8266 (`b4f958186532`) and #8484 (`b7e4e01cc423`), retaining their original
tests and producer/consumer owners. This is dependency-failure isolation, not a
measurement of latency, complete cost or model benefit. Configuration errors
now precede unavailable execution IO intentionally. Full selected D2/D5 closure,
real-model Host/context adoption, progressive controls, R1/M3, C1 cutover and
original-goal regression remain unqualified.

The final counterexample review also rejects non-string composition modes.
Previously a single-element array such as `["explicit_only"]` passed string
coercion but produced an inactive policy, silently skipping research evidence.
The existing configuration owner now refuses this malformed shape before IO;
documented scalar modes, defaults and errors retain their semantics. Real
File/SQLite negative cases guard this boundary without changing valid activation.
27 changes: 27 additions & 0 deletions docs/architecture/rfcs/monorepo-distribution-split-v0.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3133,3 +3133,30 @@ terminal lifecycle 请求选中它时加载。普通 coordination 不再加载
producer/consumer 管线。带研究或重规划标记的 Todo 仍进入原策略检查并加载其实现;策略禁用时也保留
这项待隔离的加载依赖。完整 D2/D5 闭包、真实模型
Host/上下文延续、渐进控制、可比完整成本、R1/M3 与 C1 默认切换仍未完成资格验证。

### 2026-11-14 — 关闭研究组合先解析配置再加载执行实现

既有 Explore 配置模块现在拥有面向已声明标量 mode 的组合策略和未改动的 public-safe 标识校验;研究执行与
证据复用这个 owner,原导出入口继续可用。native 终态资格先检查当前 source 并解析
同一策略,再加载研究执行。原适用性、source、资格、writer、lease、CAS、回执与
清理规则继续由既有 owner 负责。

新进程 File/SQLite 用例在组合关闭时,包括明确 Goal-off 覆盖,不加载研究执行或
图实现也能完成普通与通用重规划任务并独立回读结果。启用和仅设置继承配置的路径
保留已选中依赖故障,不写完成状态或回执。无效 mode 与 scope 标识仍被拒绝,执行
实现不可用不能掩盖配置错误。启用路径依赖失败后,明确关闭策略的当前 source 能以
同一失败操作身份完成一次并重放原回执;旧 source 请求仍被拒绝。保留的两个后端
基线探针都在原加载依赖处失败,同一候选用例通过。

同一 21 项策略和 13 项标识观察保留完整返回值与错误详情。独立构建并单独安装的
Core wheel 通过同一 File/SQLite 故障与恢复路径,production 字节与源码一致。
该改动与 C1 #8266(`b4f958186532`)、#8484(`b7e4e01cc423`)组合后也通过选中
的 authority、上下文与恢复检查,保留其原测试和 producer/consumer owner。
这验证依赖故障隔离,不测量延迟、完整成本或模型收益;配置错误现在有意优先于
不可用的执行 IO。完整所选 D2/D5 闭包、真实模型 Host/上下文采用、渐进控制、
R1/M3、C1 切换和原目标回归仍未完成资格验证。

最终反例评审还拒绝非字符串组合 mode。此前 `["explicit_only"]` 这样的单元素数组
通过字符串强制转换,却生成 inactive policy,静默跳过研究证据。既有配置 owner
现在在 IO 之前拒绝这种错误形状;已声明的标量 mode、默认值和错误语义保持不变。
真实 File/SQLite 负向用例保护这个边界,不改变合法激活规则。
22 changes: 22 additions & 0 deletions loopx/control_plane/capabilities/explore_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ import {EffectRuntimeRequestError} from "../effect_runtime_errors.ts";
export const EXPLORE_MODES = ["off", "evidence", "planning"] as const;
export type ExploreMode = typeof EXPLORE_MODES[number];

export function researchIdentifier(value: unknown, field: string): string {
if (typeof value !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(value)) {
throw new EffectRuntimeRequestError(`${field} must be an opaque public-safe identifier`);
}
return value;
}

export function normalizeResearchCompositionPolicy(params: JsonObject): JsonObject {
const harness = requireJsonObject(params.harness, "Explore harness");
const mode = harness.composition_mode ?? "disabled";
if (typeof mode !== "string" || !["disabled", "explicit_only"].includes(mode)) {
throw new EffectRuntimeRequestError("composition_mode must be disabled or explicit_only");
}
const scope = harness.composition_scope_id == null || harness.composition_scope_id === "" ? null
: researchIdentifier(harness.composition_scope_id, "composition_scope_id");
if (mode === "explicit_only" && scope === null) {
throw new EffectRuntimeRequestError("explicit_only composition requires composition_scope_id");
}
return {schema_version: "research_composition_policy_v0", mode, coverage_scope_id: scope,
enabled: harness.enabled === true && mode === "explicit_only"};
}

function mode(value: unknown): ExploreMode {
if (!EXPLORE_MODES.includes(value as ExploreMode)) {
throw new EffectRuntimeRequestError("explore_mode must be off, evidence or planning");
Expand Down
7 changes: 1 addition & 6 deletions loopx/control_plane/capabilities/explore_research.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {createHash} from "node:crypto";
import type {JsonObject} from "../effect_program.ts";
import {EffectRuntimeRequestError} from "../effect_runtime_errors.ts";
import {requireJsonObject, requireStringLiteral} from "../runtime_decode.ts";
import {researchIdentifier as id} from "./explore_configuration.ts";

const OBSERVATION = "typed_research_observation_v0";
const CLOSURE = "research_closure_basis_v0";
Expand All @@ -13,12 +14,6 @@ export const MAX_RESEARCH_GAPS = 3;
const TERMINAL = new Set(["exploration_exhausted", "no_followup"]);
const compare = (a: string, b: string) => a < b ? -1 : a > b ? 1 : 0;

function id(value: unknown, field: string): string {
if (typeof value !== "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(value)) {
throw new EffectRuntimeRequestError(`${field} must be an opaque public-safe identifier`);
}
return value;
}
function object(value: unknown, field: string, allowed: string[]): JsonObject {
const row = requireJsonObject(value, field);
if (Object.keys(row).some(key => !allowed.includes(key))) {
Expand Down
17 changes: 2 additions & 15 deletions loopx/control_plane/capabilities/explore_research_execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import type {JsonObject} from "../effect_program.ts";
import {EffectRuntimeRequestError} from "../effect_runtime_errors.ts";
import {requireJsonObject} from "../runtime_decode.ts";
import {normalizeResearchCompositionPolicy} from "./explore_configuration.ts";
export {normalizeResearchCompositionPolicy} from "./explore_configuration.ts";
import {normalizeResearchObservation, researchCompositionGaps, researchIdentifier, researchDigest,
validateResearchAttribution} from "./explore_research.ts";
import {evaluateTodoResumeConditions, TODO_RESUME_EVALUATION_REQUEST_SCHEMA_VERSION,
Expand All @@ -12,21 +14,6 @@ const array = (value: unknown): JsonObject[] => Array.isArray(value) ? value.map
const same = (left: unknown, right: unknown) => JSON.stringify(left) === JSON.stringify(right);
type CompositionFrontierState = "disabled" | "pending" | "scheduled" | "observed" | "dismissed" | "deferred" | "ineligible" | "empty";

export function normalizeResearchCompositionPolicy(params: JsonObject): JsonObject {
const harness = requireJsonObject(params.harness, "Explore harness");
const mode = harness.composition_mode ?? "disabled";
if (!["disabled", "explicit_only"].includes(String(mode))) {
throw new EffectRuntimeRequestError("composition_mode must be disabled or explicit_only");
}
const scope = harness.composition_scope_id == null || harness.composition_scope_id === "" ? null
: researchIdentifier(harness.composition_scope_id, "composition_scope_id");
if (mode === "explicit_only" && scope === null) {
throw new EffectRuntimeRequestError("explicit_only composition requires composition_scope_id");
}
return {schema_version: "research_composition_policy_v0", mode, coverage_scope_id: scope,
enabled: harness.enabled === true && mode === "explicit_only"};
}

function boundTodo(todo: JsonObject, gap: JsonObject, obligationId: unknown, agent: unknown,
retainedHistory = false): boolean {
const refs = todo.explore_result_node_refs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ export class ResearchTerminalEvidenceHost {
&& context.todo.capability_binding_ref !== "explore:research-composition-v0"
&& !(Array.isArray(context.todo.explore_result_node_refs) && context.todo.explore_result_node_refs.length)
&& !context.todo.replan_obligation_id) return {required: false, allowed: true, evidence: null};
const {normalizeResearchCompositionPolicy, qualifyResearchCompletion} = await import("./explore_research_execution.ts");
const {resolveExploreGoalConfiguration} = await import("./explore_configuration.ts");
const {normalizeResearchCompositionPolicy, resolveExploreGoalConfiguration} = await import("./explore_configuration.ts");
const source = requireJsonObject(this.source, "research registry source");
const bytes = await readFile(String(source.path));
if (createHash("sha256").update(bytes).digest("hex") !== source.sha256) {
Expand All @@ -46,6 +45,7 @@ export class ResearchTerminalEvidenceHost {
if (policy.mode === "disabled" || mode.mode_source === "goal_override" && !policy.enabled) {
return {required: false, allowed: true, evidence: null};
}
const {qualifyResearchCompletion} = await import("./explore_research_execution.ts");
const python = process.env.LOOPX_EFFECT_RUNTIME_PYTHON;
if (!python || !isAbsolute(python) || python.includes("\0")) {
return {allowed: false, reason_code: "research_evidence_host_required",
Expand Down
Loading
Loading