Skip to content

🛡️ Harden restored session provider parsing against invalid DB values #55

@Robdel12

Description

@Robdel12

Context

runtime/restored_sessions.rs still parses restored provider strings with unwrap() in two places:

  • restored_session_to_handle
  • prepare_restored_session_for_direct_resume

That means a malformed provider value in the database can panic session restoration instead of degrading gracefully.

Task

Harden restored provider parsing in runtime/restored_sessions.rs.

Please:

  • extract a small helper so the parsing logic only lives in one place
  • preserve normal behavior for valid provider values, including mixed-case input
  • replace the unwrap() calls with a safe fallback
  • log a warning when fallback is used so the bad stored value is visible
  • add focused unit tests for valid and invalid provider strings

Use Provider::Claude as the fallback so restored read paths stay aligned with the other mission/provider hardening work.

Acceptance Criteria

  • Restored session helpers no longer panic on invalid provider strings.
  • Valid provider strings still restore correctly.
  • Invalid provider strings fall back predictably and are logged.
  • The new helper has direct unit test coverage.

Files

  • orbitdock-server/crates/server/src/runtime/restored_sessions.rs

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readySmall task suitable for agent dispatch

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions