mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 11:00:09 +08:00
Importing a current Codex session gave the learner a message they never wrote — a 4KB catalogue of uninstalled plugins — and a session titled with the first line of it (#1354, follow-up to #1327). Codex delivers its own context to the model as `role: "user"` items. Across the 631 rollouts on this machine that is ten distinct tags — `environment_context`, `recommended_plugins`, `codex_internal_context`, `skill`, `task`, `heartbeat`, `turn_aborted`, `subagent_notification`, `codex_delegation`, `send_user_message_question_reply` — and about a third of every user turn on disk. Matching the tags would fix today and nothing after it: the list is the harness's to grow, and a new one walks straight through. What the injected turns share is a shape, not a name — each is *nothing but* markup, one or more balanced top-level elements with no prose of the person's own anywhere around them. So `isHarnessInjectedTurn` consumes top-level elements and keeps the turn the moment a single character of anything else remains. Erring that way is not caution for its own sake, it is the common case: an attachment turn arrives as `<image name=[Image #1]></image>` followed by the actual question, 76 of them here, and every one is kept because the question sits outside the element. Anything ambiguous — a same-named nested tag, an unclosed one, an attribute holding a `>` — falls out of the loop unmatched and is kept too. Losing a title to a block we failed to recognise is a blemish; eating the sentence someone typed is not. Known to under-catch, deliberately: 181 turns pair the plugin catalogue with an injected `# AGENTS.md instructions for <path>` in plain markdown, which has no shape to recognise and would need the literal string. Those still import. The legacy `event_msg` path is untouched — it carries none of this (zero such turns in the corpus), and the tests pin the `<image>` prefix and an unclosed tag as the two cases that must survive.