Conversation
…ing-test Motivation: KEPLOY_AGENT_OWNS_CONSUMED (experimental, default OFF) and --retry-passing-test are mutually incompatible. --retry-passing-test re-runs passing tests in extra cycles, rewinding the CLI's own totalConsumedMocks map to a baseline at the top of every cycle so per-test single-use mocks consumed in cycle 1 are servable again in cycle 2. When the flag is set, the CLI instead sends the agent a nil map and lets it filter from its own consumedPersistent history, which is only ever appended to and has no rewind point anywhere in its lifecycle. Every retry cycle is therefore filtered against everything every prior cycle consumed, so any single-use mock a retried test needs is already marked gone. It fails as an ordinary mock mismatch (match_phase=no_mocks) rather than as an error naming the real cause. Approach: Stand the flag down whenever RetryPassing is set, in SendMockFilterParamsToAgent (pkg/service/replay/replay.go). This is the smaller of the two fix shapes the report lays out - the CLI keeps using its own rewindable map instead of handing filtering to the agent for the duration of a retry-passing run. The larger shape (give the agent an equivalent rewind primitive so the flag can stay on under RetryPassing) is left for a follow-up; this only removes the silent breakage. Validation: - go test ./pkg/service/replay/... -run TestSendMockFilterParamsStandsDownAgentOwnsConsumedUnderRetryPassing -v fails on the pre-fix code and passes after this change (confirmed by stashing just replay.go and re-running). - go test ./pkg/service/replay/... (full package) passes. - go build ./... passes. - gofmt -l -d on both changed files: clean. - golangci-lint run ./pkg/service/replay/...: 0 issues. Report: keploy#4622 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5 (via Claude Code)
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
|
The CLA check failed. Please ensure you have:
After fixing these issues, comment 'recheck' to trigger the workflow again. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review comments; regression coverage is included.
Review effort: Lite
Findings: None
What changed in this PR
Fixes replay failures when KEPLOY_AGENT_OWNS_CONSUMED is used with --retry-passing-test.
Changes:
- Disables agent-owned consumption during retry-passing mode.
- Adds regression coverage while preserving normal behavior.
| File | Summary |
|---|---|
pkg/service/replay/replay.go |
Applies the retry compatibility guard. |
pkg/service/replay/agent_holds_stored_mocks_test.go |
Adds regression coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Review for PR #4623: Stand down Concurrency & Fallback Behavior
|
|
The debug log is already in this PR. When |
Describe the changes that are made
KEPLOY_AGENT_OWNS_CONSUMED(experimental, default OFF) and--retry-passing-testare mutuallyincompatible:
--retry-passing-testrewinds the CLI's own consumed-mock map to a baseline betweenretry cycles so per-test single-use mocks are servable again, but the agent's own consumption history
(used when the flag is set) is never rewound anywhere. Under the flag, a retry cycle is filtered
against everything the previous cycle consumed and every single-use mock the retry needs is already
marked gone, failing as an ordinary mock mismatch. This change makes
KEPLOY_AGENT_OWNS_CONSUMEDstand down whenever
--retry-passing-testis active, so the CLI's rewindable map is the one enforcedinstead — the smaller of the two fix shapes the issue proposes (the larger one gives the agent its own
rewind primitive, which is a bigger change left for later).
Links & References
Closes: #4622
🔗 Related PRs
🐞 Related Issues
📄 Related Documents
What type of PR is this? (check all applicable)
Added e2e test pipeline?
Added comments for hard-to-understand areas?
Added to documentation?
Are there any sample code or steps to test the changes?
go test ./pkg/service/replay/... -run TestSendMockFilterParamsStandsDownAgentOwnsConsumedUnderRetryPassing -vfails on the pre-fix code and passes after this change (verified with
git stashof justreplay.go).Self Review done?
Any relevant screenshots, recordings or logs?
🧠 Semantics for PR Title & Branch Name
Please ensure your PR title and branch name follow the Keploy semantics:
📌 PR Semantics Guide
📌 Branch Semantics Guide
Examples:
fix: patch MongoDB document update bugfeat/#1-login-flow(You may skip mentioning the issue number in the branch name if the change is small and the PR description clearly explains it.)Additional checklist:
AI assistance: this change was drafted with Claude Code.
Fixes #4622