Skip to main content

release_and_clear_meta

Function release_and_clear_meta 

Source
pub fn release_and_clear_meta(
    block_id: &str,
    mstore: &Option<Arc<Store>>,
    event_bus: &Option<Arc<EventBus>>,
) -> bool
Expand description

Release the lease AND clear the term:agentlockuntil meta copy the frontend gates on, broadcasting the update so it takes effect now.

Releasing only the in-memory copy is not enough on any path where the point is to give the human their keyboard back. Codex P1 / ReAgent P1 on PR #3249, and they’re right: AgentShellSubblock.tsx’s agentLocked() derives its gate purely from that meta value. blockinput now also has its own server-side lease check (see the module doc’s “Formerly a known gap” section), so a stale meta value no longer risks a swallowed keystroke reaching a live controller — but the frontend still reads meta for its own badge/gate, and clearing memory alone would leave that badge (and the client-side keystroke suppression) stuck for the rest of the 4s window, which is precisely the “typed exit, nothing visibly happened” case this is meant to fix.

Best-effort on the meta half (logs and continues), authoritative on the memory half. Mirrors core::persist_session_id’s established update-then-broadcast shape; no-ops on the meta half when mstore is None, as unit tests that don’t wire a store expect.