Skip to content

session-start-hook.sh's entrypoint sniff (#745) has three unresolved false-negative/false-positive edges #803

Closed

Description

@fdaviddpt

What

_transcript_is_pluginless_sdk() in scripts/session-start-hook.sh (added by #745 to keep a
pluginless Agent SDK transcript from being treated as "the previous session") leaves three edges
open, all ranked non-blocking by two independently-spawned self-reviewers (Explore + oss:auditor)
during the #745 follow-up lane, and all confirmed still present at HEAD as of this curation pass
(2026-09-26).

Location

scripts/session-start-hook.sh:910-926 (_transcript_is_pluginless_sdk):

_transcript_is_pluginless_sdk() {
    local f=$1 n=0 line ep
    while IFS= read -r line; do
        n=$((n + 1))
        case "$line" in
            *'"message"'*) ;;  # real dialogue, never a bookkeeping record
            *'"entrypoint"'*)
                ep=$(_stdin_json_string entrypoint "$line" 2>/dev/null) || return 1
                case "$ep" in
                    sdk-*) return 0 ;;
                    *) return 1 ;;
                esac
                ;;
        esac
        [ "$n" -ge "$_ENTRYPOINT_SNIFF_CAP" ] && return 1
    done < "$f" 2>/dev/null

Mechanism -- three separate edges

  1. No evidence check. The exclusion fires on the entrypoint field's sdk- prefix alone,
    with no way to distinguish a pluginless SDK session (the reported bug: setting_sources=[],
    no plugin loaded, no marker ever possible) from a hypothetical SDK integration that DOES pass
    setting_sources and loads this plugin, which would write its own capture-alive.d/<id>
    marker like any other host. A marker-/save-record-aware refinement is possible (check
    capture_was_seen/session_was_saved on the candidate's own filename id before excluding it),
    but CAPTURE_SEEN_DIR is assigned later in _remember_deferred_phase than
    previous_transcript() is called, so wiring it in needs a deliberate ordering audit. No
    real-world instance has been observed (capture-gap notice fires for sessions whose transcript opens with queue-operation, while doctor reports the same session as saved #745's own dataset -- 16 transcripts -- had none of the
    25 SDK-entrypoint transcripts carrying a plugin marker).

  2. Substring scan, not a JSON parse (mitigated, not eliminated). The sniff is a raw substring
    match (case "$line" in *'"entrypoint"'*)) over up to 50 lines. Skipping any line carrying a
    "message" key closes the concrete scenario self-review raised (a transcript discussing this
    issue's own test fixtures, which literally contain the string "entrypoint":"sdk-py", matching
    on ordinary dialogue) -- but a false match confined to a bookkeeping-shaped, non-dialogue line
    that embeds the substring in some nested value is not eliminated.

  3. The message-field skip can mask the exact bug it exists to prevent. Not checked in either
    direction: whether an Agent SDK bookkeeping record can ever carry a top-level "message" key
    that is not the dialogue-content field (an error/status string on a queue-operation record,
    say). If it can, and that record is the only line inside the 50-line cap carrying entrypoint,
    the guard silently never fires and the exact false notice / force-save capture-gap notice fires for sessions whose transcript opens with queue-operation, while doctor reports the same session as saved #745 exists to fix
    reappears for that transcript. Unverified against upstream's own Agent SDK bookkeeping schema.

Why not fixed in #745 itself

Logged as trap.d/745.entrypoint-sniff-has-two-unfixed-edges.md (despite the name, three edges),
ranked deciding-worthy by a curation pass rather than mid-lane with only one issue's own context.

What would settle it

For (1): thread a marker-/save-record-aware check into previous_transcript(), after resolving
the CAPTURE_SEEN_DIR assignment-ordering question. For (2)/(3): a real per-line JSON parse (or a
narrower field-position check) instead of the raw substring match, with a test exercising a
bookkeeping record that itself carries a top-level "message" key.

[AI-generated]

Activity

  1. added
    priority:medium
    filed-by-loop
    lane-capture
    on Sep 26, 2026
  2. added a commit that references this issue on Sep 27, 2026
  3. removed their assignment
    on Sep 27, 2026
  4. added a commit that references this issue on Oct 5, 2026
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

    filed-by-looplane-capturepriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions