[PR #2350] [MERGED] Fix default agent billing warning #5553

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2350
Author: @cha1latte
Created: 6/5/2026
Status: ✅ Merged
Merged: 6/5/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2169-agent-billing-warning


📝 Commits (2)

  • 3d9e76e Fix default agent billing warning
  • 129287f Address warning review feedback

📊 Changes

5 files changed (+350 additions, -32 deletions)

View changed files

📝 src/engine/generation/agent-runner.ts (+69 -4)
📝 src/engine/generation/generation-events.ts (+3 -0)
📝 src/engine/generation/start-generation.test.ts (+228 -1)
📝 src/engine/generation/start-generation.ts (+31 -26)
📝 src/features/runtime/generation/hooks/use-generate.ts (+19 -1)

📄 Description

Linked issue

Closes #2169

Why this change

  • Restores the legacy billing-safety warning for agents that fall back to the configured default-for-agents connection, so users are told when background agent calls may bill a paid provider.

What changed

  • Added a default_agent_connection_active warning payload while resolving agents that use connections.defaultForAgents.
  • Emits the warning as an agent_warning generation event for normal generation and manual agent retry paths.
  • Displays the warning through the generation UI toast handler.
  • Added regression coverage for the warning path and a negative control where no default-for-agents connection exists.

Refactor impact

Primary owner:

engine generation

Impact areas reviewed:

  • src/engine/generation/agent-runner.ts
  • src/engine/generation/start-generation.ts
  • src/features/runtime/generation/hooks/use-generate.ts

Boundary notes:

  • Engine owns warning construction and event emission; feature runtime only consumes the typed stream event and shows the toast. No raw Tauri or remote-runtime adapter changes.

Pressure points touched:

  • Runtime generation event handling in use-generate.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • Codex machine proof:
  • pnpm exec vitest run src/engine/generation/start-generation.test.ts passed. The regression tests prove agent_warning is emitted with default_agent_connection_active, connection name, model, and agent name for normal generation, manual agent retry, and Lorebook Keeper backfill when an agent uses the default-for-agents connection. The negative control proves no warning is emitted when no default-for-agents connection exists.
  • pnpm check passed after the final diff.
  • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json passed locally.
  • Bunny review passed locally before opening this draft.

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:

  • Bugfix restoring an existing safety warning; no new discoverable feature or workflow.

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

UI evidence

N/A. This is an event/warning restoration with provider-free machine proof; no real API call or desktop UI state is required to prove the core claim.


🔄 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/2350 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2169-agent-billing-warning` --- ### 📝 Commits (2) - [`3d9e76e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3d9e76eddc207eb159afc850fc849abf1985a190) Fix default agent billing warning - [`129287f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/129287f115f6b9e660b7f73471493fba882a69ac) Address warning review feedback ### 📊 Changes **5 files changed** (+350 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `src/engine/generation/agent-runner.ts` (+69 -4) 📝 `src/engine/generation/generation-events.ts` (+3 -0) 📝 `src/engine/generation/start-generation.test.ts` (+228 -1) 📝 `src/engine/generation/start-generation.ts` (+31 -26) 📝 `src/features/runtime/generation/hooks/use-generate.ts` (+19 -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 <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes #2169 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Restores the legacy billing-safety warning for agents that fall back to the configured default-for-agents connection, so users are told when background agent calls may bill a paid provider. ## What changed <!-- List the key changes in this PR. --> - Added a `default_agent_connection_active` warning payload while resolving agents that use `connections.defaultForAgents`. - Emits the warning as an `agent_warning` generation event for normal generation and manual agent retry paths. - Displays the warning through the generation UI toast handler. - Added regression coverage for the warning path and a negative control where no default-for-agents connection exists. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> engine generation Impact areas reviewed: - `src/engine/generation/agent-runner.ts` - `src/engine/generation/start-generation.ts` - `src/features/runtime/generation/hooks/use-generate.ts` Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - Engine owns warning construction and event emission; feature runtime only consumes the typed stream event and shows the toast. No raw Tauri or remote-runtime adapter changes. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - Runtime generation event handling in `use-generate`. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes <!-- Describe exact commands and manual steps, including typecheck/build/docs/architecture/Rust/browser/remote-runtime checks when they apply. If an AI agent filled this out, verify it yourself before ticking boxes. --> - Codex machine proof: - `pnpm exec vitest run src/engine/generation/start-generation.test.ts` passed. The regression tests prove `agent_warning` is emitted with `default_agent_connection_active`, connection name, model, and agent name for normal generation, manual agent retry, and Lorebook Keeper backfill when an agent uses the default-for-agents connection. The negative control proves no warning is emitted when no default-for-agents connection exists. - `pnpm check` passed after the final diff. - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch/bugfix-verification.json` passed locally. - Bunny review passed locally before opening this draft. ## 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: - Bugfix restoring an existing safety warning; no new discoverable feature or workflow. ## 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 ## UI evidence <!-- Add before/after screenshots or recordings for visible UI changes. --> N/A. This is an event/warning restoration with provider-free machine proof; no real API call or desktop UI state is required to prove the core claim. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:17:19 +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#5553
No description provided.