Clear stale subagent lineage on top-level sessions#67946
Clear stale subagent lineage on top-level sessions#67946pfrederiksen wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes issue #67943 by preventing regular top-level sessions from inheriting stale subagent lineage metadata ( Confidence Score: 5/5Safe to merge — targeted fix with a clear regression test and no collateral risk. All three changed files are narrowly scoped: the production changes gate stale lineage fields behind a well-tested predicate, the test converts a static mock to a spy and adds a regression case that directly covers the bug scenario. No P0/P1 findings. No files require special attention. Reviews (1): Last reviewed commit: "clear stale subagent lineage on top-leve..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f772863cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Good catch. I narrowed the cleanup so it only clears stale subagent lineage fields, while preserving for normal thread sessions that have already forked from their parent. Re-pushed. |
|
CI is green now, this is ready to merge. ✅ |
|
Codex review: needs maintainer review before merge. What this changes: The PR gates persisted subagent lineage fields to subagent/ACP session keys, stops top-level agent runs from reusing stale Maintainer follow-up before merge: This is an existing contributor PR that appears correct but needs maintainer handling for the dirty merge state and normal landing judgment, not a separate automated replacement PR. Security review: Security review cleared: The diff only changes session lineage handling and a focused test; it does not touch dependencies, CI workflows, secrets, package metadata, downloads, or other supply-chain surfaces. Review detailsBest possible solution: Rebase or otherwise resolve the dirty merge state, rerun the changed checks, then land this narrow lineage-gating fix if the diff remains limited to the session-state and agent-attempt paths plus focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes. A high-confidence code-level reproduction is to seed a normal top-level session entry with stale Is this the best way to solve the issue? Yes, after resolving merge conflicts. The PR uses the existing session-key classifiers to preserve lineage for real subagent/ACP sessions while clearing it for ordinary top-level sessions, and it avoids the earlier fork-marker regression by preserving Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 7969f1f07ccc. |
f3d2367 to
9b21e1a
Compare
|
Resolved the review concerns. I rebuilt the branch on current I also dropped the unrelated changes called out in review:
The PR diff is now limited to the stale top-level spawn-lineage fix plus focused regression coverage in:
Validation run locally:
|
Fixes #67943.
Summary
Prevents normal top-level sessions from inheriting stale subagent lineage metadata that can incorrectly trip
sessions_spawndepth limits.What changed
subagent:*andacp:*sessionssessionEntry.spawnedByfor normal top-level agent runsValidation
npm test -- --run src/agents/agent-command.live-model-switch.test.ts