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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// PR-scoped regression: a packaged switch uses real preview/apply/readback,
// survives reload, rejects stale writes and removes its opt-in on disablement.
// Retirement regression: a saved experimental opt-in stays inert and hidden;
// sibling settings retain real preview/apply/readback and stale-write recovery.
// Isolated machine, empty registry, unavailable native host; no model calls.
import assert from "node:assert/strict";
import {spawn} from "node:child_process";
Expand All @@ -14,6 +14,12 @@ const root = await mkdtemp(join(tmpdir(), "loopx-compaction-preference-"));
const port = Number(process.env.LOOPX_COMPACTION_MEMORY_PORT ?? 5414);
const screenshots = process.env.LOOPX_COMPACTION_MEMORY_SCREENSHOTS;
const registry = join(root, "registry.json");
await mkdir(join(root, "runtime", "machine"), {recursive: true});
await writeFile(join(root, "runtime", "machine", "configuration.json"), JSON.stringify({
schema_version: "loopx_machine_configuration_v0", namespaces: {
compaction_memory: {schema_version: "compaction_memory_machine_defaults_v0", enabled: true},
},
}));
await writeFile(registry, '{"goals":[]}');
await mkdir(join(root, "home"));
if (screenshots) await mkdir(screenshots, {recursive: true});
Expand All @@ -39,58 +45,37 @@ try {
});
const open = async () => {
await page.goto(`${base}/chat/?settings_scope=machine&settings_tab=capabilities`, {waitUntil: "networkidle"});
await page.getByText("Compaction working memory (experimental)", {exact: true}).first().click();
await page.getByText("Progressive context", {exact: true}).first().click();
assert.equal(await page.getByText("Compaction working memory (experimental)", {exact: true}).count(), 0);
assert.equal(await page.getByRole("switch", {name: "Enable experimental compaction working memory"}).count(), 0);
};
const toggle = page.getByRole("switch", {name: "Enable experimental compaction working memory"});
const progressive = page.getByRole("switch", {name: "Read context progressively"});
const delta = page.getByRole("switch", {name: "Use cross-turn delta automatically on supported hosts"});
const configuration = async () => (await (await page.request.get(`${base}/api/chat/machine-configuration`)).json()).machine_configuration;
const capture = async name => {
if (screenshots) await page.screenshot({path: join(screenshots, name)});
};
await open();
assert.equal(await toggle.isChecked(), false);
await capture("desktop-off.png");
let beforeSave = workRequests.length;
await toggle.click();
await page.getByText("Compaction working memory preference saved.", {exact: true}).waitFor();
assert.equal(workRequests.length, beforeSave, "Enabling does not create a conversation or Turn");
assert.equal(await toggle.isChecked(), true);
assert.equal((await configuration()).namespaces.compaction_memory.enabled, true);
await open();
assert.equal(await toggle.isChecked(), true, "Persisted readback survives a fresh page");
await capture("desktop-on.png");
assert.equal(await progressive.isChecked(), true);
assert.equal(await delta.isChecked(), true);
assert.equal((await configuration()).namespaces.compaction_memory, undefined);
await capture("desktop-settings.png");
await page.setViewportSize({width: 430, height: 932});
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
await capture("narrow-on.png");
await capture("narrow-settings.png");
await page.setViewportSize({width: 1440, height: 1000});

// Keep the actual backend and invalidate only the request's CAS expectation.
const apply = "**/api/chat/machine-configuration/apply";
await page.route(apply, route => route.continue({postData: JSON.stringify({
...route.request().postDataJSON(), expected_plan_revision: `sha256:${"0".repeat(64)}`,
})}));
beforeSave = workRequests.length;
await toggle.click();
await progressive.click();
await page.getByText(/machine-configuration plan revision changed/u).waitFor();
assert.equal(workRequests.length, beforeSave, "A rejected setting starts no work");
assert.equal(await toggle.isChecked(), true, "A rejected save must not look disabled");
assert.equal((await configuration()).namespaces.compaction_memory.enabled, true);
assert.equal(await progressive.isChecked(), true, "A rejected save retains the confirmed value");
assert.equal((await configuration()).namespaces.context_delivery, undefined);
await capture("desktop-rejected.png");
await page.unroute(apply);
beforeSave = workRequests.length;
await toggle.click();
await page.getByText("Compaction working memory preference saved.", {exact: true}).waitFor();
assert.equal(workRequests.length, beforeSave, "Disabling starts no work");
assert.equal(await toggle.isChecked(), false);
assert.equal((await configuration())?.namespaces.compaction_memory, undefined, "Disable restores older-editor compatibility");
await open();
assert.equal(await toggle.isChecked(), false);
// Exercise the shared save helper with the pre-existing switches while the
// experiment is absent. Each setting preserves the other's confirmed value.
await page.getByText("Progressive context", {exact: true}).first().click();
const progressive = page.getByRole("switch", {name: "Read context progressively"});
const delta = page.getByRole("switch", {name: "Use cross-turn delta automatically on supported hosts"});
assert.equal(await progressive.isChecked(), true);
assert.equal(await delta.isChecked(), true);
await progressive.click();
await page.getByText("Progressive reads preference saved.", {exact: true}).waitFor();
assert.equal((await configuration()).namespaces.context_delivery.mode, "off");
Expand All @@ -99,15 +84,18 @@ try {
await page.getByText("Cross-turn delta preference saved.", {exact: true}).waitFor();
assert.equal((await configuration()).namespaces.context_delivery.delta_delivery, "off");
assert.equal(await progressive.isChecked(), false);
await open();
assert.equal(await progressive.isChecked(), false);
assert.equal(await delta.isChecked(), false);
assert.equal((await configuration()).namespaces.compaction_memory, undefined);
await page.evaluate(() => localStorage.setItem("loopx-pw-locale", "zh-CN"));
await page.reload({waitUntil: "networkidle"});
await page.getByText("压缩工作记忆(实验)", {exact: true}).first().click();
assert.equal(await page.getByRole("switch", {name: "启用实验性压缩工作记忆"}).isChecked(), false);
await capture("chinese-off.png");
assert.equal(await page.getByText("压缩工作记忆(实验)", {exact: true}).count(), 0);
assert.equal(await page.getByRole("switch", {name: "启用实验性压缩工作记忆"}).count(), 0);
await capture("chinese-settings.png");
// Existing Workbench entry may create Session metadata; no Turn is dispatched.
assert.equal(workRequests.some(path => path.endsWith("/turns")), false);
console.log("compaction working memory: packaged enable/reload/stale-save/disable/Chinese readback passed");
console.log("compaction memory retirement: legacy-on hidden; sibling save/reload/stale-write recovery passed");
} finally {
await browser?.close();
if (server.exitCode === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type FieldCopy = Record<string, Readonly<{ description?: string; label: string;

const capabilityCopy: Record<WorkspaceLocale, Record<string, LocalizedCopy>> = {
en: {
compaction_memory: {displayName: "Compaction working memory (experimental)", description: "Restore source-backed work notes after context compaction."},
context_delivery: {displayName: "Progressive context", description: "Read current requirements before supporting material. Supported hosts can reuse unchanged context independently."},
codex_chat: {displayName: "Codex Goal conversation defaults", description: "Choose the native Codex profile, model, speed tier and reasoning effort for new Goal conversations. Existing conversations keep their original history. This does not start or reconfigure an active Agent Loop, worker or steward."},
decision_context: {displayName: "Find evidence", description: "Find advisory evidence with a temporary private profile. OpenViking and BM25 are retrieval implementations; this page does not save a binding or enable automatic memory."},
Expand Down Expand Up @@ -83,7 +82,6 @@ const capabilityCopy: Record<WorkspaceLocale, Record<string, LocalizedCopy>> = {
},
},
"zh-CN": {
compaction_memory: {displayName: "压缩工作记忆(实验)", description: "上下文压缩后恢复有来源的工作要点。"},
context_delivery: {displayName: "渐进上下文", description: "先展示当前目标与约束,按需读取材料;支持的宿主可独立复用跨轮上下文。"},
codex_chat: {displayName: "Codex Goal 对话默认值", description: "分别选择 Codex 配置来源、模型、速度档和推理强度,作用于本机的新 Goal 对话。已有对话保留原历史;不会启动或重配正在运行的 Agent Loop、工作 Agent 或管家。"},
decision_context: {displayName: "资料召回", description: "通过临时私有配置查找参考证据。OpenViking、BM25 是检索实现;本页不保存绑定,也不启用自动记忆。"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,33 +289,23 @@ export function MachineConfigurationSettings({ section, onChanged }: {
await saveImmediatePreference(configuration, label);
}

async function setCompactionMemory(enabled: boolean) {
if (busy || !editorAvailable || selected?.capability_id !== "compaction_memory") return;
// Removing the opt-in namespace also restores compatibility with older editors.
await saveImmediatePreference(enabled ? {...selected.default, enabled: true} : null,
locale === "zh-CN" ? "压缩工作记忆" : "Compaction working memory");
}

async function saveImmediatePreference(configuration: Record<string, unknown> | null, label: string) {
async function saveImmediatePreference(configuration: Record<string, unknown>, label: string) {
if (busy || !editorAvailable || !selected?.machine_namespace) return;
const namespace = selected.machine_namespace;
const generation = editorGeneration.current;
setBusy("apply"); setError(null); setNotice(null);
try {
const plan = configuration === null ? await previewMachineConfigurationRemoval(namespace)
: await previewMachineConfiguration(namespace, configuration);
const plan = await previewMachineConfiguration(namespace, configuration);
if (generation !== editorGeneration.current) return;
if (configuration === null) await applyMachineConfigurationRemoval(namespace, plan.plan_revision);
else await applyMachineConfiguration(namespace, configuration, plan.plan_revision);
await applyMachineConfiguration(namespace, configuration, plan.plan_revision);
if (generation !== editorGeneration.current) { onChanged?.(); return; }
setReadbackPending(selected.display_name);
const next = await fetchMachineConfiguration();
if (generation !== editorGeneration.current) return;
setInspection(next);
setReadbackPending(null);
const saved = next.machine_configuration?.namespaces[namespace];
if (next.status === "invalid" || (configuration === null ? saved !== undefined
: Object.entries(configuration).some(([key, value]) => saved?.[key] !== value))) {
if (next.status === "invalid" || Object.entries(configuration).some(([key, value]) => saved?.[key] !== value)) {
throw new Error(locale === "zh-CN" ? "保存后的配置已变化,请刷新后重试。" : "The saved configuration changed. Refresh and retry.");
}
setNotice(locale === "zh-CN" ? `${label}偏好已保存。` : `${label} preference saved.`);
Expand Down Expand Up @@ -561,18 +551,7 @@ export function MachineConfigurationSettings({ section, onChanged }: {
? "渐进读取先提供当前要求,支持材料按需展开,适用于所有宿主。跨轮差分独立控制:仅在受支持的 POSIX Codex App/SSH、benchmark 心跳已保留完整旧上下文时自动使用,否则恢复完整当前输入。关闭偏好和实验显式关闭均继续生效。保存不会安装 hook、启动实验或证明当前会话已采用差分。"
: "Progressive reads present current requirements before expandable supporting material on every host. Cross-turn delta is independent: automatic reuse requires a supported POSIX Codex App/SSH or benchmark heartbeat and complete retained context; otherwise the current full input is restored. Saved off preferences and explicit experiment opt-outs remain effective. Saving installs no hook, starts no experiment and does not prove current-session delta use."}</p></ContextHelp>
</section> : null}
{selected.capability_id === "compaction_memory" ? <section aria-label={locale === "zh-CN" ? "压缩工作记忆" : "Compaction working memory"} className="personal-capability-field-summary">
<div className="personal-capability-fields"><label className="is-boolean">
<span>{locale === "zh-CN" ? "压缩时保留工作信息" : "Keep work context at compaction"}</span>
<input aria-label={locale === "zh-CN" ? "启用实验性压缩工作记忆" : "Enable experimental compaction working memory"}
type="checkbox" role="switch" checked={selectedCurrent?.enabled === true} disabled={Boolean(busy) || !editorAvailable}
onChange={(event) => void setCompactionMemory(event.target.checked)} />
</label></div>
<ContextHelp label={locale === "zh-CN" ? "实验作用范围与关闭" : "Experiment scope and disablement"}><p>{locale === "zh-CN"
? "仅作用于本机已经支持上下文恢复的原生根会话。压缩时保留有来源的工作标题、短注记及引用,之后恢复;不增加模型调用,不安装 hook,也不省略当前必读要求。关闭会移除实验设置以支持旧版编辑器,已保存的引用仍保留。尚未验证任务效果与完整成本收益。"
: "Applies to this device's native root sessions that already support context recovery. Keeps source-bound work titles, short notes and references at compaction and restores them afterward. No additional model calls, hook installation or skipped required reads. Disabling removes the experiment setting for older editors and retains saved references. Task effectiveness and total-cost gains remain unverified."}</p></ContextHelp>
</section> : null}
{editorAvailable && selected.capability_id !== "context_delivery" && selected.capability_id !== "compaction_memory" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ? <div className="personal-capability-editor-mode">
{editorAvailable && selected.capability_id !== "context_delivery" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ? <div className="personal-capability-editor-mode">
<button disabled={Boolean(busy)} onClick={() => changeMode(editorMode === "guided" ? "json" : "guided")} type="button">
<Code2 aria-hidden size={14} />{t(editorMode === "guided" ? "machine.editJson" : "machine.backToForm")}
</button>
Expand Down Expand Up @@ -621,7 +600,7 @@ export function MachineConfigurationSettings({ section, onChanged }: {
</section>
) : null}

{editorAvailable && selected.capability_id !== "context_delivery" && selected.capability_id !== "compaction_memory" ? <footer className="personal-capability-actions">
{editorAvailable && selected.capability_id !== "context_delivery" ? <footer className="personal-capability-actions">
{configured ? <button className="is-danger" disabled={Boolean(busy)} onClick={() => void createRemovalPreview()} type="button"><Trash2 aria-hidden size={15} />{t("machine.previewRemoval")}</button> : null}
<button disabled={Boolean(busy) || !editorValid} onClick={() => void createPreview()} type="button">{busy === "preview" ? t("common.loading") : t("machine.previewChanges")}</button>
<button className="is-primary" disabled={Boolean(busy) || !preview} onClick={() => void applyPreview()} type="button">{busy === "apply" ? t("common.loading") : t("machine.applyPreview")}</button>
Expand Down
13 changes: 5 additions & 8 deletions docs/architecture/rfcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,11 @@ Paired diffs do not certify translation accuracy.
remain unqualified; no runtime, default or experiment change.
- [Sparse Working Memory at Context Compaction v0](sparse-compaction-working-memory-v0.md)
([中文版](sparse-compaction-working-memory-v0.zh-CN.md))
- **Delivery on merge:** Partial experimental implementation; independent
machine opt-in, off by default, with a Workbench switch.
- **Current boundary:** Deterministic exact selected-work notes and references,
immutable private artifacts and additive native post-compaction restoration.
Actual native model-input and packaged settings checks are recorded in the
[ledger](ledger/sparse-compaction-working-memory-v0/2026-11-17-native-kernel-and-workbench.md).
Conversation semantic extraction, broad retention, task benefit and total-cost
reduction remain unqualified; no paid/task-benefit experiment starts here.
- **Retired:** Kernel execution and Workbench activation removed after the
requester withdrew the unqualified experiment. Strict saved-settings
compatibility and existing exact capture references remain; see the
[retirement ledger](ledger/sparse-compaction-working-memory-v0/2026-11-17-retirement.md).

- [TypeScript Control-Plane Migration v0](typescript-control-plane-migration-v0.md)
([中文版](typescript-control-plane-migration-v0.zh-CN.md))
- **Delivery on `main`:** Substantially implemented; active migration.
Expand Down
9 changes: 5 additions & 4 deletions docs/architecture/rfcs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ appendix may keep dated history, but no dated log heading may precede it.

[中文版](STATUS.zh-CN.md) is the semantic mirror of this file.

## Accepted (53)
## Accepted (52)

| RFC | Header status | Supersedes / closes | Ledger |
| --- | --- | --- | --- |
Expand Down Expand Up @@ -72,7 +72,6 @@ appendix may keep dated history, but no dated log heading may precede it.
| [RFC: Shared Goal Alignment and Governed Amendment Protocol (v0)](shared-goal-alignment-and-governed-amendment-v0.md) | Accepted | none | [2 entries](ledger/shared-goal-alignment-and-governed-amendment-v0/) |
| [RFC: LoopX Shared Control-Plane Authority and Pluggable State Providers (v0)](shared-goal-authority-state-provider-v0.md) | Accepted | none | [24 entries](ledger/shared-goal-authority-state-provider-v0/) |
| [RFC: Single-Owner Local Daemon (v0)](single-owner-local-daemon-v0.md) | Accepted | none | — |
| [RFC: Sparse Working Memory at Context Compaction (v0)](sparse-compaction-working-memory-v0.md) | Accepted | none | [1 entry](ledger/sparse-compaction-working-memory-v0/) |
| [RFC: Joint Target, Yardstick and Stride Decisions (v0)](target-yardstick-stride-decisions-v0.md) | Accepted | none | — |
| [RFC: TypeScript Control-Plane Migration Direction v0](typescript-control-plane-migration-v0.md) | Accepted | none | [27 entries](ledger/typescript-control-plane-migration-v0/) |

Expand All @@ -82,6 +81,8 @@ appendix may keep dated history, but no dated log heading may precede it.
| --- | --- | --- | --- |
| [RFC: Personal Follow-through (v0)](personal-follow-through-v0.md) | Superseded | none; superseded by [Capable Agent Manager and Semantic Work Handoff](capable-manager-semantic-handoff-v0.md) | [1 entry](ledger/personal-follow-through-v0/) |

## Retired (0)
## Retired (1)

_none_
| RFC | Header status | Supersedes / closes | Ledger |
| --- | --- | --- | --- |
| [RFC: Sparse Working Memory at Context Compaction (v0)](sparse-compaction-working-memory-v0.md) | Retired | none | [2 entries](ledger/sparse-compaction-working-memory-v0/) |
Loading
Loading