Skip to content

fix: preserve orchestrator task history metadata on resume#5942

Merged
kevinvandijk merged 4 commits intoKilo-Org:mainfrom
Githubguy132010:fix/orchestrator-task-history-resume
Feb 21, 2026
Merged

fix: preserve orchestrator task history metadata on resume#5942
kevinvandijk merged 4 commits intoKilo-Org:mainfrom
Githubguy132010:fix/orchestrator-task-history-resume

Conversation

@Githubguy132010
Copy link
Copy Markdown
Contributor

@Githubguy132010 Githubguy132010 commented Feb 17, 2026

Fixes #5933

Context

Fixes an orchestrator regression where resumed tasks could lose existing history metadata, causing follow-up lookups to fail with Task with ID ... not found in history.

Implementation

  • Updated addHistoryItemForResume in packages/agent-runtime/src/host/ExtensionHost.ts to merge with an existing history item instead of replacing it.
  • Preserved richer metadata (lineage/delegation/status/cache fields) and only applied resume bootstrap fields conservatively when values are missing/invalid.
  • Added a regression test in packages/agent-runtime/src/host/__tests__/ExtensionHost.addHistoryItemForResume.spec.ts that verifies existing orchestration metadata is retained.
  • Added a patch changeset at .changeset/quiet-camels-share.md.

Screenshots

before after
N/A N/A

How to Test

  • From packages/agent-runtime, run:
    • pnpm test src/host/__tests__/ExtensionHost.addHistoryItemForResume.spec.ts
  • Confirm the test passes and verifies lineage/delegation metadata is preserved after resume pre-seeding.

Get in Touch

thomas07374

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: cbb5f5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kilo-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Feb 21, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR fixes resumed agent runtime orchestrator tasks so that previous task history is preserved. The key change is in addHistoryItemForResume which now uses a spread-then-override pattern (...(existingItem || {})) to preserve all existing fields (including orchestrator lineage metadata like rootTaskId, parentTaskId, childIds, status, etc.) while providing type-validated defaults for known fields.

Highlights:

  • Defensive type validation helpers (getExistingNumber, getExistingString, getExistingBoolean) ensure data integrity
  • .slice() prevents mutation of the original task history array
  • The spread pattern correctly preserves fields not explicitly listed (e.g., toolProtocol, apiConfigName)
  • Good test coverage for the merge-with-existing-item path
Files Reviewed (3 files)
  • .changeset/quiet-camels-share.md - Changeset for patch release
  • packages/agent-runtime/src/host/ExtensionHost.ts - Core logic change to preserve history on resume
  • packages/agent-runtime/src/host/__tests__/ExtensionHost.addHistoryItemForResume.spec.ts - New test for merge behavior

Copy link
Copy Markdown
Contributor

@kevinvandijk kevinvandijk left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Orchestrator task(s) ID (to/from other agent modes) not found

2 participants