{"record":{"id":"594aad482080cf4d","repo":"langchain-ai/deepagents","slug":"approval-mode-store-writer-is-unavailable","errorCode":null,"errorMessage":"Approval-mode Store writer is unavailable","messagePattern":"Approval-mode Store writer is unavailable","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/tui/textual_adapter.py","lineNumber":1343,"sourceCode":"            states a non-boolean. `None` means \"unknown\", which leaves the\n            client's own view of pricing health untouched rather than\n            overriding it with a guess.\n    \"\"\"\n    if not isinstance(data, dict):\n        return None\n    pricing_ok = data.get(\"pricing_ok\")\n    return pricing_ok if isinstance(pricing_ok, bool) else None\n\n\ndef _require_approval_mode_key(value: str | None) -> str:\n    \"\"\"Return a written Store key for fail-closed startup.\n\n    Raises:\n        RuntimeError: If the remote agent has no Store writer.\n    \"\"\"\n    if value is None:\n        msg = \"Approval-mode Store writer is unavailable\"\n        raise RuntimeError(msg)\n    return value\n\n\nclass _AutoModeReviewEvent(NamedTuple):\n    \"\"\"Validated lifecycle event for one Auto classifier review.\"\"\"\n\n    phase: Literal[\"review_started\", \"review_completed\"]\n    batch_id: str\n    tool_call_ids: tuple[str, ...]\n    approved_tool_call_ids: tuple[str, ...]\n    recovered: bool = False\n    \"\"\"Synthesized from a rejected completion, so its ID lists carry no meaning.\"\"\"\n\n\ndef _opaque_ids(value: object, *, allow_empty: bool = False) -> tuple[str, ...] | None:\n    \"\"\"Validate an ordered list of unique opaque identifiers.\n\n    Empty strings are rejected along with non-strings: an ID that cannot key a","sourceCodeStart":1325,"sourceCodeEnd":1361,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/tui/textual_adapter.py#L1325-L1361","documentation":"_require_approval_mode_key is a narrowing helper for the approval-mode Store writer: when the resolved writer is None it raises RuntimeError because manual approval decisions cannot be persisted without it. The function is a guard so downstream code can assume a non-None writer.","triggerScenarios":"execute_task_textual resolves the approval-mode Store writer and gets None — e.g. the remote agent's Store is unavailable/disconnected — and then tries to persist an approval-mode change.","commonSituations":"Remote agent sessions where the Store backend failed to initialize or dropped its connection; running with a configuration that never wires a Store writer; calling persistence paths outside a Store-enabled session.","solutions":["Ensure the session is started with a Store-backed agent so the approval-mode writer is registered.","Check remote agent health/Store connectivity and restart the session if the Store dropped.","Add a pre-flight check for Store availability before enabling approval-mode persistence, and surface a user-visible message instead of crashing mid-turn.","Gate approval-mode persistence behind an optional fallback (in-memory) when the Store is absent."],"exampleFix":"// before\nwriter = _require_approval_mode_key(resolve_writer(adapter))\n// after\nwriter = resolve_writer(adapter)\nif writer is None:\n    adapter._update_status(\"Approval mode persistence unavailable (no Store)\")\n    return\nwriter = _require_approval_mode_key(writer)","handlingStrategy":"validation","validationCode":"writer = resolve_store_writer(adapter)\nif writer is None:\n    raise SessionError(\"approval-mode Store writer unavailable; cannot persist approval mode\")","typeGuard":"def has_store_writer(adapter: object) -> TypeGuard[AdapterWithStore]:\n    return resolve_store_writer(adapter) is not None","tryCatchPattern":"try:\n    _require_approval_mode_key(resolve_store_writer(adapter))\nexcept RuntimeError:\n    adapter._update_status(\"Store unavailable; approval persistence disabled\")\n    return","preventionTips":["Verify Store connectivity at session startup before enabling approval-mode persistence.","Monitor Store health and reconnect proactively in remote sessions.","Avoid starting approval-gated workflows on agents without a configured Store."],"tags":["store","persistence","approval-mode"],"backgroundTag":"store-writer-unavailable","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}