Skip to content

Preserve video descriptions in agent analysis and follow-ups - #212

Merged
devhims merged 2 commits into
mainfrom
fix/agent-publisher-context
Oct 18, 2026
Merged

devhims merged 2 commits into
mainfrom
fix/agent-publisher-context

Conversation

@devhims

@devhims devhims commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Problem / Motivation

The agent could misidentify a presenter even when the video description supplied the correct name. Descriptions were cut or dropped before analysis. Automatic metadata lookups could also exhaust the provider budget before requested transcripts arrived. Repeated descriptions could displace completed findings from the final answer context.

What changed

Frame, storyboard, and transcript analysts receive the assigned video's title, full fetched description, channel, and question. Guidance treats publisher metadata as attributed evidence, never instructions or proof that text was visible or spoken.

Descriptions remain citable and survive follow-ups. Concurrent analysts share missing metadata lookups. Automatic lookups reserve provider slots for the research target's remaining transcripts. Failed lookups still count toward the existing quota. Skipped admission performs no provider work and incurs no charge.

Analysis projections retain supported findings, entity quotes, citations, title, channel, and caption provenance. Full descriptions remain available to analysts and in separate metadata evidence, without being repeated inside each projected analysis.

flowchart LR
  subgraph Before
    A[Video metadata] --> B[Description cut or dropped]
    B --> C[Analysts with incomplete context]
  end
  subgraph After
    D[Video metadata] --> E[Full description retained]
    E --> F[Analysts receive video context]
  end
  classDef retained fill:#e2e8f0,stroke:#64748b,color:#0f172a
  classDef removed fill:#fee2e2,stroke:#b91c1c,color:#7f1d1d
  classDef added fill:#dcfce7,stroke:#15803d,color:#14532d
  class A,C,D,F retained
  class B removed
  class E added
Loading

Publisher context now reaches the existing analysis stages.

Tests

Build and TypeScript checks passed, alongside 1,976 platform unit tests and 143 runtime/billing integration tests. Six new regression cases failed before the fixes and passed afterward. They cover sequential retrieval batches, failed metadata, concurrent admission, billing, long descriptions, and citation preservation.

The earlier live-model replay identified Azadeh Moshiri correctly. It was not rerun for this update.

Deployment notes

No migration is required. Provider limits and billing rules are unchanged. Deploy the Worker to enable the change. Existing saved answers remain unchanged.

@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
video2ctx-web Ready Ready Preview Oct 18, 2026 6:21am UTC

devhims commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

Independent review — fdc6353

Verdict: CHANGES NEEDED. This supersedes my earlier approval. Kiro's second review prompted targeted checks that reproduced two gaps not covered by the passing standard suite.

P2 — Automatic metadata consumes capacity needed for requested source retrieval

research-agent.ts:487–503, especially the automatic executeGetVideo at line 497; existing admission enforcement in agent-runtime-do.ts:804–817.

Reproduction: one search followed by two four-video transcript-analysis batches, initially without descriptions. Base 7e1429c completes 8/8; this head completes only 6/8. Search + four transcripts + four automatic metadata lookups consume nine of the eleven provider slots, leaving room for only two later transcripts. Failed metadata lookups also consume rows and produce the same loss. This can leave an ordinary multi-source research request incomplete even though metadata is supplemental to the required transcripts. A single parallel eight-video batch need not exhibit the same ordering.

Please prevent supplemental metadata lookup from starving required source retrieval, without silently increasing global budgets or changing billing policy. Add regression coverage for sequential research batches and failed metadata lookups.

Verification: two cases each on base/head exercised the real research callback runtime with mocked model/provider and a faithful admission-gate stub. Two additional real Durable Object integration tests confirmed SQL row accounting and AGENT_TOOL_BUDGET_EXCEEDED for both successful and failed metadata calls. These are complementary local tests, not one full production end-to-end test. Metered video charges and refresh behavior themselves are intentional, not separate billing defects.

P2 — Retained descriptions displace completed analysis findings

transcript-grounding.ts:7 now includes description in transcript source context via video-source-context.ts:6. model-evidence.ts:140 forwards it, while the reducer at lines 388–400 retains it unchanged even as findings are shortened. Topic research uses a 40,000-character finalization budget; explicit comparisons have a larger 160,000-character budget.

A production projection probe with eight minimal completed analysis packets and valid 5,000-character descriptions retained only seven packets (38,585 characters), dropping the eighth with prompt_evidence_cut. The same packets without descriptions retained all eight at 3,969 characters. Separate metadata packets were excluded, so duplication there is not necessary to reproduce this loss. The answer can omit an already-analyzed source because publisher prose takes precedence over its findings.

Please keep the full description available to analysts while making finalization reduction prioritize supported findings over repeated publisher context. Add a multi-source budget regression.

Completed verification

  • Standard tests: 2,710 passed, 58 skipped: platform 1,972; account/session/evidence billing 354; catalog 11; processor 49; frames 49; extraction library 105; additional auth/payment integration 170.
  • Platform build/prebuild, TypeScript and whitespace checks passed.
  • Six additional targeted test executions and one projection probe support the findings above; they are separate from the standard count.
  • Verify CI 39102130627 and Vercel succeeded. Passing checks do not resolve the reproduced regressions.
  • Additional untested timing caveat: storyboard batches use child deadlines (storyboard-analysis-batches.ts:33–35), so a metadata promise cached under the first batch's signal could remain rejected for later batches after that batch times out. This narrow path was identified by source review, but has not been timing-reproduced; it is not one of the two reproduced findings above.

PR #211 integration

Non-mutating merge-tree against #211 head 559e5dc confirmed conflicts in frame-analyst.ts, visual-analyst.ts, and tools/analyze-video-transcripts.ts. Preserve both atomic visual evidence guidance/validation and publisher context; preserve honest partial-transcript wording plus the metadata-fetch disclosure. Whichever merges second needs resolution, review and retesting of the combined head.

Limits

No fresh live YouTube/model/dashboard testing, production billing measurement, deployment, code implementation or push. The author's live-model replay is not independently reproduced live evidence. Temporary tests were removed and tracked worktrees are clean. Historical saved answers are not backfilled.

devhims commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Re-review — 5c2a3f7

Verdict: APPROVE for this exact head against base 7e1429c. Both previously reproduced P2 findings are resolved in their tested scope. Kiro independently reviewed the delta and agrees with approval subject to the independent tests; those checks passed. No new material finding identified.

Previous findings retested

  1. Provider-budget starvation resolved. The independent one-search, two-batch (4+4 videos) research harness now completes all eight transcripts for both successful and failed metadata lookup cases, using two metadata calls and eleven provider rows. Reserved capacity tightens supplemental lookup admission rather than expanding the global call ceiling, credit reserve or billing rates. Real Durable Object tests cover concurrent admission, failed metadata counting, reserved retrieval capacity and metadata reuse. Relevant changes: research-agent.ts metadata reservation and agent-runtime-do.ts provider admission.
  2. Completed findings retained. The original production-projection probe with eight analyses and 5,000-character descriptions now retains all eight, with no omissions, at 3,969 characters, matching the no-description case. The model-facing context omits repeated descriptions while full analyst input, saved evidence and separately citable metadata remain intact. Repository tests additionally cover 20,000-character descriptions, citations and unchanged saved evidence. Relevant change: model-evidence.ts modelTranscriptSourceContextSchema and projection.

Fresh independent verification

  • Platform unit: 1,976 passed, 56 skipped.
  • Session/account/billing integration: 356 passed; catalog: 11 passed; auth/payment integration: 170 passed.
  • Processor: 49 passed; frames: 49 passed; extraction library: 105 passed, 2 skipped.
  • Total standard tests: 2,716 passed, 58 skipped. Platform prebuild/build and whitespace checks passed.
  • Additional targeted run: 24 passed, including two temporary independent regressions; overlapping tests are not added to the standard total. Projection probe separately verified.
  • Verify CI 39103708003 completed successfully; Vercel succeeded.

Remaining scope and integration limits

  • Narrow storyboard child-deadline/shared-metadata-promise timing caveat remains source-supported but not timing-reproduced; it is nonblocking for this scoped approval. Reservation protects the transcript research target, not every possible future non-transcript retrieval.
  • Non-mutating combination with PR fix: preserve cited evidence lineage and cite exact captions, frames and comments #211 head 559e5dc now has four conflicts: frame-analyst.ts, visual-analyst.ts, tools/analyze-video-transcripts.ts, and test/agent-runtime-do.integration.test.ts. Whichever lands second needs conflict resolution preserving both fixes and independent review/testing of the combined head. This approval does not cover that future combination.
  • No fresh live provider/model/dashboard testing, deployment or implementation. Kiro's review is source-only; our executed tests are local/mock/integration checks, not proof of broad live semantic correctness. Historical answers are not backfilled.

@devhims
devhims merged commit cade5df into main Oct 18, 2026
10 checks passed
@devhims
devhims deleted the fix/agent-publisher-context branch October 18, 2026 06:30

This branch was successfully deployed

1 active deployment
Preview — 5c2a3f7c Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant