[PR #1236] [CLOSED] fix: Centralize agent debug mode diagnostics [Issue #1157] #4994

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1236
Author: @Promansis
Created: 5/26/2026
Status: ❌ Closed

Base: refactor ← Head: fix/debug-mode-contract


📝 Commits (1)

  • fc59cf0 Centralize agent debug mode diagnostics

📊 Changes

7 files changed (+152 additions, -84 deletions)

View changed files

➕ src/engine/agents-runtime/debug.test.ts (+58 -0)
➕ src/engine/agents-runtime/debug.ts (+50 -0)
📝 src/engine/agents-runtime/executor/agent-executor.ts (+8 -43)
📝 src/engine/agents-runtime/knowledge/knowledge-router.ts (+26 -11)
📝 src/engine/agents-runtime/pipeline/agent-pipeline.ts (+7 -27)
📝 src/engine/contracts/types/agent.ts (+2 -2)
📝 src/features/shell/settings/components/SettingsPanel.tsx (+1 -1)

📄 Description

Linked issue

Closes #1157

Why this change

  • Debug Mode's user-facing contract and runtime behavior had drifted between in-app panel diagnostics and scattered console logging helpers.
  • Agent runtime diagnostics should have one engine-owned path so console output and structured debug panel entries are gated consistently by Debug Mode.

What changed

  • Added a small src/engine/agents-runtime/debug.ts helper that owns agent runtime diagnostic gating.
  • Routed agent executor, pipeline, and knowledge-router debug output through the shared helper.
  • Added focused tests proving Debug Mode off emits neither console nor structured debug entries, and Debug Mode on emits both.
  • Updated the AgentContext comments and settings copy so the documented contract matches the implementation.

Refactor impact

Primary owner:

engine agent runtime

Impact areas reviewed:

  • Agent executor diagnostics
  • Agent pipeline diagnostics
  • Knowledge-router diagnostics
  • AgentContext debug contract
  • Settings Debug Mode copy
  • Runtime generation hook wiring for debugMode / debugSink

Boundary notes:

  • Behavior remains inside src/engine/agents-runtime.
  • React settings code only updates user-facing copy.
  • No shared API, Tauri, Rust, storage, or remote-runtime boundary changes.
  • Engine code still depends only on engine contracts and engine-local helpers.

Pressure points touched:

  • None of ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs, or import modules were touched.

Validation

  • pnpm check passes locally
  • 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
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • In Settings, confirm Debug mode copy says it shows the in-app agent debug panel and emits console diagnostics.
  • With Debug mode off, run a generation path that uses agents and confirm the Agent Debug panel does not appear.
  • With Debug mode on, run the same generation path and confirm the Agent Debug panel appears with prompt/response/tool/result details.
  • With Debug mode on, confirm browser/Tauri console receives agent runtime diagnostic output.
  • Toggle Debug mode off again, run another agent generation, and confirm new agent diagnostics stop appearing in both the panel and console.

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

Notes:

  • No docs changes needed; the user-facing Debug Mode settings copy was updated in place.
  • This PR does not restore old staging/package-workspace/release claims.

UI evidence

  • No before/after screenshots or recordings added.

🔄 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/1236 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 5/26/2026 **Status:** ❌ Closed **Base:** `refactor` ← **Head:** `fix/debug-mode-contract` --- ### 📝 Commits (1) - [`fc59cf0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc59cf0d1b3457e564bb1f2257f3cf093f69a490) Centralize agent debug mode diagnostics ### 📊 Changes **7 files changed** (+152 additions, -84 deletions) <details> <summary>View changed files</summary> ➕ `src/engine/agents-runtime/debug.test.ts` (+58 -0) ➕ `src/engine/agents-runtime/debug.ts` (+50 -0) 📝 `src/engine/agents-runtime/executor/agent-executor.ts` (+8 -43) 📝 `src/engine/agents-runtime/knowledge/knowledge-router.ts` (+26 -11) 📝 `src/engine/agents-runtime/pipeline/agent-pipeline.ts` (+7 -27) 📝 `src/engine/contracts/types/agent.ts` (+2 -2) 📝 `src/features/shell/settings/components/SettingsPanel.tsx` (+1 -1) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1157 ## Why this change - Debug Mode's user-facing contract and runtime behavior had drifted between in-app panel diagnostics and scattered console logging helpers. - Agent runtime diagnostics should have one engine-owned path so console output and structured debug panel entries are gated consistently by Debug Mode. ## What changed - Added a small `src/engine/agents-runtime/debug.ts` helper that owns agent runtime diagnostic gating. - Routed agent executor, pipeline, and knowledge-router debug output through the shared helper. - Added focused tests proving Debug Mode off emits neither console nor structured debug entries, and Debug Mode on emits both. - Updated the `AgentContext` comments and settings copy so the documented contract matches the implementation. ## Refactor impact Primary owner: engine agent runtime Impact areas reviewed: - Agent executor diagnostics - Agent pipeline diagnostics - Knowledge-router diagnostics - `AgentContext` debug contract - Settings Debug Mode copy - Runtime generation hook wiring for `debugMode` / `debugSink` Boundary notes: - Behavior remains inside `src/engine/agents-runtime`. - React settings code only updates user-facing copy. - No shared API, Tauri, Rust, storage, or remote-runtime boundary changes. - Engine code still depends only on engine contracts and engine-local helpers. Pressure points touched: - None of `ModeSurface`, `GameSurface`, shared mode UI, `src-tauri/src/lib.rs`, or import modules were touched. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [ ] `pnpm check` passes locally - [ ] `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 - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - In Settings, confirm Debug mode copy says it shows the in-app agent debug panel and emits console diagnostics. - With Debug mode off, run a generation path that uses agents and confirm the Agent Debug panel does not appear. - With Debug mode on, run the same generation path and confirm the Agent Debug panel appears with prompt/response/tool/result details. - With Debug mode on, confirm browser/Tauri console receives agent runtime diagnostic output. - Toggle Debug mode off again, run another agent generation, and confirm new agent diagnostics stop appearing in both the panel and console. ## 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 Notes: - No docs changes needed; the user-facing Debug Mode settings copy was updated in place. - This PR does not restore old staging/package-workspace/release claims. ## UI evidence - No before/after screenshots or recordings added. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:12:18 +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#4994
No description provided.