Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(warnings): split context dismissal settings (#5149)

LearningCircuitdb5efd001030
diff --git a/changelog.d/+split-context-warning-dismissals.bugfix.md b/changelog.d/+split-context-warning-dismissals.bugfix.md
new file mode 100644
index 0000000000..609ed118c6
--- /dev/null
+++ b/changelog.d/+split-context-warning-dismissals.bugfix.md
@@ -0,0 +1 @@
+Context-history warnings can now be dismissed independently, so hiding one warning no longer hides the other.
diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md
index ba952aab26..18dc1e81a4 100644
--- a/docs/CONFIGURATION.md
+++ b/docs/CONFIGURATION.md
@@ -69,7 +69,8 @@ They are not available in the Web UI because they are needed to start the applic
| `app.warnings.dismiss_adaptive_scope_info` | `LDR_APP_WARNINGS_DISMISS_ADAPTIVE_SCOPE_INFO` | `false` | Permanently hide the informational banner that states what the Adaptive egress scope resolves to (public / private / both) for the current primary engine. | APP |
| `app.warnings.dismiss_cloud_embeddings` | `LDR_APP_WARNINGS_DISMISS_CLOUD_EMBEDDINGS` | `false` | Permanently hide the 'document chunks will be sent to OpenAI' (cloud embeddings) banner. Separate from the public-egress dismiss flag so acknowledging fresh-install noise never suppresses this critical warning. | APP |
| `app.warnings.dismiss_cloud_llm` | `LDR_APP_WARNINGS_DISMISS_CLOUD_LLM` | `false` | Permanently hide the 'LLM provider is cloud-hosted' banner. Separate from the public-egress dismiss flag so acknowledging fresh-install noise never suppresses this critical warning. | APP |
-| `app.warnings.dismiss_context_reduced` | `LDR_APP_WARNINGS_DISMISS_CONTEXT_REDUCED` | `false` | Dismiss warnings based on historical context usage and truncation | APP |
+| `app.warnings.dismiss_context_below_history` | `LDR_APP_WARNINGS_DISMISS_CONTEXT_BELOW_HISTORY` | `false` | Dismiss warnings when the configured context is below historical usage | APP |
+| `app.warnings.dismiss_context_truncation_history` | `LDR_APP_WARNINGS_DISMISS_CONTEXT_TRUNCATION_HISTORY` | `false` | Dismiss warnings about historical context truncation | APP |
| `app.warnings.dismiss_egress_policy` | `LDR_APP_WARNINGS_DISMISS_EGRESS_POLICY` | `false` | Permanently hide the 'public search egress enabled' banner (the fresh-install informational one). The critical cloud-LLM and cloud-embeddings banners have their OWN dismiss flags so this can't silently hide them. | APP |
| `app.warnings.dismiss_high_context` | `LDR_APP_WARNINGS_DISMISS_HIGH_CONTEXT` | `false` | Permanently hide the warning shown when your local LLM context window is set above 8,192 tokens, which may cause memory issues on some hardware. | APP |
| `app.warnings.dismiss_legacy_config` | `LDR_APP_WARNINGS_DISMISS_LEGACY_CONFIG` | `false` | Dismiss warnings about the deprecated server_config.json file | APP |
@@ -97,6 +98,7 @@ They are not available in the Web UI because they are needed to start the applic
| `embeddings.ollama.url` | `LDR_EMBEDDINGS_OLLAMA_URL` | `http://localhost:11434` | URL of the Ollama endpoint for embedding models. This setting allows you to use a different Ollama server for embeddings than for LLM operations. If not set, the system will fall back to the LLM Ollama URL. | APP |
| `embeddings.openai.api_key` | `LDR_EMBEDDINGS_OPENAI_API_KEY` | `` | API key for the OpenAI embeddings endpoint. Required for the OpenAI cloud API. For OpenAI-compatible local servers (LM Studio, vLLM, llama.cpp), you can leave this blank — LDR will substitute a placeholder so the OpenAI client request succeeds against the keyless server. | APP |
| `embeddings.openai.base_url` | `LDR_EMBEDDINGS_OPENAI_BASE_URL` | `` | Custom base URL for the embeddings endpoint. Leave blank to use the OpenAI cloud API (https://api.openai.com/v1). Set to your OpenAI-compatible local server URL to route embeddings there — examples: http://localhost:1234/v1 (LM Studio), http://localhost:8000/v1 (vLLM or llama.cpp server). When set, this overrides the cloud endpoint for embeddings without affecting the chat LLM provider. | APP |
+| `embeddings.openai.chunk_size` | `LDR_EMBEDDINGS_OPENAI_CHUNK_SIZE` | `null` | Maximum number of text chunks sent in a single embeddings request. embed_documents batches up to this many inputs per /v1/embeddings request (LangChain's default is 1000) and does not bound the batch's total tokens, so a document that splits into many chunks can overrun a local server's context window (n_ctx) and return a 400 exceed_context_size error. Lower this if indexing a collection fails that way against an OpenAI-compatible local server (LM Studio, vLLM, llama.cpp). Leave blank to keep LangChain's default, which suits the OpenAI cloud. | APP |
| `embeddings.openai.dimensions` | `LDR_EMBEDDINGS_OPENAI_DIMENSIONS` | `null` | Optional output vector dimensionality. Only applies to OpenAI text-embedding-3 models (which support truncation); ignored for other models including most local servers. Leave blank to use the model's native dimensionality. | APP |
| `embeddings.openai.model` | `LDR_EMBEDDINGS_OPENAI_MODEL` | `text-embedding-3-small` | Embedding model identifier. For OpenAI cloud: text-embedding-3-small (default), text-embedding-3-large, or text-embedding-ada-002. For OpenAI-compatible local servers, use the exact model name your server reports (e.g. nomic-ai/nomic-embed-text-v1.5 on LM Studio). | APP |
| `embeddings.require_local` | `LDR_EMBEDDINGS_REQUIRE_LOCAL` | `false` | When enabled, the embeddings provider must be local (sentence_transformers, or Ollama pointed at a local URL). Indexing with cloud embeddings (OpenAI) is blocked. Indexing a corpus with cloud embeddings sends every chunk off-machine. | LLM |
@@ -113,6 +115,7 @@ They are not available in the Web UI because they are needed to start the applic
| `langgraph_agent.include_sub_research` | `LDR_LANGGRAPH_AGENT_INCLUDE_SUB_RESEARCH` | `true` | Enable parallel subagent research. When enabled, the agent can decompose complex questions into subtopics and research them simultaneously using separate subagents. | SEARCH |
| `langgraph_agent.max_iterations` | `LDR_LANGGRAPH_AGENT_MAX_ITERATIONS` | `50` | Maximum number of agent reasoning cycles (each cycle = one LLM call + one tool call). Higher values let the agent search more thoroughly but use more tokens. The agent typically needs 10-20 cycles for simple queries and 30-50 for complex multi-faceted research. | SEARCH |
| `langgraph_agent.max_sub_iterations` | `LDR_LANGGRAPH_AGENT_MAX_SUB_ITERATIONS` | `8` | Maximum reasoning cycles per subagent when researching subtopics in parallel. Each subagent investigates one aspect of the question independently. | SEARCH |
+| `langgraph_agent.max_subagent_workers` | `LDR_LANGGRAPH_AGENT_MAX_SUBAGENT_WORKERS` | `4` | Maximum number of subagents that may run in parallel when the lead agent fans out subtopics via research_subtopic. Each worker thread serves one subagent at a time; any surplus subtopics queue and start as workers free up (a queued subagent keeps its own per-task budget — it is NOT killed by a shared loop timer). Tune this to match what your LLM backend can sustain in parallel (Ollama / LMStudio / llama.cpp `OLLAMA_NUM_PARALLEL`, an OpenAI tier limit, etc.). Lower values reduce load; higher values increase parallelism at the cost of more concurrent LLM/search traffic. | SEARCH |
| `llm.allowed_local_hostnames` | `LDR_LLM_ALLOWED_LOCAL_HOSTNAMES` | ``[]`` | Hostnames the policy will treat as local in addition to loopback / RFC1918 / link-local. Use for self-hosted services on custom hostnames (e.g. 'ollama.lan'). Public hostnames added here are rejected at save time. | LLM |
| `llm.anthropic.api_key` | `LDR_LLM_ANTHROPIC_API_KEY` | `` | Your Anthropic API key for Claude models. Get one at console.anthropic.com. Required when using the Anthropic provider. | LLM |
| `llm.anthropic_endpoint.api_key` | `LDR_LLM_ANTHROPIC_ENDPOINT_API_KEY` | `` | Optional API key for your Anthropic-compatible endpoint. Leave blank for self-hosted servers that don't require authentication. | LLM |
diff --git a/src/local_deep_research/database/migrations/versions/0025_split_context_warning_dismissals.py b/src/local_deep_research/database/migrations/versions/0025_split_context_warning_dismissals.py
new file mode 100644
index 0000000000..b0c21e24e1
--- /dev/null
+++ b/src/local_deep_research/database/migrations/versions/0025_split_context_warning_dismissals.py
@@ -0,0 +1,78 @@
+"""Split one context-history warning dismissal into two settings.
+
+Revision ID: 0025
+Revises: 0024
+"""
+
+import sqlalchemy as sa
+from alembic import op
+from sqlalchemy import inspect
+
+revision = "0025"
+down_revision = "0024"
+branch_labels = None
+depends_on = None
+
+LEGACY_KEY = "app.warnings.dismiss_context_reduced"
+BELOW_HISTORY_KEY = "app.warnings.dismiss_context_below_history"
+TRUNCATION_HISTORY_KEY = "app.warnings.dismiss_context_truncation_history"
+_COPYABLE_COLUMNS = (
+ "value",
+ "type",
+ "name",
+ "description",
+ "category",
+ "ui_element",
+ "options",
+ "min_value",
+ "max_value",
+ "step",
+ "visible",
+ "editable",
+ "env_var",
+)
+
+
+def _copy_setting_if_missing(conn, source_key: str, target_key: str) -> None:
+ existing_columns = {
+ column["name"] for column in inspect(conn).get_columns("settings")
+ }
+ copy_columns = [
+ column for column in _COPYABLE_COLUMNS if column in existing_columns
+ ]
+ if not copy_columns:
+ return
+
+ columns_sql = ", ".join(copy_columns)
+ conn.execute(
+ sa.text(
+ f"INSERT INTO settings (key, {columns_sql}) " # noqa: S608
+ f"SELECT :target_key, {columns_sql} FROM settings "
+ "WHERE key = :source_key "
+ "AND NOT EXISTS (SELECT 1 FROM settings WHERE key = :target_key)"
+ ),
+ {"source_key": source_key, "target_key": target_key},
+ )
+
+
+def upgrade() -> None:
+ conn = op.get_bind()
+ if not inspect(conn).has_table("settings"):
+ return
+ _copy_setting_if_missing(conn, LEGACY_KEY, BELOW_HISTORY_KEY)
+ _copy_setting_if_missing(conn, LEGACY_KEY, TRUNCATION_HISTORY_KEY)
+ conn.execute(
+ sa.text("DELETE FROM settings WHERE key = :key"), {"key": LEGACY_KEY}
+ )
+
+
+def downgrade() -> None:
+ """Best-effort collapse using the truncation-warning dismissal value."""
+ conn = op.get_bind()
+ if not inspect(conn).has_table("settings"):
+ return
+ _copy_setting_if_missing(conn, TRUNCATION_HISTORY_KEY, LEGACY_KEY)
+ conn.execute(
+ sa.text("DELETE FROM settings WHERE key IN (:below, :truncation)"),
+ {"below": BELOW_HISTORY_KEY, "truncation": TRUNCATION_HISTORY_KEY},
+ )
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index 53437e152f..f6ef78ead0 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -4011,13 +4011,27 @@
"value": false,
"visible": true
},
- "app.warnings.dismiss_context_reduced": {
+ "app.warnings.dismiss_context_below_history": {
"category": "warnings",
- "description": "Dismiss warnings based on historical context usage and truncation",
+ "description": "Dismiss warnings when the configured context is below historical usage",
"editable": true,
"max_value": null,
"min_value": null,
- "name": "Dismiss Context Reduced Warnings",
+ "name": "Dismiss Context Below History Warnings",
+ "options": null,
+ "step": null,
+ "type": "APP",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "app.warnings.dismiss_context_truncation_history": {
+ "category": "warnings",
+ "description": "Dismiss warnings about historical context truncation",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Dismiss Context Truncation History Warnings",
"options": null,
"step": null,
"type": "APP",
diff --git a/src/local_deep_research/web/warning_checks/__init__.py b/src/local_deep_research/web/warning_checks/__init__.py
index 647d9eba7e..0ff314535c 100644
--- a/src/local_deep_research/web/warning_checks/__init__.py
+++ b/src/local_deep_research/web/warning_checks/__init__.py
@@ -77,8 +77,11 @@ def calculate_warnings() -> List[dict]:
dismiss_model_mismatch = settings_manager.get_setting(
"app.warnings.dismiss_model_mismatch", False
)
- dismiss_context_warning = settings_manager.get_setting(
- "app.warnings.dismiss_context_reduced", False
+ dismiss_context_below_history = settings_manager.get_setting(
+ "app.warnings.dismiss_context_below_history", False
+ )
+ dismiss_context_truncation_history = settings_manager.get_setting(
+ "app.warnings.dismiss_context_truncation_history", False
)
dismiss_legacy_config = settings_manager.get_setting(
"app.warnings.dismiss_legacy_config", False
@@ -322,13 +325,14 @@ def calculate_warnings() -> List[dict]:
logger.debug("Backup status check skipped")
# --- History-based checks (need DB queries) ---
- if is_local and not dismiss_context_warning:
+ if is_local and not dismiss_context_below_history:
w = _safe_check(
check_context_below_history, db_session, local_context
)
if w:
warnings.append(w)
+ if is_local and not dismiss_context_truncation_history:
w = _safe_check(
check_context_truncation_history, db_session, local_context
)
diff --git a/src/local_deep_research/web/warning_checks/context.py b/src/local_deep_research/web/warning_checks/context.py
index 654884123b..bf96256d0f 100644
--- a/src/local_deep_research/web/warning_checks/context.py
+++ b/src/local_deep_research/web/warning_checks/context.py
@@ -49,7 +49,7 @@ def check_context_below_history(
f"size that 99% of your past researches ran with "
f"(min safe: {min_safe_context:,}). This may cause truncation."
),
- "dismissKey": "app.warnings.dismiss_context_reduced",
+ "dismissKey": "app.warnings.dismiss_context_below_history",
"actionUrl": "/metrics/context-overflow",
"actionLabel": "View context metrics",
}
@@ -77,7 +77,7 @@ def check_context_truncation_history(
f"Research was truncated {truncation_count} time(s) with similar "
f"or higher context. Consider increasing context window."
),
- "dismissKey": "app.warnings.dismiss_context_reduced",
+ "dismissKey": "app.warnings.dismiss_context_truncation_history",
"actionUrl": "/metrics/context-overflow",
"actionLabel": "View context metrics",
}
diff --git a/tests/database/test_alembic_migrations.py b/tests/database/test_alembic_migrations.py
index 6dd85336d7..6082a91aa0 100644
--- a/tests/database/test_alembic_migrations.py
+++ b/tests/database/test_alembic_migrations.py
@@ -691,6 +691,9 @@ class TestMigrationChain:
"0020_add_zotero_tables.py",
"0021_add_note_tables.py",
"0022_add_note_references.py",
+ "0023_drop_chunk_collection_unique.py",
+ "0024_chunk_id_autoincrement.py",
+ "0025_split_context_warning_dismissals.py",
]
for filename in expected_files:
diff --git a/tests/database/test_migration_0025_split_context_warning_dismissals.py b/tests/database/test_migration_0025_split_context_warning_dismissals.py
new file mode 100644
index 0000000000..88fe0518a5
--- /dev/null
+++ b/tests/database/test_migration_0025_split_context_warning_dismissals.py
@@ -0,0 +1,136 @@
+"""Tests for migration 0025's context-warning dismissal split."""
+
+import json
+from importlib import import_module
+
+import pytest
+from alembic import command
+from sqlalchemy import create_engine, text
+
+from local_deep_research.database.alembic_runner import get_alembic_config
+
+LEGACY = "app.warnings.dismiss_context_reduced"
+BELOW = "app.warnings.dismiss_context_below_history"
+TRUNCATION = "app.warnings.dismiss_context_truncation_history"
+
+
+def _migrate(engine, revision, downgrade=False):
+ config = get_alembic_config(engine)
+ with engine.begin() as conn:
+ config.attributes["connection"] = conn
+ (command.downgrade if downgrade else command.upgrade)(config, revision)
+
+
+def _seed(engine, key, value):
+ with engine.begin() as conn:
+ conn.execute(
+ text(
+ "INSERT INTO settings "
+ "(key, value, type, name, ui_element, visible, editable) "
+ "VALUES (:key, :value, 'app', :key, 'checkbox', 1, 1)"
+ ),
+ {"key": key, "value": json.dumps(value)},
+ )
+
+
+def _read(engine, key):
+ with engine.begin() as conn:
+ value = conn.execute(
+ text("SELECT value FROM settings WHERE key = :key"), {"key": key}
+ ).scalar_one_or_none()
+ return None if value is None else json.loads(value)
+
+
+def engine_at_0024(tmp_path):
+ engine = create_engine(f"sqlite:///{tmp_path / 'migration_0025.db'}")
+ _migrate(engine, "0024")
+ yield engine
+ engine.dispose()
+
+
[email protected]("dismissed", [False, True])
+def test_upgrade_copies_legacy_value_to_both_keys(engine_at_0024, dismissed):
+ _seed(engine_at_0024, LEGACY, dismissed)
+ _migrate(engine_at_0024, "0025")
+ assert _read(engine_at_0024, LEGACY) is None
+ assert _read(engine_at_0024, BELOW) is dismissed
+ assert _read(engine_at_0024, TRUNCATION) is dismissed
+
+
+def test_upgrade_preserves_existing_target_and_fills_missing(engine_at_0024):
+ _seed(engine_at_0024, LEGACY, True)
+ _seed(engine_at_0024, BELOW, False)
+ _migrate(engine_at_0024, "0025")
+ assert _read(engine_at_0024, BELOW) is False
+ assert _read(engine_at_0024, TRUNCATION) is True
+ assert _read(engine_at_0024, LEGACY) is None
+
+
+def test_upgrade_without_legacy_is_clean_noop(engine_at_0024):
+ _seed(engine_at_0024, BELOW, True)
+ _migrate(engine_at_0024, "0025")
+ assert _read(engine_at_0024, BELOW) is True
+ assert _read(engine_at_0024, TRUNCATION) is None
+
+
+def test_upgrade_is_idempotent(engine_at_0024):
+ _seed(engine_at_0024, LEGACY, True)
+ _migrate(engine_at_0024, "0025")
+ _migrate(engine_at_0024, "0025")
+ assert _read(engine_at_0024, BELOW) is True
+ assert _read(engine_at_0024, TRUNCATION) is True
+
+
+def test_copy_supports_legacy_schema_without_metadata_columns(tmp_path):
+ migration = import_module(
+ "local_deep_research.database.migrations.versions."
+ "0025_split_context_warning_dismissals"
+ )
+ engine = create_engine(f"sqlite:///{tmp_path / 'legacy_settings.db'}")
+ try:
+ with engine.begin() as conn:
+ conn.execute(
+ text(
+ "CREATE TABLE settings ("
+ "key TEXT PRIMARY KEY, value TEXT NOT NULL)"
+ )
+ )
+ conn.execute(
+ text("INSERT INTO settings (key, value) VALUES (:key, :value)"),
+ {"key": LEGACY, "value": json.dumps(True)},
+ )
+ migration._copy_setting_if_missing(conn, LEGACY, BELOW)
+
+ assert _read(engine, BELOW) is True
+ finally:
+ engine.dispose()
+
+
+def test_downgrade_uses_truncation_value_and_removes_split_keys(engine_at_0024):
+ _seed(engine_at_0024, LEGACY, False)
+ _migrate(engine_at_0024, "0025")
+ with engine_at_0024.begin() as conn:
+ conn.execute(
+ text("UPDATE settings SET value = :value WHERE key = :key"),
+ {"value": json.dumps(True), "key": TRUNCATION},
+ )
+ _migrate(engine_at_0024, "0024", downgrade=True)
+ assert _read(engine_at_0024, LEGACY) is True
+ assert _read(engine_at_0024, BELOW) is None
+ assert _read(engine_at_0024, TRUNCATION) is None
+
+
+def test_0025_is_head_and_chains_to_0024():
+ from alembic.config import Config
+ from alembic.script import ScriptDirectory
+ from local_deep_research.database.alembic_runner import (
+ get_head_revision,
+ get_migrations_dir,
+ )
+
+ config = Config()
+ config.set_main_option("script_location", str(get_migrations_dir()))
+ script = ScriptDirectory.from_config(config)
+ assert get_head_revision() == "0025"
+ assert script.get_revision("0025").down_revision == "0024"
diff --git a/tests/routes/test_settings_routes.py b/tests/routes/test_settings_routes.py
index eed4828cea..c42508f58c 100644
--- a/tests/routes/test_settings_routes.py
+++ b/tests/routes/test_settings_routes.py
@@ -219,7 +219,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 16384,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"llm.model": "llama3",
}.get(key, default)
)
@@ -254,7 +255,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 4096,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"app.warnings.dismiss_no_backups": True,
"app.warnings.dismiss_backup_disabled": False,
# Egress-policy banners (public-egress + cloud-LLM) fire for a
@@ -301,7 +303,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 2048,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"llm.model": "llama3",
}.get(key, default)
)
@@ -356,7 +359,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 2048,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"llm.model": "llama3",
}.get(key, default)
)
@@ -411,7 +415,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 4096,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"llm.model": "llama3",
}.get(key, default)
)
@@ -457,7 +462,7 @@ class TestCalculateWarnings:
)
def test_calculate_warnings_context_warnings_dismissed(self):
- """Test no history warnings when dismiss_context_reduced is True."""
+ """Test no history warnings when both dismiss flags are true."""
from local_deep_research.web.warning_checks import calculate_warnings
mock_settings_manager = Mock()
@@ -467,7 +472,8 @@ class TestCalculateWarnings:
"llm.local_context_window_size": 2048,
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": True,
+ "app.warnings.dismiss_context_below_history": True,
+ "app.warnings.dismiss_context_truncation_history": True,
"llm.model": "llama3",
}.get(key, default)
)
diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.json
index f00d98017b..c47409121a 100644
--- a/tests/settings/golden_master_settings.json
+++ b/tests/settings/golden_master_settings.json
@@ -426,13 +426,27 @@
"value": false,
"visible": true
},
- "app.warnings.dismiss_context_reduced": {
+ "app.warnings.dismiss_context_below_history": {
"category": "warnings",
- "description": "Dismiss warnings based on historical context usage and truncation",
+ "description": "Dismiss warnings when the configured context is below historical usage",
"editable": true,
"max_value": null,
"min_value": null,
- "name": "Dismiss Context Reduced Warnings",
+ "name": "Dismiss Context Below History Warnings",
+ "options": null,
+ "step": null,
+ "type": "APP",
+ "ui_element": "checkbox",
+ "value": false,
+ "visible": true
+ },
+ "app.warnings.dismiss_context_truncation_history": {
+ "category": "warnings",
+ "description": "Dismiss warnings about historical context truncation",
+ "editable": true,
+ "max_value": null,
+ "min_value": null,
+ "name": "Dismiss Context Truncation History Warnings",
"options": null,
"step": null,
"type": "APP",
diff --git a/tests/web/warning_checks/test_context.py b/tests/web/warning_checks/test_context.py
index eeb28153ce..707c810783 100644
--- a/tests/web/warning_checks/test_context.py
+++ b/tests/web/warning_checks/test_context.py
@@ -109,7 +109,9 @@ class TestCheckContextBelowHistory:
def test_dismiss_key(self):
db = _mock_db_with_context_records([(8192,)] * 10)
result = check_context_below_history(db, local_context=2048)
- assert result["dismissKey"] == "app.warnings.dismiss_context_reduced"
+ assert (
+ result["dismissKey"] == "app.warnings.dismiss_context_below_history"
+ )
class TestCheckContextTruncationHistory:
@@ -172,4 +174,7 @@ class TestCheckContextTruncationHistory:
db = Mock()
db.query.return_value.filter.return_value.filter.return_value.scalar.return_value = 1
result = check_context_truncation_history(db, local_context=4096)
- assert result["dismissKey"] == "app.warnings.dismiss_context_reduced"
+ assert (
+ result["dismissKey"]
+ == "app.warnings.dismiss_context_truncation_history"
+ )
diff --git a/tests/web/warning_checks/test_orchestrator.py b/tests/web/warning_checks/test_orchestrator.py
index a1b5245fc1..725bb29ca8 100644
--- a/tests/web/warning_checks/test_orchestrator.py
+++ b/tests/web/warning_checks/test_orchestrator.py
@@ -15,7 +15,8 @@ def _make_settings_manager(overrides=None):
"llm.model": "llama3",
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
"app.warnings.dismiss_legacy_config": False,
"app.warnings.dismiss_no_backups": False,
"app.warnings.dismiss_backup_disabled": False,
@@ -171,7 +172,8 @@ class TestCalculateWarningsContextCheckGating:
{
"llm.provider": "openai",
"llm.local_context_window_size": 2048,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
}
)
with _patch_orchestrator(mgr, db_session=mock_db_session):
@@ -185,7 +187,7 @@ class TestCalculateWarningsContextCheckGating:
)
def test_context_checks_skipped_when_dismissed(self):
- """Local provider with dismiss_context_reduced=True should skip DB queries."""
+ """Both dismissed context warnings should skip DB queries."""
from local_deep_research.web.warning_checks import calculate_warnings
mock_db_session = Mock()
@@ -194,7 +196,8 @@ class TestCalculateWarningsContextCheckGating:
{
"llm.provider": "ollama",
"llm.local_context_window_size": 2048,
- "app.warnings.dismiss_context_reduced": True,
+ "app.warnings.dismiss_context_below_history": True,
+ "app.warnings.dismiss_context_truncation_history": True,
}
)
with _patch_orchestrator(mgr, db_session=mock_db_session):
@@ -203,6 +206,48 @@ class TestCalculateWarningsContextCheckGating:
mock_db_session.query.assert_not_called()
assert not any(w["type"] == "context_below_history" for w in warnings)
+ def test_below_history_can_be_dismissed_independently(self):
+ from local_deep_research.web.warning_checks import calculate_warnings
+
+ mgr = _make_settings_manager(
+ {
+ "app.warnings.dismiss_context_below_history": True,
+ "app.warnings.dismiss_context_truncation_history": False,
+ }
+ )
+ with _patch_orchestrator(mgr):
+ with patch(
+ "local_deep_research.web.warning_checks.check_context_below_history"
+ ) as below_check:
+ with patch(
+ "local_deep_research.web.warning_checks.check_context_truncation_history"
+ ) as truncation_check:
+ calculate_warnings()
+
+ below_check.assert_not_called()
+ truncation_check.assert_called_once()
+
+ def test_truncation_history_can_be_dismissed_independently(self):
+ from local_deep_research.web.warning_checks import calculate_warnings
+
+ mgr = _make_settings_manager(
+ {
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": True,
+ }
+ )
+ with _patch_orchestrator(mgr):
+ with patch(
+ "local_deep_research.web.warning_checks.check_context_below_history"
+ ) as below_check:
+ with patch(
+ "local_deep_research.web.warning_checks.check_context_truncation_history"
+ ) as truncation_check:
+ calculate_warnings()
+
+ below_check.assert_called_once()
+ truncation_check.assert_not_called()
+
class TestCalculateWarningsMultipleWarnings:
"""Multiple warnings can fire simultaneously."""
@@ -391,7 +436,8 @@ class TestCalculateWarningsSingleSession:
assert "llm.model" in called_keys
assert "app.warnings.dismiss_high_context" in called_keys
assert "app.warnings.dismiss_model_mismatch" in called_keys
- assert "app.warnings.dismiss_context_reduced" in called_keys
+ assert "app.warnings.dismiss_context_below_history" in called_keys
+ assert "app.warnings.dismiss_context_truncation_history" in called_keys
assert "app.warnings.dismiss_legacy_config" in called_keys
@@ -518,7 +564,8 @@ class TestCalculateWarningsNoneProvider:
"llm.model": "llama3",
"app.warnings.dismiss_high_context": False,
"app.warnings.dismiss_model_mismatch": False,
- "app.warnings.dismiss_context_reduced": False,
+ "app.warnings.dismiss_context_below_history": False,
+ "app.warnings.dismiss_context_truncation_history": False,
}.get(key, default)
with _patch_orchestrator(mgr):