-
Notifications
You must be signed in to change notification settings - Fork 101
LCORE-2230: behave step definitions for the conversation-compaction feature #2612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: Lightspeed Core Service (LCS) | ||
| service: | ||
| host: 0.0.0.0 | ||
| port: 8080 | ||
| auth_enabled: false | ||
| workers: 1 | ||
| color_log: true | ||
| access_log: true | ||
| ogx: | ||
| # Library mode - embeds OGX as library | ||
| use_as_library_client: true | ||
| # Unified mode: run.yaml (materialized per provider by CI/the harness) | ||
| # is consumed as the synthesis profile instead of the legacy two-file path. | ||
| config: | ||
| profile: run.yaml | ||
| user_data_collection: | ||
| feedback_enabled: true | ||
| feedback_storage: "/tmp/data/feedback" | ||
| transcripts_enabled: true | ||
| transcripts_storage: "/tmp/data/transcripts" | ||
| authentication: | ||
| module: "noop" | ||
| inference: | ||
| default_provider: openai | ||
| default_model: gpt-4o-mini | ||
| # Compaction e2e (LCORE-1673): a deliberately small window for the CI | ||
| # model so a three-turn conversation crosses the trigger threshold. | ||
| # The real model window is far larger; this only drives the local | ||
| # estimate, never the provider. | ||
| context_windows: | ||
| openai/gpt-4o-mini: 2000 | ||
| rag: | ||
| byok: | ||
| stores: | ||
| - rag_id: e2e-test-docs | ||
| backend: faiss | ||
| embedding_model: sentence-transformers/all-mpnet-base-v2 | ||
| embedding_dimension: 768 | ||
| vector_db_id: ${env.FAISS_VECTOR_STORE_ID} | ||
| db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db} | ||
| score_multiplier: 1.0 | ||
| retrieval: | ||
| tool: | ||
| sources: | ||
| - e2e-test-docs | ||
|
|
||
| shields: | ||
| - name: pii-redaction | ||
| provider_id: redaction | ||
| config: | ||
| rules: | ||
| - pattern: '\d+' | ||
| replacement: '[NUM]' | ||
|
|
||
| # Same small window and threshold as lightspeed-stack-compaction.yaml, but | ||
| # compaction switched off: context_status must stay "full" past the | ||
| # threshold (enabled is a full off-switch). | ||
| compaction: | ||
| enabled: false | ||
| threshold_ratio: 0.1 | ||
| token_floor: 100 | ||
| buffer_turns: 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| name: Lightspeed Core Service (LCS) | ||
| service: | ||
| host: 0.0.0.0 | ||
| port: 8080 | ||
| auth_enabled: false | ||
| workers: 1 | ||
| color_log: true | ||
| access_log: true | ||
| ogx: | ||
| # Library mode - embeds OGX as library | ||
| use_as_library_client: true | ||
| # Unified mode: run.yaml (materialized per provider by CI/the harness) | ||
| # is consumed as the synthesis profile instead of the legacy two-file path. | ||
| config: | ||
| profile: run.yaml | ||
| user_data_collection: | ||
| feedback_enabled: true | ||
| feedback_storage: "/tmp/data/feedback" | ||
| transcripts_enabled: true | ||
| transcripts_storage: "/tmp/data/transcripts" | ||
| authentication: | ||
| module: "noop" | ||
| inference: | ||
| default_provider: openai | ||
| default_model: gpt-4o-mini | ||
| # Compaction e2e (LCORE-1673): a deliberately small window for the CI | ||
| # model so a three-turn conversation crosses the trigger threshold. | ||
| # The real model window is far larger; this only drives the local | ||
| # estimate, never the provider. | ||
| context_windows: | ||
| openai/gpt-4o-mini: 2000 | ||
| rag: | ||
| byok: | ||
| stores: | ||
| - rag_id: e2e-test-docs | ||
| backend: faiss | ||
| embedding_model: sentence-transformers/all-mpnet-base-v2 | ||
| embedding_dimension: 768 | ||
| vector_db_id: ${env.FAISS_VECTOR_STORE_ID} | ||
| db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db} | ||
| score_multiplier: 1.0 | ||
| retrieval: | ||
| tool: | ||
| sources: | ||
| - e2e-test-docs | ||
|
|
||
| shields: | ||
| - name: pii-redaction | ||
| provider_id: redaction | ||
| config: | ||
| rules: | ||
| - pattern: '\d+' | ||
| replacement: '[NUM]' | ||
|
|
||
| # Compaction on with a low threshold: 10% of the 2000-token window, | ||
| # above a 100-token floor, keeping one recent turn verbatim. | ||
| compaction: | ||
| enabled: true | ||
| threshold_ratio: 0.1 | ||
| token_floor: 100 | ||
| buffer_turns: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Lightspeed Core Service (LCS) | ||
| service: | ||
| host: 0.0.0.0 | ||
| port: 8080 | ||
| auth_enabled: false | ||
| workers: 1 | ||
| color_log: true | ||
| access_log: true | ||
| ogx: | ||
| # Server mode - connects to separate OGX service | ||
| use_as_library_client: false | ||
| url: http://${env.E2E_LLAMA_HOSTNAME}:8321 | ||
| api_key: xyzzy | ||
|
Comment on lines
+12
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- server-mode fixtures ---'
cat -n tests/e2e/configuration/server-mode/lightspeed-stack-compaction-disabled.yaml
cat -n tests/e2e/configuration/server-mode/lightspeed-stack-compaction.yaml
printf '%s\n' '--- api_key handling ---'
rg -n -C 3 'api_key|E2E_LLAMA_HOSTNAME|ogx' src tests/e2e/configuration tests/e2e 2>/dev/null | head -n 240Repository: lightspeed-core/lightspeed-stack Length of output: 20072 🤖 get_repo_knowledge executed:
Length of output: 25007 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- OGX holder and configuration definitions ---'
fd -t f . src | rg '(^|/)(client|ogx|configuration).*\.py$'
rg -n -C 5 'class AsyncOgxClientHolder|AsyncOgxClient\(|api_key|base_url|url=' src/client src/ogx_configuration.py src/configuration.py 2>/dev/null | head -n 260
printf '%s\n' '--- E2E service topology and credentials ---'
rg -n -C 4 'E2E_LLAMA_HOSTNAME|8321|api_key: xyzzy|API_KEY|api-key' .github tests/e2e tests 2>/dev/null | head -n 260Repository: lightspeed-core/lightspeed-stack Length of output: 25864 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- client construction ---'
cat -n src/client/ogx.py | sed -n '135,160p'
printf '%s\n' '--- dependency and client references ---'
rg -n -C 3 'ogx-client|ogx_client|AsyncOgxClient' pyproject.toml uv.lock requirements* setup* src tests 2>/dev/null | head -n 220Repository: lightspeed-core/lightspeed-stack Length of output: 14933 🌐 Web query:
💡 Result: In the ogx-client Python SDK (specifically versions 1.1.4 and later, which include the 1.2.5 release), the AsyncOgxClient is used for asynchronous operations [1]. Authentication and Configuration The client automatically manages the Authorization header using an API key [1]. API Key: When you provide an api_key, the client automatically sets an Authorization: Bearer <api_key> header [1][2]. You can provide this in two ways: 1. Constructor argument: AsyncOgxClient(api_key="your-api-key") [1][3] 2. Environment variable: Set the OGX_CLIENT_API_KEY environment variable [1][3]. Constructor arguments take precedence over environment variables [1][2]. Base URL: You can configure the server endpoint using the base_url parameter [1]. 1. Constructor argument: AsyncOgxClient(base_url="http://your-server:port") [1][3] 2. Environment variable: Set the OGX_CLIENT_BASE_URL environment variable [1][3]. Example Usage import asyncio from ogx_client import AsyncOgxClient async def main: # The client will use OGX_CLIENT_API_KEY and OGX_CLIENT_BASE_URL # from the environment if not provided explicitly async with AsyncOgxClient( api_key="your-api-key", base_url="http://localhost:8321") as client: models = await client.models.list if name == "main": asyncio.run(main) Key Implementation Details - Precedence: Explicit constructor arguments > environment variables > default values [2]. - Authorization: If an api_key is provided, it sets the Authorization: Bearer header [1]. This takes precedence over any Authorization header manually included in default_headers or custom headers [2]. - Migration Note: In versions 1.1.4 and later, the library streamlined how configuration is handled compared to older versions [1]. Avoid using the older configuration patterns if you are on 1.2.5 [1]. Citations:
Security Misconfiguration (CWE-319): Cleartext Transmission of Sensitive Information Reachability: Internal · Exploitability: Moderate Use HTTPS for the OGX service. Both fixtures pass
📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| user_data_collection: | ||
| feedback_enabled: true | ||
| feedback_storage: "/tmp/data/feedback" | ||
| transcripts_enabled: true | ||
| transcripts_storage: "/tmp/data/transcripts" | ||
| authentication: | ||
| module: "noop" | ||
| inference: | ||
| default_provider: openai | ||
| default_model: gpt-4o-mini | ||
| # Compaction e2e (LCORE-1673): a deliberately small window for the CI | ||
| # model so a three-turn conversation crosses the trigger threshold. | ||
| # The real model window is far larger; this only drives the local | ||
| # estimate, never the provider. | ||
| context_windows: | ||
| openai/gpt-4o-mini: 2000 | ||
| rag: | ||
| byok: | ||
| stores: | ||
| - rag_id: e2e-test-docs | ||
| backend: faiss | ||
| embedding_model: sentence-transformers/all-mpnet-base-v2 | ||
| embedding_dimension: 768 | ||
| vector_db_id: ${env.FAISS_VECTOR_STORE_ID} | ||
| db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db} | ||
| score_multiplier: 1.0 | ||
| retrieval: | ||
| tool: | ||
| sources: | ||
| - e2e-test-docs | ||
|
|
||
| shields: | ||
| - name: pii-redaction | ||
| provider_id: redaction | ||
| config: | ||
| rules: | ||
| - pattern: '\d+' | ||
| replacement: '[NUM]' | ||
|
|
||
| # Same small window and threshold as lightspeed-stack-compaction.yaml, but | ||
| # compaction switched off: context_status must stay "full" past the | ||
| # threshold (enabled is a full off-switch). | ||
| compaction: | ||
| enabled: false | ||
| threshold_ratio: 0.1 | ||
| token_floor: 100 | ||
| buffer_turns: 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Lightspeed Core Service (LCS) | ||
| service: | ||
| host: 0.0.0.0 | ||
| port: 8080 | ||
| auth_enabled: false | ||
| workers: 1 | ||
| color_log: true | ||
| access_log: true | ||
| ogx: | ||
| # Server mode - connects to separate OGX service | ||
| use_as_library_client: false | ||
| url: http://${env.E2E_LLAMA_HOSTNAME}:8321 | ||
| api_key: xyzzy | ||
| user_data_collection: | ||
| feedback_enabled: true | ||
| feedback_storage: "/tmp/data/feedback" | ||
| transcripts_enabled: true | ||
| transcripts_storage: "/tmp/data/transcripts" | ||
| authentication: | ||
| module: "noop" | ||
| inference: | ||
| default_provider: openai | ||
| default_model: gpt-4o-mini | ||
| # Compaction e2e (LCORE-1673): a deliberately small window for the CI | ||
| # model so a three-turn conversation crosses the trigger threshold. | ||
| # The real model window is far larger; this only drives the local | ||
| # estimate, never the provider. | ||
| context_windows: | ||
| openai/gpt-4o-mini: 2000 | ||
| rag: | ||
| byok: | ||
| stores: | ||
| - rag_id: e2e-test-docs | ||
| backend: faiss | ||
| embedding_model: sentence-transformers/all-mpnet-base-v2 | ||
| embedding_dimension: 768 | ||
| vector_db_id: ${env.FAISS_VECTOR_STORE_ID} | ||
| db_path: ${env.KV_RAG_PATH:=~/.llama/storage/rag/kv_store.db} | ||
| score_multiplier: 1.0 | ||
| retrieval: | ||
| tool: | ||
| sources: | ||
| - e2e-test-docs | ||
|
|
||
| shields: | ||
| - name: pii-redaction | ||
| provider_id: redaction | ||
| config: | ||
| rules: | ||
| - pattern: '\d+' | ||
| replacement: '[NUM]' | ||
|
|
||
| # Compaction on with a low threshold: 10% of the 2000-token window, | ||
| # above a 100-token floor, keeping one recent turn verbatim. | ||
| compaction: | ||
| enabled: true | ||
| threshold_ratio: 0.1 | ||
| token_floor: 100 | ||
| buffer_turns: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🤖 get_repo_knowledge executed:
get_repo_knowledge lightspeed-core/lightspeed-stack /tmp/coderabbit-repo-knowledge/lightspeed-core-lightspeed-stack-d57c5c34/learnings /tmp/coderabbit-repo-knowledge/lightspeed-core-lightspeed-stack-d57c5c34/conventionsLength of output: 23804
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 50389
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 50388
🏁 Script executed:
Repository: lightspeed-core/lightspeed-stack
Length of output: 47196
Security Misconfiguration (CWE-306): Missing Authentication for Critical Function
Reachability: External · Exploitability: Moderate
Restrict unauthenticated E2E service exposure. These four compaction fixtures disable authentication, while both Compose files publish port
8080on all host interfaces. Bind the published ports to127.0.0.1:8080:8080, or enable authentication for these fixtures.📍 Affects 4 files
tests/e2e/configuration/library-mode/lightspeed-stack-compaction-disabled.yaml#L5-L5(this comment)tests/e2e/configuration/library-mode/lightspeed-stack-compaction.yaml#L5-L5tests/e2e/configuration/server-mode/lightspeed-stack-compaction-disabled.yaml#L5-L5tests/e2e/configuration/server-mode/lightspeed-stack-compaction.yaml#L5-L5🤖 Prompt for AI Agents
Source: Coding guidelines