Skip to content

fix: test kv flake with rephrase and chatcontext - #1403

Merged
AngeloDanducci merged 1 commit into
generative-computing:mainfrom
AngeloDanducci:ad-398
Jul 17, 2026
Merged

fix: test kv flake with rephrase and chatcontext#1403
AngeloDanducci merged 1 commit into
generative-computing:mainfrom
AngeloDanducci:ad-398

Conversation

@AngeloDanducci

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #398

Description

Rephrases prompt and uses chatcontext to fix test_kv flake.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.

Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
@AngeloDanducci
AngeloDanducci requested a review from a team as a code owner July 16, 2026 17:34
@github-actions github-actions Bot added the bug Something isn't working label Jul 16, 2026

@markstur markstur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test named test_kv that doesn't validate that a kv is used in any way does bother me a little :)
See my inline comment. It might be a rant, but hopefully it's cool. Intended to share thoughts. I hope I'm not off base.

I think this is a solid improvement to merge as-is. Probably no action to take on my inline comment unless you feel like commenting what the test really does/doesn't do. It's kind of an odd test that just happened to run into privacy issues. Will be nice to have it pass and exercise more of the code it's supposed to exercise.

Comment thread test/stdlib/test_spans.py
model_options=dict(),
)
result = await response.avalue()
assert "314" in result, f"Expected correct answer (314 main st) but found: {result}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this test really tests anything useful other than call that function (which would otherwise lack tests). So personally I'd probably just comment out the assert -- or check for that perfectly valid safety refusal (or either, or any successful call, or whatever). The result doesn't really matter. This is just touching some lines of code and I think the safety message touches all the same code.

That said, I'll approve your approach if you think this is the best way to fix the issue at hand. Less flakey is more good. 👍

Also if the misleading test is really just for code coverage and not kv cache testing with validation, well you are significantly improving that with the ChatContext. It's touching more code and more KV-related code.


It could use a comment explaining why it says test_kv but doesn't actually test kv use. I know this isn't the scope of your issue but...

I cannot vouch for how accurate this is, but my bot explains it this way:

"This test validates that the KV-cache API endpoint works correctly. The 'spans' name refers to KV cache spanning multiple generation calls, but this test only validates a single call. True multi-call KV cache reuse testing is blocked by a Granite 4.1 compatibility issue."

@AngeloDanducci
AngeloDanducci added this pull request to the merge queue Jul 17, 2026
Merged via the queue into generative-computing:main with commit ce2435b Jul 17, 2026
8 checks passed
@AngeloDanducci
AngeloDanducci deleted the ad-398 branch July 17, 2026 16:01
psschwei pushed a commit to psschwei/mellea that referenced this pull request Jul 17, 2026
…#1403)

Signed-off-by: AngeloDanducci <angelo.danducci.ii@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: test_kv Flaky Due to Model Safety Refusal

2 participants