Skip to content

LCORE-2661: Automatic conversation expiration: the stub#2021

Merged
tisnik merged 8 commits into
lightspeed-core:mainfrom
tisnik:lcore-2661-the-stub
Jun 29, 2026
Merged

LCORE-2661: Automatic conversation expiration: the stub#2021
tisnik merged 8 commits into
lightspeed-core:mainfrom
tisnik:lcore-2661-the-stub

Conversation

@tisnik

@tisnik tisnik commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

LCORE-2661: Automatic conversation expiration: the stub

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement
  • Spike

Tools used to create PR

  • Assisted-by: N/A
  • Generated by: N/A

Related Tickets & Documents

  • Related Issue #LCORE-2661

Summary by CodeRabbit

  • Documentation

    • Added design documentation for automatic conversation expiration, including goals, requirements, use cases, and architecture notes.
    • Added a spike document outlining an approach for expiring idle conversations after a configurable time limit.
  • Chores

    • Improved version handling in OpenAPI schema generation to consistently treat version values as text.
    • Updated a test step registration to avoid a type-checking warning.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@tisnik, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d4e32d3d-b44f-4f1b-ab5b-27bd551989c7

📥 Commits

Reviewing files that changed from the base of the PR and between 7ad968f and 0672ae5.

📒 Files selected for processing (2)
  • docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md
  • docs/design/automatic-conversation-expiration/automatic-conversation-expiration.md

Walkthrough

Adds two design documents for automatic conversation expiration (a spike and a feature design template). Also fixes a type coercion (str()) on the OpenAPI version value and adds a # type: ignore[reportCallIssue] comment to an e2e test step decorator.

Changes

Automatic Conversation Expiration Docs and Minor Fixes

Layer / File(s) Summary
Conversation expiration design docs
docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md, docs/design/automatic-conversation-expiration/automatic-conversation-expiration.md
Adds a spike document describing a runner-based TTL deletion approach and a feature design template with placeholder sections.
Script and test type fixes
scripts/generate_openapi_schema.py, tests/e2e/features/steps/common.py
Coerces info["version"] to str in read_version_from_openapi, adds -> str annotation to read_version_from_pyproject, and suppresses a type-checker warning on a Behave step decorator.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR's main theme: introducing automatic conversation expiration as a spike/stub for LCORE-2661.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tisnik tisnik force-pushed the lcore-2661-the-stub branch 3 times, most recently from 7ad968f to 9876b24 Compare June 29, 2026 08:22
@tisnik tisnik force-pushed the lcore-2661-the-stub branch from 9876b24 to 0672ae5 Compare June 29, 2026 08:23

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md`:
- Around line 14-17: Update the recommendation text to fix the grammar and
wording: change the runner description so it “identifies” idle conversations and
rephrase the TTL sentence to say it exceeds the defined duration or has been
idle longer than the defined duration. Also clarify which deletion flow should
be reused by explicitly referencing the appropriate “delete conversation” API
implementation and its semantics, since v1 and v2 differ; use the same behavior
as the intended endpoint in the expiration runner description.

In
`@docs/design/automatic-conversation-expiration/automatic-conversation-expiration.md`:
- Around line 14-23: The table of contents nesting is incorrect because the
Architecture subitems are rendered as top-level entries instead of children.
Regenerate the TOC in the markdown document so that Trigger mechanism and
Storage / data model changes are properly nested under Architecture, matching
the heading hierarchy used in the document.
- Line 10: The Links entry points to an incorrect spike doc path, so update the
reference in the automatic-conversation-expiration design document to match the
actual location of the spike file. Verify the intended target and replace the
current `docs/automatic-conversation-expiration` link with the correct path used
by the repository, keeping the link text consistent with the existing “Spike
doc” reference.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5c636c3c-a87d-4f3b-b53e-a0333bdcc558

📥 Commits

Reviewing files that changed from the base of the PR and between 7649229 and 7ad968f.

📒 Files selected for processing (4)
  • docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md
  • docs/design/automatic-conversation-expiration/automatic-conversation-expiration.md
  • scripts/generate_openapi_schema.py
  • tests/e2e/features/steps/common.py
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
  • GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
🧰 Additional context used
📓 Path-based instructions (2)
tests/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Use pytest.mark.asyncio marker for async tests

Files:

  • tests/e2e/features/steps/common.py
tests/e2e/**/*.{py,feature}

📄 CodeRabbit inference engine (AGENTS.md)

Use behave (BDD) framework for end-to-end testing with Gherkin feature files

Files:

  • tests/e2e/features/steps/common.py
🧠 Learnings (3)
📚 Learning: 2026-04-07T09:20:26.590Z
Learnt from: radofuchs
Repo: lightspeed-core/lightspeed-stack PR: 1467
File: tests/e2e/features/steps/common.py:36-49
Timestamp: 2026-04-07T09:20:26.590Z
Learning: For Behave-based Python tests, rely on Behave’s Context layered stack for attribute lifecycle: Behave pushes a new Context layer when entering feature scope (before_feature) and again for scenario scope (before_scenario). Attributes assigned inside given/when/then steps live on the current scenario layer and are automatically removed when the scenario ends. As a result, step-set attributes should not be expected to persist across scenarios or features, and manual cleanup in after_scenario/after_feature is generally unnecessary for attributes set in step functions. Only perform manual cleanup for attributes that you set explicitly in before_feature/before_scenario, since those live on the respective feature/scenario layers.

Applied to files:

  • tests/e2e/features/steps/common.py
📚 Learning: 2026-04-13T13:39:54.963Z
Learnt from: radofuchs
Repo: lightspeed-core/lightspeed-stack PR: 1490
File: tests/e2e/features/environment.py:206-211
Timestamp: 2026-04-13T13:39:54.963Z
Learning: In lightspeed-stack E2E tests under tests/e2e/features, it is intentional to set context.feature_config inside Background/step functions (scenario-scoped Behave layer). The environment.py after_scenario restore logic should only restore configuration when context.scenario_lightspeed_override_active is True; this flag is set by configure_service only when a real config switch occurs (so restore does not run for scenarios without a switch). Additionally, steps/common.py’s module-level _active_lightspeed_stack_config_basename is used to prevent re-applying the same config across subsequent scenarios, ensuring scenario_lightspeed_override_active stays False after the first apply. Therefore, reviewers should not “fix” this flow as if feature_config were incorrectly scoped or if after_scenario restoration is missing—config switching and restoration are meant to happen exactly once per actual switch, not redundantly per scenario.

Applied to files:

  • tests/e2e/features/steps/common.py
📚 Learning: 2026-06-24T13:45:37.249Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 1971
File: src/utils/markdown_repair.py:31-36
Timestamp: 2026-06-24T13:45:37.249Z
Learning: In the lightspeed-stack repository, docstrings must use the section header name "Parameters:" (not "Args:") for function arguments, even if the project references Google Python docstring conventions. Ensure docstrings follow the project’s established "Parameters:" header format for any documented function parameters.

Applied to files:

  • tests/e2e/features/steps/common.py
  • scripts/generate_openapi_schema.py
🔇 Additional comments (2)
scripts/generate_openapi_schema.py (1)

40-43: LGTM!

tests/e2e/features/steps/common.py (1)

82-82: LGTM!

Comment on lines +14 to +17
**The recommendation**: Implement a new runner that identify idle conversations
and if their time to live (TTL) is longer than defined duration, the
conversation will be deleted using the same code that is implemented in "delete
conversation" REST API endpoint.

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Grammar and clarity issues in the recommendation.

Two issues in this sentence:

  1. Subject-verb agreement: "a new runner that identify" → "identifies".
  2. Awkward phrasing: "if their time to live (TTL) is longer than defined duration" → "if their TTL exceeds the defined duration" or "if they have been idle longer than the defined duration".

Additionally, there are two different "delete conversation" REST API implementations (v1 and v2) with different deletion semantics. Please clarify which endpoint's code the expiration runner should reuse, or if it needs to handle both local DB and remote Llama Stack deletion like v1, or just cache deletion like v2.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md`
around lines 14 - 17, Update the recommendation text to fix the grammar and
wording: change the runner description so it “identifies” idle conversations and
rephrase the TTL sentence to say it exceeds the defined duration or has been
idle longer than the defined duration. Also clarify which deletion flow should
be reused by explicitly referencing the appropriate “delete conversation” API
implementation and its semantics, since v1 and v2 differ; use the same behavior
as the intended endpoint in the expiration runner description.

| **Authors** | Pavel Tišnovský |
| **Feature** | [LCORE-1475](https://redhat.atlassian.net/browse/LCORE-1475) |
| **Spike** | [LCORE-2661](https://redhat.atlassian.net/browse/LCORE-2661) |
| **Links** | Spike doc: `docs/automatic-conversation-expiration` |

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Incorrect spike document path.

The referenced path docs/automatic-conversation-expiration does not match the actual file location. Based on the repository structure, this should likely be docs/design/automatic-conversation-expiration/automatic-conversation-expiration-spike.md or similar. Please verify and correct the link.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/design/automatic-conversation-expiration/automatic-conversation-expiration.md`
at line 10, The Links entry points to an incorrect spike doc path, so update the
reference in the automatic-conversation-expiration design document to match the
actual location of the spike file. Verify the intended target and replace the
current `docs/automatic-conversation-expiration` link with the correct path used
by the repository, keeping the link text consistent with the existing “Spike
doc” reference.

@tisnik tisnik merged commit 8733dfe into lightspeed-core:main Jun 29, 2026
35 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant