[PR #1818] [MERGED] Fix agent run legacy cadence parity #5290

Closed
opened 2026-10-22 04:14:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1818
Author: @Xelvanis
Created: 6/1/2026
Status: ✅ Merged
Merged: 6/1/2026
Merged by: @Xelvanis

Base: refactor ← Head: issue-1791-agent-runs-cadence-parity


📝 Commits (3)

  • 696dbad Fix agent run legacy cadence parity
  • 1dbf0f5 Refresh PR checks
  • 370d37e Address agent run review findings

📊 Changes

9 files changed (+790 additions, -59 deletions)

View changed files

📝 src-tauri/src/commands/storage/agents.rs (+287 -31)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+73 -3)
📝 src-tauri/src/commands/storage/shared.rs (+148 -0)
📝 src-tauri/src/state.rs (+110 -1)
📝 src/engine/generation/agent-runner.ts (+23 -9)
📝 src/engine/generation/start-generation.ts (+7 -3)
📝 src/features/catalog/agents/hooks/use-agents.ts (+122 -5)
📝 src/features/modes/shared/chat-ui/components/EchoChamberPanel.tsx (+18 -5)
📝 src/features/modes/shared/chat-ui/lib/echo-chamber-messages.ts (+2 -2)

📄 Description

Linked issue

Closes #1791

Why this change

  • Restores legacy/refactor parity for persisted agent run history so imported or pre-normalized agent_runs rows continue to drive cadence, echo messages, custom run review, and lorebook-keeper backfill behavior.

What changed

  • Normalized legacy snake_case agent run fields during profile import and app startup, including config metadata, timestamps, result payloads, numeric counters, and boolean success values.
  • Updated Rust agent run commands to read current and legacy row shapes when calculating cadence, clearing runs, and deleting echo messages.
  • Updated TypeScript generation/runtime readers so automatic interval gates, lorebook-keeper backfill, custom run UI, and echo UI understand both camelCase and snake_case agent run rows.
  • Added focused Rust coverage for legacy agent-run import, startup normalization, cadence defaults, success filtering, and config-id matching.

Refactor impact

Primary owner:

Rust storage/imports and engine generation.

Impact areas reviewed:

  • agent-runs storage shape and query filters
  • legacy profile import
  • app startup storage migration
  • built-in/custom agent cadence
  • custom agent run UI
  • echo chamber persisted-message UI
  • lorebook-keeper backfill gating

Boundary notes:

  • Engine code stays React-free and only reads through the existing storage gateway.
  • Feature code still uses storageApi; no new raw Tauri imports.
  • Rust behavior stays inside storage command/import/shared helpers; no command registration or remote-runtime allowlist changes.

Pressure points touched:

  • Import modules: legacy profile import normalization.
  • Shared mode UI: echo chamber persisted run loading only.
  • No ModeSurface, GameSurface, or src-tauri/src/lib.rs command registration changes.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • pnpm check passes locally before PR push/handoff, including the unused-code check
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Manual verification notes

Commands run locally:

  • cargo test --manifest-path src-tauri\Cargo.toml cadence_status --lib
  • cargo test --manifest-path src-tauri\Cargo.toml legacy_agent_runs_import_with_config_metadata --lib
  • cargo test --manifest-path src-tauri\Cargo.toml app_state_startup_normalizes_legacy_agent_run_rows --lib
  • pnpm typecheck
  • cargo check --manifest-path src-tauri\Cargo.toml
  • pnpm check:architecture
  • git diff --check
  • pnpm check

Manual Tauri app QA was not run.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Compatibility bugfix for existing agent run behavior; no new discoverable feature.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs changes needed; this restores existing behavior and compatibility.

UI evidence

No screenshots. UI impact is data compatibility for existing agent-run panels rather than a visible layout change.

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced data migration and normalization of legacy agent configurations and run records during app startup
    • Improved backward compatibility with agent data from previous application versions
    • Better handling of field name variations in stored agent records to ensure consistent data access

🔄 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/1818 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `issue-1791-agent-runs-cadence-parity` --- ### 📝 Commits (3) - [`696dbad`](https://github.com/Pasta-Devs/Marinara-Engine/commit/696dbad7821eb5c4db960a858efc29f93cfba0d7) Fix agent run legacy cadence parity - [`1dbf0f5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1dbf0f57cbf4adba97c240ec69c78b7db315848c) Refresh PR checks - [`370d37e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/370d37ebb0e6f8b45fd62faf4b398f9a7ca261dd) Address agent run review findings ### 📊 Changes **9 files changed** (+790 additions, -59 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/agents.rs` (+287 -31) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+73 -3) 📝 `src-tauri/src/commands/storage/shared.rs` (+148 -0) 📝 `src-tauri/src/state.rs` (+110 -1) 📝 `src/engine/generation/agent-runner.ts` (+23 -9) 📝 `src/engine/generation/start-generation.ts` (+7 -3) 📝 `src/features/catalog/agents/hooks/use-agents.ts` (+122 -5) 📝 `src/features/modes/shared/chat-ui/components/EchoChamberPanel.tsx` (+18 -5) 📝 `src/features/modes/shared/chat-ui/lib/echo-chamber-messages.ts` (+2 -2) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep validation checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1791 ## Why this change - Restores legacy/refactor parity for persisted agent run history so imported or pre-normalized `agent_runs` rows continue to drive cadence, echo messages, custom run review, and lorebook-keeper backfill behavior. ## What changed - Normalized legacy snake_case agent run fields during profile import and app startup, including config metadata, timestamps, result payloads, numeric counters, and boolean success values. - Updated Rust agent run commands to read current and legacy row shapes when calculating cadence, clearing runs, and deleting echo messages. - Updated TypeScript generation/runtime readers so automatic interval gates, lorebook-keeper backfill, custom run UI, and echo UI understand both camelCase and snake_case agent run rows. - Added focused Rust coverage for legacy agent-run import, startup normalization, cadence defaults, success filtering, and config-id matching. ## Refactor impact Primary owner: Rust storage/imports and engine generation. Impact areas reviewed: - `agent-runs` storage shape and query filters - legacy profile import - app startup storage migration - built-in/custom agent cadence - custom agent run UI - echo chamber persisted-message UI - lorebook-keeper backfill gating Boundary notes: - Engine code stays React-free and only reads through the existing storage gateway. - Feature code still uses `storageApi`; no new raw Tauri imports. - Rust behavior stays inside storage command/import/shared helpers; no command registration or remote-runtime allowlist changes. Pressure points touched: - Import modules: legacy profile import normalization. - Shared mode UI: echo chamber persisted run loading only. - No `ModeSurface`, `GameSurface`, or `src-tauri/src/lib.rs` command registration changes. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] `pnpm check` passes locally before PR push/handoff, including the unused-code check - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Commands run locally: - `cargo test --manifest-path src-tauri\Cargo.toml cadence_status --lib` - `cargo test --manifest-path src-tauri\Cargo.toml legacy_agent_runs_import_with_config_metadata --lib` - `cargo test --manifest-path src-tauri\Cargo.toml app_state_startup_normalizes_legacy_agent_run_rows --lib` - `pnpm typecheck` - `cargo check --manifest-path src-tauri\Cargo.toml` - `pnpm check:architecture` - `git diff --check` - `pnpm check` Manual Tauri app QA was not run. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Compatibility bugfix for existing agent run behavior; no new discoverable feature. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs changes needed; this restores existing behavior and compatibility. ## UI evidence No screenshots. UI impact is data compatibility for existing agent-run panels rather than a visible layout change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Chores** * Enhanced data migration and normalization of legacy agent configurations and run records during app startup * Improved backward compatibility with agent data from previous application versions * Better handling of field name variations in stored agent records to ensure consistent data access <!-- 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-22 04:14:57 +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#5290
No description provided.