Skip to content

api-bridge: empty sessions/ directory panics stored_session_ids (chunk size must be non-zero) #1234

Description

@davidfarah2003

Observed

jcode api-bridge panics on list_sessions when $JCODE_HOME/sessions exists and is empty:

thread 'tokio-runtime-worker' panicked at crates/jcode-harness-api-server/src/translate.rs:1707:38:
chunk size must be non-zero

The API socket then resets. A subsequent create_session on the same client fails with a broken pipe / harness connection closed.

Measured on jcode v0.81.5 (f46f9c354) with an isolated JCODE_HOME.

Controls

Isolated JCODE_HOME, jcode api-bridge --api-socket ... --no-update, handshake hello with min_version: 1, max_version: 1, then list_sessions:

home result
no sessions/ directory {"ev":"sessions","sessions":[]} then create_session succeeds
empty sessions/ directory panic at translate.rs:1707:38, socket reset, create_session BrokenPipe

Ask

stored_session_ids should treat a zero-length directory listing as an empty session list instead of dividing by a zero chunk count.

This is independently the root of Cotal-AI/Cotal#1293: a managed seat whose private home has an empty sessions/ directory cannot start.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: clearHands-off: unambiguous bug, obvious fix, no decisions. Don't even look - an agent can fully solve.bugSomething isn't workingtriage: reproducibleClear repro + clear fix path

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions