Context-area files and repoMap freeze after the first turn

未关闭
#683 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
clojure

调研方向

Start with eca.features.chat/prompt and the eca-chat--send-prompt entry point named in the issue; use the described mock-LLM test to trace how context-area files and repoMap reach each turn. Check the prompt-cache signature and the context-change notice as well. Done means current contexts are sent as proposed without duplicating prompt chips, pinned instructions remain pinned, and docs/features.md is corrected.

由索引模型根据 Issue 内容生成。

描述

bug

Summary

The context area is the line above the prompt. The editor sends its items in contexts.
ECA renders :file and :repoMap contexts into the system prompt.
ECA pins this prompt (keeps it fixed for the whole chat) unless chat.autoSyncSystemPrompt is true. The default is false.
So after turn 1, the model does not see changes to these contexts.

Expected: the model sees the current context area on every turn.

Bugs

Reproduced on master (3cf9b05) with a test that calls eca.features.chat/prompt and a mock LLM. Default config, unless stated.

  1. New context is never sent. Add b.txt or repoMap to the context area after turn 1. The model never gets it. Typing @repoMap in the prompt does not help: the server parses only @/, @~ and @. paths from the text.
  2. Edited file keeps old content. Edit a.txt after turn 1. ECA keeps sending the old text. Its block says "Treat as current and accurate".
  3. Removed file stays. Remove a.txt from the context area. ECA still sends it in every request.
  4. Prompt chip is sent twice. eca-emacs also sends @file items from the prompt text (chips) in contexts (eca-chat--send-prompt, since eca-emacs 6f8d5ef). The server cannot tell them from context-area items. The model gets the file in the user message and in the system prompt. The system prompt copy stays for the rest of the chat. Other clients: not checked.
  5. Notice is vague and repeats. ECA shows "System prompt changed (contexts), keeping current chat system prompt...". It does not say that the attached file is not sent. With bug 4 it shows again and again, because chips come and go.
  6. repoMap goes stale with no warning. The cache signature stores only :present for repoMap (to avoid git ls-files on every cache hit). A changed file tree is never detected, also with autoSyncSystemPrompt: true. The agent creates and renames files, so the map is soon wrong.

Root cause

:file and :repoMap are in static-prompt-context-types. This is the same pinned block as AGENTS.md and the rules. Pinning is right for instructions. It is wrong for data that changes.

Workaround

Set chat.autoSyncSystemPrompt: true. It fixes bugs 1 to 3. But each change then breaks the prompt cache (the provider's stored copy of the processed prompt). With bug 4, each prompt chip breaks it twice: when the chip appears, and on the next turn. Bugs 4 and 6 stay. For bug 6, /sync-system-prompt refreshes the map by hand.

Proposal

Send :file and :repoMap in the user message, after the user text. The cursor already works this way (#464).

  • Send the content once, when it is new.
  • If it changes later, send one line. The model reads it again with its tools.
  • If the user removes it, send nothing.
  • Skip a path that the prompt text already expands with @path. Prompt @ stays as it is.
  • Keep AGENTS.md and the rules in the pinned system prompt.
  • Fix the text "one-time only context" in docs/features.md.

NOTE: It might make sense to get rid of '@' in the context area completely. But I think that these are good reasons to keep it:

  1. It stays attached. The client sends the context-area list on every message until you remove an item. A prompt @ works for one message only.
  2. It can stay current (after the fix). ECA sends a short "file changed" line. A prompt @ is a snapshot (a copy from one moment). To refresh it, you mention the file again, and the full file enters the history again. Today this point is the bug.
  3. It survives /compact (the command that summarizes old messages). Prompt @ text is gone after /compact, and only the summary stays. I know this from the code, not from a run.
主要语言
Clojure
星标
1k
派生
82
平均合并
1 天 21 小时
30 天内合并 PR
25

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

editor-code-assistant/eca 的其他 Issue

查看 editor-code-assistant/eca 的全部 Issue

相似的 Issue

更多 Clojure Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。