Repository navigation
fix(orchestrator): omit payment_confirmation next_step on unsuccessful payments (#460) - #609
Closed
rohanbuilds-ai wants to merge 1 commit into
Conversation
Author
|
Closing this PR because I found that #574, opened earlier by @Deez-Automations, addresses the same issue. Thank you for the prior implementation and for maintaining the project. I'll focus on distinct security improvements instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #460: Guard
next_stepinOrchestratorAgent.delegate_to_paymentsto only instruct sending apayment_confirmationnotification when the payment was actually successful (completedorsuccess).Problem
In
finbot/agents/orchestrator.py(delegate_to_payments), the orchestrator unconditionally appended anext_stepdirective to the returned delegation dictionary:When
run_payments_agentreturnedtask_status="failed"(e.g. Insufficient funds, declined card, invalid payment parameters, or retry exhaustion), this directive still told the orchestrator LLM:This actively misled the LLM into notifying the vendor of a successful payment that never occurred — creating data integrity, customer confusion, and compliance risks in a financial processing workflow.
Solution
OrchestratorAgent.delegate_to_payments:if result.get("task_status") in ("completed", "success"):before attaching thepayment_confirmationnext_step.tests/unit/agents/test_orchestrator.py.Verification & Test Evidence
Baseline Reproduction on
origin/main:Running the regression tests against unmodified
origin/mainconfirmed the bug:Post-Fix Focused Tests:
All 4 tests in
tests/unit/agents/test_orchestrator.pypass:Full Agent Suite:
Reran full
tests/unit/agents/suite: 55 passed, 15 skipped, 3 failed.test_sai_von_005_onboarding_tracking,test_sai_edge_001_invoice_agent_empty_task_data_prompt,test_sai_edge_002_vendor_agent_empty_task_data_prompt) were independently verified onorigin/mainto be pre-existing upstream issues (addressed in PR fix(agents): handle unresolvable task_data IDs #595).Formatting & Diff:
tests/unit/agents/test_orchestrator.pyis formatted withblackandisort.git diff --checkpasses with zero whitespace errors.finbot/agents/orchestrator.pyandtests/unit/agents/test_orchestrator.py.