Skip to content

Invert intercept default to opt-in via intercept_context (record-everything is footgunny) #22

@aural-psynapse

Description

@aural-psynapse

After init_interceptor() + enable(), every patched httpx/requests call is recorded into provably_intercepts and triggers preprocess. To skip recording, the consumer must wrap each non-agent call in provably_self_egress(...).

Combined with the request-time trust gate (any URL not in trusted_endpoints raises) and the per-write preprocess job (every recorded call queues an indexing run), forgetting a single wrap has cascading effects:

  • Dashboard / admin / health-probe fetches against the same backend the agent uses get recorded with (agent_id="unknown", action_name="unknown"), polluting the intercepts table.
  • Each recorded call triggers a preprocess job. A page refresh that fans out to 20+ HTTP calls queues 20+ preprocess runs and starves the agent path.
  • Any URL not in trusted_endpoints raises RuntimeError: BLOCKED, even if the call is unrelated to the agent.

The SDK already has intercept_context(*, agent_id, action_name) for the agent path. If recording were opt-in — only calls inside an intercept_context scope are recorded; everything else passes through — the failure mode becomes "claim doesn’t resolve to an intercept" rather than "dashboard freezes."

Suggested behaviour:

provably.init_interceptor()
provably.enable()  # patches installed; recording happens only inside intercept_context

# agent path — recorded:
with provably.intercept_context(agent_id="fetch_and_claim", action_name="crm_get_customer__0"):
    customer = httpx.get(...).json()

# everything else — passes through unchanged, no trust check, no preprocess:
profile = httpx.get(...).json()

provably_self_egress becomes redundant (or stays as an alias for "explicit pass-through"). The trust gate still fires, but only for calls inside intercept_context, which is exactly the scope it was designed to police.

Hit while building a consumer where the dashboard fetches against the same backend the agent uses — every non-wrapped call ate a preprocess slot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions