The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): an empty session id must not reset every task's read dedup
kshitijk4poor62661023f31c
diff --git a/gateway/run.py b/gateway/run.pyindex ea61ac90406..cbfff36c695 100644--- a/gateway/run.py+++ b/gateway/run.py@@ -248,7 +248,7 @@ async def run_codex_hygiene_compaction(# copy_context carries profile secret scope / HERMES_HOME override (executors don't propagate ContextVars).worker_future = asyncio.get_running_loop().run_in_executor(None, copy_context().run,- lambda: agent._compress_context(history, "", approx_tokens=approx_tokens, task_id=session_id))+ lambda: agent._compress_context(history, "", approx_tokens=approx_tokens, task_id=session_id or "default"))track_worker = getattr(gateway, "_track_deferred_agent_worker", None)if callable(track_worker):# ``wait_for`` only cancels the asyncio wrapper; keep the running executor thread visible to shutdown.diff --git a/gateway/run_turn.py b/gateway/run_turn.pyindex 77d3afb0289..ca50f13f99b 100644--- a/gateway/run_turn.py+++ b/gateway/run_turn.py@@ -1239,11 +1239,10 @@ class GatewayTurnMixin:# fails closed (UnscopedSecretError) and every hygiene compaction silently degrades to a# lossy truncation (#100849 bundle).copy_context().run,- # task_id is the session row id: the live turn scopes skill_view/read_file dedup to it, and- # the boundary reset must hit the same bucket or a post-compaction re-read stubs (#98206).+ # task_id = the live turn's dedup bucket (session row id), never "" (= reset every task).lambda: _hyg_agent._compress_context(_hyg_msgs, "", approx_tokens=plan.approx_tokens, commit_fence=_hyg_commit_fence,- task_id=session_entry.session_id,+ task_id=session_entry.session_id or "default",),)attempt.wait_started = time.monotonic()diff --git a/gateway/slash_commands_session.py b/gateway/slash_commands_session.pyindex ffaa94412aa..33cef5f1e36 100644--- a/gateway/slash_commands_session.py+++ b/gateway/slash_commands_session.py@@ -484,7 +484,7 @@ class GatewaySessionCommandsMixin:count_before = getattr(compressor, "compression_count", 0)try:await self._run_in_executor_with_context(- lambda: agent._compress_context([], "", force=True, task_id=session_id))+ lambda: agent._compress_context([], "", force=True, task_id=session_id or "default"))except Exception as exc:return t("gateway.compress.failed", error=exc)if getattr(compressor, "compression_count", 0) > count_before: