odysseus/src
tanmayraut45 c161866199 CalDAV: close the DAVClient on sync and write-back paths (#4793)
_sync_blocking (src/caldav_sync.py) and _writeback_blocking
(src/caldav_writeback.py) each open their own caldav.DAVClient via
_build_dav_client, but never close it. The client owns an HTTP session
with a pooled connection; without a close() that connection is held until
process exit.

Previously the fix added explicit client.close() calls before each early
return and at the end of the DB finally block. This still leaked the
client when SessionLocal() raised before the DB try/finally was entered.

Now _sync_blocking wraps the entire post-construction path in an outer
try/finally that calls client.close() unconditionally, covering:
  - AuthorizationError / NotFoundError early return
  - URL-fallback failure early return
  - no-calendars early return
  - normal return after sync
  - SessionLocal() construction failure (new regression coverage)

_writeback_blocking already used a try/finally (unchanged).

- src/caldav_sync.py: replace scattered client.close() calls with a
  single outer try/finally block around the discovery + DB sync path
- tests/test_caldav_client_cleanup.py: add CalendarDeletedEvent to the
  database stub; add regression test for SessionLocal() failure path

Closes #4593
2026-07-11 13:03:24 +01:00
..
agent_tools Merge remote-tracking branch 'origin/dev' 2026-07-07 00:51:34 +00:00
search refactor(search): make src analytics a service shim (#2264) 2026-06-04 18:57:24 +02:00
tools fix(tasks): scope manage_tasks mutations to an exact task owner (#5264) 2026-07-11 01:45:14 +01:00
action_intents.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
agent_loop.py fix(chat): require explicit web search enable 2026-07-08 17:44:28 +00:00
agent_runs.py Agent stream: 10s heartbeat keepalive on the SSE subscribe so long-running thinking models dont drop the connection 2026-06-19 00:34:30 +00:00
ai_interaction.py Merge dev into main for testing 2026-06-28 14:07:23 +00:00
api_key_manager.py fix: use atomic write in APIKeyManager.save() to prevent credential data loss (#4591) (#4597) 2026-06-23 23:28:53 +02:00
app_helpers.py fix(routes): log and cleanly 500 on unreadable HTML page (#4637) 2026-06-23 16:12:32 +02:00
app_initializer.py fix(health): report unhealthy memory vector store as degraded 2026-06-27 22:25:13 +01:00
assistant_log.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
auth_helpers.py fix(auth): gate api tokens from user routes (#2992) 2026-06-07 12:55:01 +02:00
bg_jobs.py feat(agent): add manage_bg_jobs tool to inspect and kill background bash jobs (#4577) 2026-06-19 00:28:22 -07:00
bg_monitor.py fix: drop thinking deltas from background agent loops 2026-06-15 15:03:09 +09:00
builtin_actions.py Implement email auto translate cache task 2026-06-29 14:59:25 +00:00
builtin_mcp.py fix(mcp): retain builtin startup tasks and reap npx probe 2026-06-28 01:18:17 +01:00
caldav_sync.py CalDAV: close the DAVClient on sync and write-back paths (#4793) 2026-07-11 13:03:24 +01:00
caldav_writeback.py CalDAV: close the DAVClient on sync and write-back paths (#4793) 2026-07-11 13:03:24 +01:00
chat_handler.py Persist upload OCR captions in gallery 2026-06-29 01:45:05 +00:00
chat_helpers.py fix(chat): keep balanced trailing ')' when extracting URLs (#3406) 2026-06-08 21:33:29 +02:00
chat_processor.py fix(chat): sanitize web search query to strip markdown and code blocks (#4863) 2026-06-28 01:23:08 +01:00
chatgpt_subscription.py Fix model endpoint route test regressions 2026-06-09 10:16:38 +09:00
chroma_client.py fix: ChromaDB unreachable blocks app startup for 30-60s (#326) (#476) 2026-06-01 22:22:41 +09:00
cleanup_service.py Replace cleanup service datetime.utcnow calls (#1494) 2026-06-03 14:14:27 +09:00
config.py feat(paths): abstract runtime path logic for frozen distribution packages (#969) 2026-06-15 17:44:10 +01:00
constants.py Merge origin/dev into main 2026-06-21 11:08:50 +00:00
context_budget.py Ignore invalid context budget numbers (#1831) 2026-06-29 19:56:17 +01:00
context_compactor.py fix(research): keep Discuss chats grounded on their report (#4006) 2026-06-15 20:31:57 +09:00
cookbook_serve_lifecycle.py Polish mobile UI and editor workflows 2026-06-27 13:05:44 +00:00
copilot.py fix(copilot): guard request_flags against a non-dict last message (#5274) 2026-07-08 23:57:23 +02:00
database.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
deep_research.py fix(research): track analyzed URLs separately (#3125) 2026-06-10 12:08:22 +01:00
document_actions.py Merge remote-tracking branch 'origin/dev' 2026-07-01 10:11:22 +00:00
document_processor.py fix(chat): give extensionless image/audio uploads a valid MIME subtype (#5205) 2026-07-08 21:04:15 +02:00
email_thread_parser.py Ignore non-string email thread bodies (#1654) 2026-06-03 14:06:31 +09:00
embedding_lanes.py fix(embeddings): survive numpy embeddings when restoring a reset lane (#3410) 2026-06-09 10:40:17 +02:00
embeddings.py Retry oversized embedding requests (#1106) 2026-06-26 14:21:27 +01:00
endpoint_resolver.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
event_bus.py refactor(constants): single source of truth for data dir (#3368) 2026-06-08 09:58:52 +02:00
exceptions.py refactor(exceptions): dedupe src/exceptions via core re-export (#4785) 2026-06-24 16:50:07 +02:00
generated_images.py refactor(constants): single source of truth for data dir (#3368) 2026-06-08 09:58:52 +02:00
goal_based_extractor.py fix(deep-research): wrap fetched webpage content in untrusted-context sandbox 2026-06-06 03:37:10 -06:00
host_docker_access.py fix(docker): make host Docker socket opt-in (#4902) 2026-06-30 19:54:51 +02:00
integrations.py Merge pull request #5181 from harshit-ojha0324/fix/webhook-trailing-slash 2026-07-05 03:44:19 +03:00
interactive_gate.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
llm_core.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
markitdown_runtime.py Settings overhaul + UI polish pass 2026-06-10 15:15:13 +09:00
mcp_manager.py feat(paths): abstract runtime path logic for frozen distribution packages (#969) 2026-06-15 17:44:10 +01:00
mcp_oauth.py fix(mcp): guard DbTokenStorage against non-dict oauth_tokens JSON (#5107) 2026-07-11 05:26:23 +01:00
memory.py refactor(memory): canonicalize memory imports (#50) 2026-06-04 05:31:15 +01:00
memory_provider.py feat(memory): add provider interface (#72) 2026-06-04 16:26:11 +01:00
memory_vector.py fix: split Chroma embedding lanes (#3046) 2026-06-06 03:17:19 -06:00
model_context.py fix(model-context): read real context window for unknown proxy models (#4909) 2026-06-30 18:04:29 +01:00
model_discovery.py fix(models): accept bare-list /models responses (Together AI) (#4761) 2026-06-27 16:25:15 +01:00
office_doc.py Merge remote-tracking branch 'origin/dev' into test-main-dev-merge-20260615 2026-06-15 21:20:15 +09:00
optional_deps.py fix(image): patch realesrgan torchvision compatibility (#4110) 2026-06-15 15:16:41 +09:00
pdf_form_doc.py refactor(tools): extract document tools to handle registry (#3666) 2026-06-10 10:41:52 +02:00
pdf_forms.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
pdf_runtime.py Show a clear message when PyMuPDF is missing 2026-06-01 18:27:17 +09:00
personal_docs.py Ignore non-string personal doc text (#1832) 2026-06-29 19:24:29 +01:00
preset_manager.py fix(presets): persist presets atomically to avoid corruption on crash (#2169) 2026-06-08 19:16:37 +02:00
prompt_security.py Isolate untrusted context from visible user prompts (#3584) 2026-06-27 13:50:04 +01:00
rag_manager.py fix: resolve RAG manager search signature TypeError (#4994) 2026-07-03 15:07:16 +01:00
rag_singleton.py feat(paths): abstract runtime path logic for frozen distribution packages (#969) 2026-06-15 17:44:10 +01:00
rag_vector.py fix(auth): clean up rename and null-owner ownership (#4340) 2026-06-16 03:33:02 +01:00
rate_limiter.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
readiness.py feat: add /api/ready readiness probe (DB, data dir, local-first) (#1200) 2026-06-02 23:33:22 +09:00
reminder_personas.py Settings overhaul + UI polish pass 2026-06-10 15:15:13 +09:00
request_models.py Odysseus v1.0 2026-05-31 23:58:26 +09:00
research_handler.py fix(research): migrate active task owners on rename (#3618) 2026-06-11 01:17:02 +02:00
research_utils.py Treat non-string research summaries as low quality 2026-06-03 13:42:24 +09:00
runtime_paths.py feat(paths): abstract runtime path logic for frozen distribution packages (#969) 2026-06-15 17:44:10 +01:00
secret_storage.py refactor(constants): single source of truth for data dir (#3368) 2026-06-08 09:58:52 +02:00
service_health.py feat(diagnostics): add consolidated service health endpoint for degraded-state reporting (#964) 2026-06-09 16:00:24 +01:00
session_actions.py fix(sessions): keep fresh chats during auto tidy (#1871) 2026-06-09 01:06:20 +01:00
session_search.py Polish mobile UI and editor workflows 2026-06-27 13:05:44 +00:00
settings.py Guard document style against persona guessing 2026-06-28 21:49:09 +00:00
settings_scrub.py fix(settings): scrub camelCase secret keys (#3707) 2026-06-11 12:53:33 +02:00
task_action_policy.py fix(tasks): gate cookbook serve task execution (#5235) 2026-07-05 13:19:04 +01:00
task_endpoint.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
task_scheduler.py Merge remote-tracking branch 'origin/dev' 2026-07-07 00:51:34 +00:00
teacher_escalation.py fix(ai): offload model resolution from async paths 2026-06-28 00:48:35 +01:00
text_helpers.py fix(security): prevent ReDoS in LLM-output tool/think parsers (#4704) 2026-06-27 10:12:28 -07:00
tls_overrides.py Support extra CA bundle for private-CA LLM providers (#769) 2026-06-04 13:18:50 +01:00
tool_execution.py fix(security): match the sensitive-file deny-list case-insensitively (#5097) 2026-07-02 10:11:51 +01:00
tool_implementations.py Merge dev into main for testing 2026-06-28 14:07:23 +00:00
tool_index.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
tool_parsing.py Checkpoint Odysseus local update 2026-07-07 00:50:07 +00:00
tool_policy.py fix(chat): require explicit web search enable 2026-07-08 17:44:28 +00:00
tool_schemas.py Merge remote-tracking branch 'origin/dev' 2026-07-07 00:51:34 +00:00
tool_security.py fix(agent): execute fenced tool calls with inline args and route bare email tool names (#3681) 2026-06-30 16:50:32 +01:00
tool_utils.py fix(tools): handle non-dict JSON values in _parse_tool_args (closes #5043) (#5064) 2026-07-03 13:07:44 +01:00
topic_analyzer.py Topics: hydrate session history before analysis 2026-06-02 20:44:27 +09:00
upload_handler.py fix(upload): remove trailing whitespace 2026-06-26 18:01:04 +01:00
upload_limits.py refactor(uploads): centralize upload byte-limits in upload_limits.py (#3364) (#3518) 2026-06-09 01:24:30 +02:00
url_safety.py Reject resolver results without IPs (#1826) 2026-06-29 16:32:32 +01:00
url_security.py Reapply "Merge branch 'main' of github.com:pewdiepie-archdaemon/odysseus" 2026-06-03 22:47:00 +09:00
user_time.py fix(tasks): keep scheduled-task prompt cache stable 2026-06-28 00:05:02 +01:00
visual_report.py fix(visual_report): ignore fenced headings in TOC extraction 2026-06-27 17:44:32 +01:00
webhook_manager.py fix(security): pin webhook delivery to the SSRF-validated IP (DNS rebinding) (#5147) 2026-07-04 17:03:38 +01:00
youtube_handler.py fix(youtube): consolidate duplicate handler 2026-06-15 15:03:41 +09:00