# Mission 001 — Continuation imports (>100 items)

## Objective
Make indexing reliably import **all** items in a playlist (1k+), not just the first page (~100).

## Current observed behavior
Continuation is discovered and fetched, but parses to zero items:

```
... page data {...}
... initial continuation token found {tokenLen: 606}
... continuation fetch ok {status: 200}
... continuation parse yielded 0 items {allPlaylistVideoRendererCount: 0, topKeys: ["responseContext","header","trackingParams","onResponseReceivedActions"]}
... import complete {pagesFetched: 1, total: 0}
```

Sometimes the continuation response includes an alert like:
- “The playlist does not exist.”

## Hypotheses to validate
1. The parser is not reading the correct continuation action shape under `onResponseReceivedActions`.
2. The response contains renderer types other than `playlistVideoRenderer` (e.g., frameworkUpdates/entity updates).
3. Continuation token/tracking params are not the exact ones tied to the playlist video list continuation.
4. Headers/body require additional Innertube fields (nonce, params, browseId variants), varying by account/session.

## Response shapes to support (explicit requirement)
The agent must plan for and handle **all plausible continuation response shapes**, including at minimum:

1) `appendContinuationItemsAction.continuationItems` (classic)
2) `reloadContinuationItemsCommand.continuationItems` (reload variant)
3) `onResponseReceivedActions` payloads (modern):
   - `appendContinuationItemsAction`
   - `reloadContinuationItemsCommand`
   - `updateSectionListContinuation` / `updatePlaylistVideoListContinuation`-style updates (if present)
4) `frameworkUpdates.entityBatchUpdate` / `mutation` based updates (entity-driven responses)

The current debug report shows `onResponseReceivedActions` is present, but the parser finds **0** `playlistVideoRenderer` nodes.

## Recommended analysis order (best practice)
1) **Enumerate all action containers** present in the continuation response (counts-only).
   - `appendContinuationItemsAction`
   - `reloadContinuationItemsCommand`
   - `onResponseReceivedActions`
   - `frameworkUpdates.entityBatchUpdate` (if present)
2) Then **map the exact path** to the playlist video items and the next continuation token (keys-only, one example path).
3) Propose a unified extraction algorithm covering all shapes.

## Read-only analysis deliverable (this run)

This Antigravity run is **read-only**: do not edit code.
Deliver a markdown report that includes:
- A concrete hypothesis for what action/path contains the continuation items in our failing response.
- A proposed extraction algorithm (pseudocode) that covers all shapes above.
- A minimal instrumentation plan (**exact log lines + where in code**) that does not dump full payloads.
- A patch plan listing exact files and functions to change.

Use `ANALYSIS_REPORT_TEMPLATE.md`.

## Required outputs (agent deliverables)
- A patch that makes continuation parsing succeed (items > 0, nextToken true repeatedly).
- A short note explaining the final response shape handled.
- Updated TESTING.md steps if needed.

## Acceptance criteria
- Watch Later with >900 items imports beyond 100.
- A normal playlist with >500 imports beyond 100.
- Debug report shows at least:
  - continuation fetch/ok repeating for multiple pages
  - continuation parsed items > 0 for multiple pages
- No new permission prompts; still local-first.

## Non-goals
- Global multi-playlist library search.
- Cloud sync / accounts / sharing.
