Repository navigation
feat(recall): link an OMP subagent's session to its parent for adoption - #935
Conversation
OMP gives a subagent a session of its own, so a recall the teamai-recall subagent ran never credited the main agent's later reads. OMP writes a subagent's session to <parent>/<agent id>.jsonl beside the parent's <parent>.jsonl, whose header names the parent session. The generated extension now reads that header on a session's first tool_result and sends the session_link the OpenCode plugin already sends, so the reducer credits the root session. A session kept only in memory has no file and still gets no link.
…ked (PR review) A session was marked as looked up before its parent was found, so a parent session file not yet on disk lost the link for the whole session. Also: skill-data troubleshooting lists OMP's subagent path, the docs name the no-link case (--no-session), a row shows a linked subagent's own read still scores 0, and the header read limit is named.
|
@jeff-r2026 The |
|
No findings.
|
| | Cursor | Yes | No: as for Copilot CLI | | ||
| | OpenCode | Yes | Yes: the `task` call links the subagent's session to its parent | | ||
| | OMP | Yes, settled only by the claim of its `bash` call | No: the subagent's session is not linked to its parent | | ||
| | OMP | Yes, settled only by the claim of its `bash` call | Yes (unverified): the subagent's session file sits under its parent's, whose header links the two sessions | |
There was a problem hiding this comment.
Could you please verified this?
There was a problem hiding this comment.
Thanks, you were right to ask: it did not work in a real session. OMP writes a padded title slot line before the session header, so the lookup read {"type":"title",…} and never linked a subagent. The harness wrote a file headed by the session line, a layout OMP never writes, so the tests passed anyway. Against the 59 real subagent session files on my machine (OMP 18.2.1), the old lookup linked 0.
Fixed in 3ed4c24: the lookup skips the title slot, and the harness now writes it, which makes both positive rows fail against def8e28. Verified in a live OMP 18.4.8 session: the teamai-recall subagent recalled, the main agent read the doc, and the recall log got a link line. teamai stats shows adopted 1; with the old lookup the same session gave 0. The row now reads "verified against OMP 18.4.8". Details are in the PR description.
… (PR review) OMP writes a padded title slot line before the session header, so the parent lookup parsed the title line and never linked a subagent. The test harness now writes OMP's real layout; verified in a live OMP 18.4.8 session.
|
No findings.
|
Summary
On OMP, a doc the main agent opens after the
teamai-recallsubagent recalled it is now upvoted. OMP gives every subagent a session of its own, and nothing linked that session to its parent. So on OMP the subagent path, the one we recommend, gave 0. This is the "OMP's parent link" follow-up from #925.OMP has no API that returns a subagent's parent session, but its session files record it:
tool_result (generated OMP extension) payload = { tool_name, tool_input, tool_response, tool_status } + until this session is linked: + parent = id of the session header of <dirname(getSessionFile())>.jsonl (the line after the title slot) + if parent: payload.session_link = { child: session_id, parent }; mark linked hook-dispatch post-tool-use --tool omp Stop (main session) reducer: runs and reads of every session linked up to the root (unchanged, as for OpenCode)The recall log, the reducer and the stats are unchanged. OMP now sends the same
session_linkthe OpenCode plugin sends for ataskcall. The usage guides (EN and zh-CN) andskill-data/core/references/troubleshooting.mdnow list OMP's subagent path as supported, verified against OMP 18.4.8.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest runpasses: 358 files, 6658 passed, 1 skipped (withCLAUDE_CONFIG_DIRunset:self-mode-agentsreads it from the environment)npm run test:e2epasses: 64 files, 394 passed, 26 skippedBefore / after (live OMP session). OMP 18.4.8 (
openai-codex/gpt-6.1-sol), in a temp HOME with a localgitteam holding one learning (redis-timeout) and recall enabled.teamai pullfrom this branch's build deployed~/.omp/agent/agents/teamai-recall.mdand~/.omp/agent/extensions/teamai-hooks.ts;teamaionPATHran the same build. One prompt:The model delegated, the subagent ran
teamai recall --caller teamai-recall, and the main agent read~/.teamai/learnings/redis-timeout.md. "Before" is the same session with the deployed extension's lookup reverted to this PR's previous revision (header read from line 1); nothing else changed.linklines in the recall logchild= subagent session,parent= main session)teamai statsadoptedNew rows in
src/__tests__/recall-attribution.test.ts. The harness writes OMP's session files as OMP 18.2.1 and 18.4.8 write them (title slot line, then the session header) and handsgetSessionFileto the extension:Both failing rows failed against def8e28 once the harness wrote the title slot.
Related Issues
Follow-up to #925 (#884).
Notes for Reviewers
Merge Danger
Door: two-way. The change touches only the generated extension. Reverting it and running
teamai pullregenerates the old extension. Link lines already in the recall log stay valid, and upvotes already cast stay as ordinary counts.Blast Radius: OMP hooks. Until a session is linked, each of its
tool_resultevents tries to open its parent's session file and read up to 64 KiB of it. For a subagent that happens once, as soon as the parent's file is on disk. A main session has no parent file, so each of its calls costs one failedopen(ENOENT). Every failure is swallowed, so the result is at worst no link, which is how OMP behaved before. Other agents are untouched.Where to look:
parentSessionOfinsrc/omp-hooks.ts. It relies on OMP's on-disk layout, not on a public API: the artifacts dir beside the parent's file (task/executor.ts), and the title slot before the session header (session/session-manager.ts,#fileBody). If OMP changes either, the link disappears silently and adoption falls back to 0. AparentSessionfield in OMP's session header would replace this, so an upstream request is worth making.Review follow-ups.
skill-data/core/references/troubleshooting.mdstill listed OMP as main-agent-only. Updated.--no-session). Reworded in both guides.HEADER_READ_BYTES), and the bridge no longer repeats the recorder'schild !== parentcheck.