Skip to content

Helm#198

Merged
m1rl0k merged 5 commits intotestfrom
chunk
Jan 25, 2026
Merged

Helm#198
m1rl0k merged 5 commits intotestfrom
chunk

Conversation

@m1rl0k
Copy link
Collaborator

@m1rl0k m1rl0k commented Jan 25, 2026

Helm charts., Lean agent output

Introduces a 'lean' mode to _repo_search_impl that strips debug/internal fields from search results for improved token efficiency, controlled by a parameter or LEAN_RESPONSES env var. Refactors hybrid_search to support thread-safe, per-request ReFRAG config using contextvars and explicit parameters, avoiding global env var mutation. Updates TOON formatting to support lean mode and omits results_json when lean is enabled. Also improves Neo4j graph 'toon' output to include metadata for consistency.
Introduces a new Helm chart for deploying the context-engine application, including templates for deployments, services, ingress, configmaps, autoscaling, and persistent storage. This chart enables configurable, production-ready Kubernetes deployment of the context-engine and its components such as Qdrant, MCP indexer/memory, upload service, watcher, and learning reranker worker.
@augmentcode
Copy link

augmentcode bot commented Jan 25, 2026

🤖 Augment PR Summary

Summary: Adds Kubernetes deployment support via a new Helm chart, and refines MCP tool outputs to be more token-efficient.

Changes:

  • Introduced a Helm chart at deploy/helm/context-engine (Chart metadata, defaults, examples, and templates).
  • Chart templates cover Qdrant (StatefulSet + Services), MCP indexer/memory (Deployments + Services), upload service, watcher, learning reranker worker, PVCs, ingress, HPAs, and shared helpers.
  • Added deploy/kubernetes/.gitignore to keep customer-specific Helm values out of git.
  • Extended scripts/hybrid_search.py to accept explicit ReFRAG parameters and attempt per-request configuration isolation.
  • Adjusted context_answer wiring by removing the env-lock usage around ReFRAG/budget env toggles.
  • Added “lean” response shaping to repo_search and updated TOON formatting behavior to optionally omit results_json.
  • Wrapped Neo4j graph TOON output with additional metadata fields.

Technical Notes: The chart relies heavily on ConfigMaps for runtime config and defaults to exposing several services via NodePort; MCP output size is now influenced by LEAN_RESPONSES and TOON_ENABLED.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Returns empty dict if context_answer module not available or not in request context.
"""
try:
from scripts.mcp_impl.context_answer import get_refrag_config
Copy link

Choose a reason for hiding this comment

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

_get_contextvar_refrag_config() tries to import get_refrag_config from scripts.mcp_impl.context_answer, but that function doesn’t exist there, so this will always fall back to {}/env vars and won’t provide the per-request isolation described in the comment.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎


# Use injected lock or fall back to module-level lock
_lock = env_lock if env_lock is not None else _CA_ENV_LOCK
del env_lock # unused
Copy link

Choose a reason for hiding this comment

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

env_lock is now ignored, but this function still mutates process-wide os.environ for REFRAG_*/MICRO_BUDGET_TOKENS later; concurrent requests can race and restore the wrong values for each other.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎


# Determine if lean mode is enabled (strips debug/internal fields for agent ROI)
# Default ON for better agent token efficiency; set LEAN_RESPONSES=0 to disable
_lean = _to_bool(lean, os.environ.get("LEAN_RESPONSES", "1").lower() not in ("0", "false", "no"))
Copy link

Choose a reason for hiding this comment

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

Lean mode defaults to enabled (LEAN_RESPONSES defaulting to "1"), which changes the repo_search response schema (e.g., drops args/rerank_counters) and can break in-repo consumers/tests that read those fields.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

if isinstance(results, list):
# Preserve original list for internal callers before TOON encoding
response["results_json"] = results
# Only preserve results_json if not in lean mode (saves tokens for agents)
Copy link

Choose a reason for hiding this comment

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

In lean mode this skips emitting results_json, but several internal callers rely on results_json to consume TOON responses without decoding; those paths may break when TOON_ENABLED=1 and lean is enabled.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

return _format_neo4j_graph_toon(response)
return {
"ok": True,
"result": _format_neo4j_graph_toon(response),
Copy link

Choose a reason for hiding this comment

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

For output_format == "toon" the payload uses result (singular) instead of results, which is inconsistent with other tools and can cause clients that look for results to treat the response as empty.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

Introduces scripts/analyze_intent_confidence.py for analyzing intent classification confidence from event logs, along with comprehensive tests in tests/test_analyze_intent_confidence.py. Updates repo_search and related functions to support a 'lean' argument for improved internal composition and testability. Increases INDEX_UPSERT_BATCH and CPU allocation in docker-compose.yml for better indexing performance. Refactors tests and context handling for improved reliability and clarity.
@m1rl0k m1rl0k merged commit 9172716 into test Jan 25, 2026
1 check passed
@m1rl0k m1rl0k deleted the chunk branch January 29, 2026 11:27
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