[PR #4265] [MERGED] feat: expose chat branch lineage to agents #6309

Closed
opened 2026-10-23 04:09:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4265
Author: @Promansis
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/capability-chat-branch-lineage


📝 Commits (4)

  • 72bc073 feat: expose chat branch lineage to agents
  • 960d3b7 fix: preserve immediate branch lineage
  • 8a49526 Merge branch 'staging' into feat/capability-chat-branch-lineage
  • 7dd789f Merge branch 'staging' into feat/capability-chat-branch-lineage

📊 Changes

12 files changed (+260 additions, -12 deletions)

View changed files

📝 docs/chats/branches.md (+4 -0)
📝 docs/development/optional-agent-packages.md (+21 -0)
📝 package.json (+1 -1)
📝 packages/server/src/routes/backup.routes.ts (+16 -0)
📝 packages/server/src/routes/chats.routes.ts (+12 -5)
📝 packages/server/src/services/capability-packages/capability-persistence.service.ts (+43 -0)
📝 packages/server/src/services/import/st-chat.importer.ts (+3 -0)
📝 packages/shared/src/schemas/capability-package.schema.ts (+1 -1)
📝 packages/shared/src/types/capability-runtime.ts (+6 -0)
📝 packages/shared/src/types/chat.ts (+8 -0)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+5 -5)
➕ scripts/regressions/chat-branch-lineage.regression.ts (+140 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #4264

Why this change

Capability agents can read chat records but cannot reliably identify branch lineage or the message boundary where a branch was created. This blocks lineage-aware agent workflows and would otherwise force packages to depend on Engine-specific storage metadata.

What changed

  • Exposes normalized branch title and immediate parent/fork message IDs on CapabilityChatRecord.
  • Persists lineage for Engine-created branches, including empty branches and branches created from branches.
  • Removes installation-specific lineage IDs from generic exports, backups, and imported metadata.
  • Bumps the supported Capability API from 1.6 to 1.7.
  • Documents the contract and adds chat branch lineage regression coverage.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Automated regression coverage was added but has not been run in this PR preparation step.
  • Browser, container, and manual edge-case verification remain for the human contributor.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable; this change has no UI surface.

Summary by CodeRabbit

  • New Features
    • Exposed chat branch lineage metadata for capability API 1.7, including parent/child anchors and fork context (including nested branches).
  • Bug Fixes
    • Improved normalization and sanitization of branch metadata during export/import, including safer handling of missing game journal data.
    • Ensured lineage behavior remains consistent when copying and when parent chats are deleted.
  • Documentation
    • Expanded guidance on branch lineage rules, deletion behavior, and summary carryover/omissions.
  • Tests
    • Added regression coverage for branching, persistence, sanitization, and API compatibility (1.7).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4265 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 7/29/2026 **Status:** ✅ Merged **Merged:** 7/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/capability-chat-branch-lineage` --- ### 📝 Commits (4) - [`72bc073`](https://github.com/Pasta-Devs/Marinara-Engine/commit/72bc0732989d34856fae1b4e094e4662f59f2483) feat: expose chat branch lineage to agents - [`960d3b7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/960d3b7a78d76ea332370caa695e24a23c4deada) fix: preserve immediate branch lineage - [`8a49526`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8a495262e7372e179aedc99763a091512fadf96b) Merge branch 'staging' into feat/capability-chat-branch-lineage - [`7dd789f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7dd789fa57e8b79caa7cfa71c161e022c0690a3b) Merge branch 'staging' into feat/capability-chat-branch-lineage ### 📊 Changes **12 files changed** (+260 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `docs/chats/branches.md` (+4 -0) 📝 `docs/development/optional-agent-packages.md` (+21 -0) 📝 `package.json` (+1 -1) 📝 `packages/server/src/routes/backup.routes.ts` (+16 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+12 -5) 📝 `packages/server/src/services/capability-packages/capability-persistence.service.ts` (+43 -0) 📝 `packages/server/src/services/import/st-chat.importer.ts` (+3 -0) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+1 -1) 📝 `packages/shared/src/types/capability-runtime.ts` (+6 -0) 📝 `packages/shared/src/types/chat.ts` (+8 -0) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+5 -5) ➕ `scripts/regressions/chat-branch-lineage.regression.ts` (+140 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #4264 ## Why this change Capability agents can read chat records but cannot reliably identify branch lineage or the message boundary where a branch was created. This blocks lineage-aware agent workflows and would otherwise force packages to depend on Engine-specific storage metadata. ## What changed - Exposes normalized branch title and immediate parent/fork message IDs on `CapabilityChatRecord`. - Persists lineage for Engine-created branches, including empty branches and branches created from branches. - Removes installation-specific lineage IDs from generic exports, backups, and imported metadata. - Bumps the supported Capability API from 1.6 to 1.7. - Documents the contract and adds chat branch lineage regression coverage. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Automated regression coverage was added but has not been run in this PR preparation step. - Browser, container, and manual edge-case verification remain for the human contributor. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [x] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable; this change has no UI surface. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Exposed chat branch lineage metadata for capability API **1.7**, including parent/child anchors and fork context (including nested branches). * **Bug Fixes** * Improved normalization and sanitization of branch metadata during export/import, including safer handling of missing game journal data. * Ensured lineage behavior remains consistent when copying and when parent chats are deleted. * **Documentation** * Expanded guidance on branch lineage rules, deletion behavior, and summary carryover/omissions. * **Tests** * Added regression coverage for branching, persistence, sanitization, and API compatibility (**1.7**). <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:11 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6309
No description provided.