{"record":{"id":"429f133078b7a564","repo":"666ghj/MiroFish","slug":"unexpected-mirofish-updater-stats-updater-stats","errorCode":null,"errorMessage":"unexpected MiroFish updater stats: {updater_stats}","messagePattern":"unexpected MiroFish updater stats: (.+?)","errorType":"exception","errorClass":"AssertionError","httpStatus":null,"severity":"error","filePath":"backend/scripts/validate_zep_cloud_integration.py","lineNumber":605,"sourceCode":"        ]\n        result[\"temporal_update_episode_uuids\"] = update_episode_uuids\n        print(f\"[zep-deep] temporal updates processed={len(update_episode_uuids)}\", flush=True)\n\n        updater = ZepGraphMemoryUpdater(\n            graph_id=graph_id,\n            api_key=api_key,\n            simulation_id=f\"zep-deep-{stamp}\",\n        )\n        updater_started = True\n        updater.start()\n        for activity in _activities():\n            updater.add_activity(activity)\n        updater_stop_attempted = True\n        updater.stop()\n        updater_drained = True\n        updater_stats = updater.get_stats()\n        if updater_stats[\"items_sent\"] != 5 or updater_stats[\"pending_episode_count\"] != 0:\n            raise AssertionError(f\"unexpected MiroFish updater stats: {updater_stats}\")\n        result[\"mirofish_updater\"] = updater_stats\n        print(\"[zep-deep] MiroFish updater processed 5 mock activities\", flush=True)\n\n        final_nodes = fetch_all_nodes(client, graph_id, page_size=2)\n        final_edges = fetch_all_edges(client, graph_id, page_size=2)\n        final_names = {_uuid(node): node.name for node in final_nodes}\n        invalidated = [edge for edge in final_edges if edge.invalid_at]\n        expired = [edge for edge in final_edges if edge.expired_at]\n\n        edge_search = client.graph.search(\n            graph_id=graph_id,\n            query=\"澜舟科技当前首席执行官、当前总部以及与海岳能源的当前合作关系是什么？\",\n            scope=\"edges\",\n            reranker=\"cross_encoder\",\n            limit=20,\n        )\n        node_search = client.graph.search(\n            graph_id=graph_id,","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/backend/scripts/validate_zep_cloud_integration.py#L587-L623","documentation":"An AssertionError in the validation script after feeding the MiroFish ZepUpdater exactly the 5 activities from _activities(): it requires updater_stats[\"items_sent\"] == 5 and updater_stats[\"pending_episode_count\"] == 0 (checked via updater.get_stats() after add_activity x5 then stop()). Any other numbers mean the updater dropped, rejected, or left activities unprocessed — e.g. an add_activity raced stop(), or a send to Zep failed and was swallowed. The f-string interpolates the actual stats dict.","triggerScenarios":"An activity rejected by the updater's validator (items_sent < 5), stop() returning before the queue fully drains (pending_episode_count > 0), or Zep send errors (auth, rate limit) swallowed by the updater's drain logic.","commonSituations":"AgentActivity schema drift between _activities() and the updater's expectations; transient Zep Cloud rate limiting during the drain; a bug in the updater's stop path leaving pending episodes.","solutions":["Read the stats dict in the failure message: items_sent < 5 points to dropped/rejected activities; pending_episode_count > 0 points to an incomplete drain on stop().","Check the updater's logs for swallowed Zep send errors and fix the underlying cause (auth, rate limits) before rerunning.","Reconcile the mock AgentActivity fields in _activities() with the updater's current expected schema.","Rerun once — transient rate limiting during stop() can leave pending episodes."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def updater_stats_look_correct(stats: dict) -> bool:\n    return stats.get(\"items_sent\") == 5 and stats.get(\"pending_episode_count\") == 0","typeGuard":null,"tryCatchPattern":"try:\n    assert updater_stats_look_correct(updater.get_stats())\nexcept AssertionError:\n    stats = updater.get_stats()\n    if stats[\"pending_episode_count\"] > 0:\n        updater.stop()  # one more drain attempt\n        stats = updater.get_stats()\n    if not updater_stats_look_correct(stats):\n        raise","preventionTips":["Check the updater's error/retry logs whenever stats disagree — swallowed send errors are the usual root cause.","Keep the mock AgentActivity schema in _activities() in sync with the updater's validator.","Assert pending_episode_count == 0 after stop() in the updater's own unit tests."],"tags":["zep","assertion","updater","queue-drain","validation-script"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}