From 5d29f26325d64449bc1fcd09657494accbaa11fb Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Wed, 4 Nov 2026 23:14:47 +0800 Subject: [PATCH 1/6] fix(context): separate progressive presentation from native delta Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../capability-localization.ts | 12 +- .../machine-configuration-settings.tsx | 34 +-- loopx/capabilities/configuration_ui.py | 11 +- .../machine_configuration/context_delivery.py | 16 +- loopx/cli_commands/context_machine.py | 32 ++- loopx/cli_commands/quota.py | 26 ++- loopx/cli_commands/quota_capture.py | 50 ++++- loopx/cli_commands/quota_registration.py | 6 +- .../cli_commands/support_control_heartbeat.py | 1 + .../support_control_heartbeat_registration.py | 6 +- .../heartbeat/bootstrap_prompt.py | 3 +- loopx/control_plane/heartbeat/builder.py | 25 ++- .../quota/native_context_lifecycle.ts | 33 +++ .../quota/progressive_context.ts | 69 +++++- loopx/control_plane/quota/turn_envelope.py | 15 +- loopx/control_plane/quota/turn_envelope.ts | 8 +- .../turn_driver/codex_context.py | 82 ++++++-- .../turn_driver/decision_capture.py | 21 ++ .../turn_driver/native_context_selection.py | 75 +++++++ scripts/codex_app_apply_rrule.py | 1 + scripts/external_scheduler_worker.py | 1 + scripts/qualify-native-goal-release.py | 1 + .../test_codex_context_lifecycle.py | 4 +- .../test_context_delivery_cli.py | 3 +- .../test_context_machine_configuration.py | 10 +- .../test_heartbeat_envelope_transport.py | 22 +- .../test_progressive_context_entrypoints.py | 196 ++++++++++++++++++ .../test_progressive_native_context.py | 5 +- tests/test_codex_app_apply_rrule.py | 21 ++ tests/test_external_scheduler_worker.py | 13 ++ 30 files changed, 700 insertions(+), 102 deletions(-) create mode 100644 loopx/control_plane/turn_driver/native_context_selection.py create mode 100644 tests/control_plane/test_progressive_context_entrypoints.py diff --git a/apps/presentation/dashboard/src/features/personal-workspace/capability-localization.ts b/apps/presentation/dashboard/src/features/personal-workspace/capability-localization.ts index 26f86233b8..e7145d34c3 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/capability-localization.ts +++ b/apps/presentation/dashboard/src/features/personal-workspace/capability-localization.ts @@ -12,7 +12,7 @@ type FieldCopy = Record> = { en: { - context_delivery: {displayName: "Differential context", description: "Reuse unchanged context across supported Agent turns. A missing retained baseline keeps the full context."}, + 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."}, content_ops: {displayName: "Content production", description: "Prepare source-backed outlines, compose local videos or generate cloud images and footage with the optional media provider. Review the result before sharing."}, @@ -82,7 +82,7 @@ const capabilityCopy: Record> = { }, }, "zh-CN": { - context_delivery: {displayName: "差分上下文", description: "在支持的 Agent 轮次间复用未变化的上下文;无法确认基线保留时使用完整上下文。"}, + context_delivery: {displayName: "渐进上下文", description: "先展示当前目标与约束,按需读取材料;支持的宿主可独立复用跨轮上下文。"}, codex_chat: {displayName: "Codex Goal 对话默认值", description: "分别选择 Codex 配置来源、模型、速度档和推理强度,作用于本机的新 Goal 对话。已有对话保留原历史;不会启动或重配正在运行的 Agent Loop、工作 Agent 或管家。"}, decision_context: {displayName: "资料召回", description: "通过临时私有配置查找参考证据。OpenViking、BM25 是检索实现;本页不保存绑定,也不启用自动记忆。"}, content_ops: {displayName: "内容制作", description: "准备有来源的提纲,使用可选媒体扩展制作本机视频、生成云端图像与镜头,检查作品后再分享。"}, @@ -247,9 +247,13 @@ export function localizeCapability( export function localizedCapabilityFieldCopy(locale: WorkspaceLocale, capabilityId?: string): FieldCopy { if (capabilityId === "context_delivery") return {...fieldCopy[locale], mode: locale === "zh-CN" ? { - label: "Codex", description: "仅作用于支持的 Codex 心跳;显式关闭的实验保持关闭。", options: {off: "关闭", on: "开启"}, + label: "渐进读取", description: "适用于各宿主;关闭后保留完整内联输入。", options: {off: "关闭", on: "开启"}, } : { - label: "Codex", description: "Applies only to supported Codex heartbeats; explicitly disabled runs stay disabled.", options: {off: "Off", on: "On"}, + label: "Progressive reads", description: "Applies across hosts; off keeps full inline input.", options: {off: "Off", on: "On"}, + }, delta_delivery: locale === "zh-CN" ? { + label: "跨轮差分", description: "仅在支持连续性的宿主自动启用;可独立关闭,保留渐进读取。", options: {off: "关闭", auto: "自动"}, + } : { + label: "Cross-Turn Delta", description: "Automatic only on supported continuity hosts; off preserves progressive reads.", options: {off: "Off", auto: "Automatic"}, }, antigravity_mode: locale === "zh-CN" ? { label: "Antigravity", description: "仅作用于强能力 Antigravity 管家的交付历史渐进读取;关闭时保持完整内联。", options: {off: "关闭", on: "开启"}, } : { diff --git a/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx b/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx index 0f18eeb462..7aa426d34f 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/machine-configuration-settings.tsx @@ -279,7 +279,7 @@ export function MachineConfigurationSettings({ section, onChanged }: { setNotice(null); } - async function setContextDelivery(mode: "off" | "on", key: "mode" | "antigravity_mode" = "mode") { + async function setContextDelivery(mode: "off" | "on" | "auto", key: "mode" | "delta_delivery" | "antigravity_mode" = "mode") { if (busy || !editorAvailable || selected?.capability_id !== "context_delivery" || !selected.machine_namespace) return; const namespace = selected.machine_namespace; const configuration = {...selected.default, ...selectedCurrent, [key]: mode}; @@ -298,8 +298,10 @@ export function MachineConfigurationSettings({ section, onChanged }: { if (next.machine_configuration?.namespaces[namespace]?.[key] !== mode) { throw new Error(locale === "zh-CN" ? "保存后的配置已变化,请刷新后重试。" : "The saved configuration changed. Refresh and retry."); } - const targetLabel = key === "antigravity_mode" ? "Antigravity" : "Codex"; - setNotice(locale === "zh-CN" ? `${targetLabel} 偏好已保存。` : `${targetLabel} preference saved.`); + const targetLabel = key === "antigravity_mode" ? "Antigravity" : key === "delta_delivery" + ? locale === "zh-CN" ? "跨轮差分" : "Cross-turn delta" + : locale === "zh-CN" ? "渐进读取" : "Progressive reads"; + setNotice(locale === "zh-CN" ? `${targetLabel}偏好已保存。` : `${targetLabel} preference saved.`); onChanged?.(); } catch (cause) { if (generation === editorGeneration.current) setError(cause instanceof Error ? cause.message : t("machine.applyError")); @@ -526,12 +528,17 @@ export function MachineConfigurationSettings({ section, onChanged }: { ) : null} - {selected.capability_id === "context_delivery" ?
+ {selected.capability_id === "context_delivery" ?

{(selectedCurrent?.mode ?? selected.default?.mode) === "on" ? selectedCurrent - ? locale === "zh-CN" ? "已开启;原生初始化与实际使用尚未验证。" : "On; native setup and use unverified." - : locale === "zh-CN" ? "默认开启;原生初始化与实际使用尚未验证。" : "Default on; native setup and use unverified." - : locale === "zh-CN" ? "Codex 已关闭。" : "Off for Codex."}

+ ? locale === "zh-CN" ? "渐进读取已开启。" : "Progressive reads are on." + : locale === "zh-CN" ? "渐进读取默认开启。" : "Progressive reads default on." + : locale === "zh-CN" ? "渐进读取已关闭。" : "Progressive reads are off."}

+

{(selectedCurrent?.delta_delivery ?? selected.default?.delta_delivery ?? "auto") === "auto" + ? locale === "zh-CN" ? "跨轮差分自动选择;当前会话是否采用尚未验证。" : "Delta is automatic; current-session use is unverified." + : locale === "zh-CN" ? "跨轮差分已关闭。" : "Cross-turn delta is off."}

{(selectedCurrent?.antigravity_mode ?? selected.default?.antigravity_mode ?? "on") === "on" ? locale === "zh-CN" ? "Antigravity 管家历史渐进读取已开启。" : "Antigravity progressive manager history is on." : locale === "zh-CN" ? "Antigravity 已关闭。" : "Off for Antigravity."}

-

{locale === "zh-CN" - ? "Codex(mode)与 Antigravity(antigravity_mode)独立控制:受支持的 POSIX Codex App/SSH 和 benchmark 心跳默认开启差分,已保存的关闭继续生效,benchmark trial 可单独显式关闭;强能力 Antigravity 管家默认开启私有快照的交付历史渐进读取,关闭时保持完整内联。其他应用和平台保留完整交付;显式开启遇到未知或冲突跑法会报错。保存偏好不代表当前会话已采用差分。宿主就绪且旧上下文完整时才使用差分,否则完整恢复;私有存储与会话隔离自动管理。" - : "Codex (mode) and Antigravity (antigravity_mode) are controlled independently: supported POSIX Codex App/SSH and benchmark heartbeats default on (saved off is preserved; benchmark trials can disable it independently), while trusted-owner Antigravity manager turns default on for progressive private-capture history reads and keep full inline input when off. Other applications and platforms retain full delivery. Explicit on rejects unknown or conflicting modes. Saving a preference does not establish current-session adoption. Delta needs a ready host and complete retained context; otherwise full context is restored. Private storage and session isolation are automatic."}

+

{locale === "zh-CN" + ? "渐进读取先提供当前要求,支持材料按需展开,适用于所有宿主。跨轮差分独立控制:仅在受支持的 POSIX Codex App/SSH、benchmark 心跳已保留完整旧上下文时自动使用,否则恢复完整当前输入。Antigravity 管家历史另有独立开关。关闭偏好和实验显式关闭均继续生效。保存不会安装 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. Antigravity manager history has its own switch. 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."}

: null} {editorAvailable && selected.capability_id !== "context_delivery" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ?
-

{(selectedCurrent?.mode ?? selected.default?.mode) === "on" - ? selectedCurrent - ? locale === "zh-CN" ? "渐进读取已开启。" : "Progressive reads are on." - : locale === "zh-CN" ? "渐进读取默认开启。" : "Progressive reads default on." - : locale === "zh-CN" ? "渐进读取已关闭。" : "Progressive reads are off."}

-

{(selectedCurrent?.delta_delivery ?? selected.default?.delta_delivery ?? "auto") === "auto" - ? locale === "zh-CN" ? "跨轮差分自动选择;当前会话是否采用尚未验证。" : "Delta is automatic; current-session use is unverified." - : locale === "zh-CN" ? "跨轮差分已关闭。" : "Cross-turn delta is off."}

-

{(selectedCurrent?.antigravity_mode ?? selected.default?.antigravity_mode ?? "on") === "on" - ? locale === "zh-CN" ? "Antigravity 管家历史渐进读取已开启。" : "Antigravity progressive manager history is on." - : locale === "zh-CN" ? "Antigravity 已关闭。" : "Off for Antigravity."}

{locale === "zh-CN" - ? "渐进读取先提供当前要求,支持材料按需展开,适用于所有宿主。跨轮差分独立控制:仅在受支持的 POSIX Codex App/SSH、benchmark 心跳已保留完整旧上下文时自动使用,否则恢复完整当前输入。Antigravity 管家历史另有独立开关。关闭偏好和实验显式关闭均继续生效。保存不会安装 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. Antigravity manager history has its own switch. 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."}

+ ? "渐进读取先提供当前要求,支持材料按需展开,适用于所有宿主。跨轮差分独立控制:仅在受支持的 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."}

: null} {editorAvailable && selected.capability_id !== "context_delivery" ? <>{editorMode === "json" || !selected.configuration_editor.fields.some((field) => field.key === "enabled" && field.input_kind === "boolean") ?