Skip to content

Deliver downloadable text files in local Goal replies - #9321

Open
loopx-agent wants to merge 2 commits into
mainfrom
codex/local-goal-reply-documents
Open

loopx-agent wants to merge 2 commits into
mainfrom
codex/local-goal-reply-documents

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

User outcome

A first Goal requesting a Markdown file could finish with an answer naming the file and no download. A valid file from the local Codex provider now appears on its original reply. Owners can download it immediately or reopen the conversation to retrieve the same version after the workspace file changes.

Implementation

Local managed Codex Goal turns accept inline UTF-8 Markdown and plain-text documents in the existing response envelope. The adapter keeps the ordinary turn guard and consumes the bytes the provider supplies. The attachment validator checks the file type, name, byte count, text encoding, existing four-file and 64,000-byte limits, and protected local paths before publication. The completed message owns the bytes. The live conversation and recovered stream use its stored identity and the same document renderer as reopened history. Invalid data produces a visible delivery failure while preserving the answer.

Validation

  • An empty disposable Goal registry and a project containing a synthetic release checklist exercised the packaged workbench, real Chat service and SQLite with a deterministic local Codex protocol fixture.
  • Ego Lite followed the first Goal from confirmation to its original conversation. Both downloads were named release-checklist.md and matched all 89 source bytes, including BOM, CRLF, Chinese characters and trailing whitespace. Replacing the source between downloads preserved the original result.
  • A mismatched byte count produced an unavailable-file message and left the previous download intact. A corrected subsequent reply displayed the current document in the open conversation and downloaded its changed bytes.
  • 390 targeted Python tests passed across the native document, session, privacy, manager return and Lark boundary suites. The packaged frontend build, conversation history regression, bilingual RFC check and repository pre-merge validation passed on the submitted head.
  • A disposable integration of this head with Show the first request in the steward conversation #9315 and Recover the first Goal confirmation and open its conversation #9316 also passed the uninterrupted first-use path. From the default home, send the request, confirm the read-only draft, open the original conversation from its card and download the file. Reopening the same reply returned the original bytes after the source changed.
  • This run covers a packaged candidate with a controlled executor. Installed distribution, model-generated files and independent first-time users remain separate acceptance checkpoints.

Visual evidence

Reference 9d451cadf1 and candidate ed69644178 show the original reply with the same synthetic provider input. The candidate file control displays its name, byte count and download action.

Desktop

Reference 1280 px

Candidate 1280 px

Narrow

Reference 390 px

Candidate 390 px

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

在本地托管 Codex Goal 首轮请求下载 Markdown 或纯文本的用户。 目标确实启动且原对话有答复,基线仍缺可下载的文件。 让原回复携带用户请求的原始文本文件。替换工作区文件后,原回复仍可下载当时的版本。

从无 Goal 的两套打包工作台确认同一只读目标,随后进入其首轮对话,以同一份含 BOM、CRLF、中文和尾部空格的 57 字节 fixture 对照。 基线原回复有文本而无下载。候选原回复带文件名、字节数和下载 action。修改工作区同名文件后刷新原地址,第二次下载仍逐字节相同。 独立证据使用合成 Codex 协议 peer 和合成项目。真实模型生成附件质量、安装后的分发和远端 CI 留待独立验证。

改动思路 / Approach

在 owner_goal 的本地 managed Codex Web Turn 中接受内联文档,按原答复的 Session 与 Turn 持久化并渲染。 已有回复、附件格式和下载组件足以提供原版本读回。本地 Chat 从 provider 的内联数据取字节,避免新增从回复解析文件路径的读取入口。 由已有文本校验器处理数据,持久化完成消息承担附件的身份,现有对话视图展示来源绑定的下载。

具体改动 / Changes

12 个文件,+201/−26。 提交 ed696441787d12a69b62f5d8282df2688aa5151e,基线 9c0942be2b72381d0ff53131965d83ca736ac7ed。 验收依据

  • 原回复保存确切文件(implemented)。基线原回复有文本而无下载。候选原回复带文件名、字节数和下载 action。修改工作区同名文件后刷新原地址,第二次下载仍逐字节相同。
  • 本地路径与坏附件(implemented)。模拟 provider 返回含受保护本机路径或错误字节数的文件,两轮都保留答复并显示交付失败,原下载仍在。下一轮有效文件在同一会话提供新版本。

关键代码讲解

  • local_goal_reply_route。在原只读约束下对符合条件的本地 Goal 打开内联文档。 代码
  • normalize_reply_documents。复用文本附件和 envelope 校验,并核对受保护路径。 代码
  • finalize_managed_turn_completion。用同一 Session/Turn 的完成消息写入已校验附件。 代码
  • managedReplyDocuments。只从匹配的完成消息接纳已缓存的文本 data URL。 代码

对主干的风险 / Risks

模拟 provider 返回含受保护本机路径或错误字节数的文件,两轮都保留答复并显示交付失败,原下载仍在。下一轮有效文件在同一会话提供新版本。 两端真实启动首轮 Codex 协议 Turn 且使用同一 readOnly 沙箱。只有候选提供内联文件指令并持久化附件。 确认与原会话路由均来自实际本地工作台。基线测试是 GitHub 当前目标基线,分叉点在 d588d27。

语义与 CI 对齐

绑定的项目与管家会话、附接宿主、非 Codex 及 peer 入口由原路由保留。定向测试覆盖这些拒绝和原文档输入校验。 基线 22 项、候选 34 项定向 HTTP 用例通过。两端打包构建和候选会话读回测试通过。标准 premerge 结果为 passed,直接检查 6 项(失败 0),选中检查 16 项(失败 0)。

我的整体评价 / Verdict

同意此提交。原回复的下载和回读、失败提示及同一会话恢复均通过。 桌面和 390 px 都在原回复内显示文件名、57 B 与下载链接,可见答复仍随附件呈现。 本次目检覆盖文件卡和下载,既有正文展开及安装版界面未另行目检。

English verdict: APPROVE at ed69644. The first local Goal reply preserves byte-identical downloads on reopen. Protected paths and invalid files are rejected, and a later valid reply can still attach the revised file.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant