The workflow reads the gate manifest - CI names no gate command. Run #1
caught two real issues local runs masked (libGL on headless images,
GITHUB_ACTIONS width rendering); fixed deterministic at the source, run #5
green in 1m17s.
Run #1 (6302e0b) failed at the tests gate for two reasons local runs
masked:
- The act image lacks OpenCV's runtime libs, so every
scenedetect-importing media test died on `ImportError: libGL.so.1`.
The workflow now installs libgl1/libglib2.0-0 with ffmpeg, and the
README documents the headless-Linux runtime libs for users.
- Rich rendered `va transcribe --help` at 80 columns and wrapped
`openai-transcriptions` mid-token: GITHUB_ACTIONS makes typer force a
terminal, and TERM=dumb then picks rich's 80-column fallback. Tests
now pin COLUMNS=120 before any Console is constructed and keep typer
in auto-detect mode, so help and doctor output are width-independent
of the runner.
Gates 4/4: 449 passed, 2 skipped; also green under
GITHUB_ACTIONS=true COLUMNS=80.
`.gitea/workflows/ci.yaml`: one `gates` job on the act_runner
`ubuntu-latest` label. Installs ffmpeg (the media fixtures skip silently
without it), uv via the official installer, `uv sync --locked`, then
iterates `.pi/verify.json` `gates[].command` — the manifest is the single
source, so the workflow restates no gate command and fails naming the gate
that failed. README carries the matching badge.
Issues #1-#10 closed citing their commits; --no-ff to preserve the cited
hashes; live CLI smoke verified the merged tree (probe, shots with cached
probe reuse, the documented ask diagnosis).
Two lessons from the review's root causes: test both source kinds at every
front-door seam (the URL-path bug survived local-path-only tests); a
registry's authority should be pinned by a test, not a comment.
The two-axis review found the binding contract contradicted by the diff it was
supposed to describe: section 2's map omitted analysis.py's report/synthesis imports
and mcp_server.py's synthesis import, and section 3 still documented pre-diff
signatures (it was edited in this very diff, so the drift was avoidable).
Section 2 rows now list what each owner actually imports (analysis gains report.py +
synthesis/vision; the front doors gain diarize/transcribe/synthesis; the stage rows
drop config.py, which no stage imports since #5), and the foundation bullet describes
route_model/ModelEndpoints/LLAMA_SERVER_COMMAND.
Section 3 now matches the code: fetch(force=), extract_keyframes(namespace=,
keyframe_time), Transcriber.identity/readiness, the SttBackend/DiarizeBackend enums,
Diarizer/get_diarizer (diarize(wav), constructor-owned options), StageCache.cached_run,
Pipeline.__init__'s keyword limits, analysis shots/describe -> Artifacts, cached()'s
None contract, checked_int, and the llm block (route_model/build_model/
llama_server_models/llama_server_up/LLAMA_SERVER_COMMAND). vision.llama_server_up is
gone from the contract because it is gone from the code.
Sections 4-6 follow: MediaFacts.has_video, ShotsPayload, the enum-typed Settings
fields plus load_settings, and the llm routing record/endpoint protocol/startup
command.
Two verification gaps from the review:
- the `transcript is not None` guard added in d94188e had no test. The stage skip
policy normally keeps a transcript-less diarize apply out of the scheduler's way,
so the test calls the apply callable the scheduler invokes (RunContext with no
transcript) and asserts the load leaves the run untouched; removing the guard
makes it fail with NoneType.model_copy inside attribute_speakers
- the third #9 divergence (va analyse --max-shots / --no-describe) was only
asserted CLI-side. The new parity test runs both doors against the same fake
pipeline and asserts identical stage calls *and* that max_shots=8 reaches the
shots stage from both (shown red against an MCP tool that dropped max_shots)
Issue #7 dropped the source string from the probe cache key so aliases of
identical bytes share one entry. The migration note existed only in that
commit's message; a reader upgrading the package had no in-repo statement of
what would (and would not) be recomputed.
- README cache section: probe artifacts written before the change are orphaned,
the first run recomputes them with one cheap ffprobe call, nothing else
changes shape, and the leftovers can be deleted
- README analysis section: shots()/describe() return the run's Artifacts
(rendering from artifacts.shots), which is the B2 seam
Issue #6's "alias" criterion was unfinished: vision.llama_server_up was a
one-line pass-through and vision also owned LLAMA_SERVER_COMMAND, which doctor
imported from vision - so the llama-server facts were spread over two modules
and a third consumed the copy.
- llm: owns LLAMA_SERVER_COMMAND next to the local provider name and the
llama_server_models/llama_server_up health check
- vision: drops the alias and the constant; describe_shots/describe_moment call
llm.llama_server_up, the actionable hint interpolates llm.LLAMA_SERVER_COMMAND
- doctor: imports the startup command from llm
- tests: the describer health-check stubs target llm.llama_server_up; the
localhost server stub (path + trailing-slash check) moves to tests/test_llm.py
with the rest of the llama-server tests; the duplicate closed-port test goes
_mcp_server probed the module for run/run_server/mcp/server with a getattr
ladder, plus a second server.run branch - names mcp_server always exports (or
never will), so most of the ladder was unreachable and the failure messages
described a situation that cannot occur.
- cli: one lazy `from .mcp_server import DEFAULT_HTTP_HOST, run` inside a
try/except that keeps the actionable install message; importlib is gone
- tests: the serve-mcp dispatch stub provides the two names the entry point
uses
The scheduler loop still special-cased one stage by name twice
(if spec.name == "ingest": the cache-hit "downloaded" rewrite and an extra
downstream invalidation under the content hash), while the table is supposed to
be the single encoding of the stage graph.
- StageSpec gains three policy fields: namespace ("content" by default;
"source" for ingest, whose artifact precedes the content hash), hit_update
(fields a cache hit overwrites) and force_invalidates_content
- RunContext.namespace and Pipeline._execute_spec read those fields; no
stage-name switch is left in the scheduler loop
- tests: the table declares exactly ingest as the source-namespaced, hit-updating,
content-invalidating stage; the existing cached/forced ingest behaviour tests
stay green
The "int, not bool, within range" guard was hand-rolled five times (analysis.moment
max_frames/width, analysis.frame width, mcp max_images, mcp transcript_max_chars),
and the MCP tool signatures re-typed max_shots=64 instead of importing the constant.
- analysis: checked_int(value, name, minimum=, maximum=) is the one implementation
(bool rejected, one message shape) and is exported for the doors; moment/frame use
it for their numeric knobs
- mcp: max_images and transcript_max_chars go through the same guard, and both
max_shots defaults are DEFAULT_MAX_SHOTS
- tests: the guard's message/range contract, moment+frame's public rejection paths,
both MCP tool guards (no stage runs), and the tool schemas' max_shots default
tied to DEFAULT_MAX_SHOTS (all shown red against a disabled range check)
"width is None and height is None" was spelled out at analysis._require_video,
analysis.analyse's diagnosis and pipeline's shots params/skip policy. A computed
property on MediaFacts names the fact once.
- models: MediaFacts.has_video (foundation file; the code-review record authorizes
this deliberate edit per ADR-0001)
- analysis/pipeline: the three sites ask media.has_video
- tests: the property over a video and an audio-only MediaFacts
analysis._window_segments re-implemented vision.transcript_slice_for's clipping,
word-midpoint test included - and the two had already diverged on the window
edge: the shot prompt used a half-open [start, end), moment used a closed one.
- vision: window_segments(transcript, start, end) is the one pure clipper,
returning TranscriptWindow (segment bounds, speaker, clipped text); half-open
so two abutting windows never speak the same word twice
- vision.transcript_slice_for renders those windows for the shot prompt
- analysis._window_segments clamps them into MomentSegment (vision imported
lazily, as describe_moment already is)
- tests: the shared half-open clipper directly, and moment's transcript slice
through the public operation: a word whose midpoint is exactly t_end is not
in the window (the moment half was red before the change)
Diarizer.diarize(wav, options) took an option value its constructor already
held, so every caller passed the same object twice. The two concrete backends
also exposed supported_options/ignored_options frozensets that nothing read -
speculative hooks that duplicated what cache_params already makes explicit.
- Diarizer.diarize(wav) uses the DiarizeOptions value the diarizer was built
with; the protocol docstring states that ownership and pyannote's applicable
knobs (num_speakers only; cluster/merge are sherpa segmentation settings)
- SherpaDiarizer/PyannoteDiarizer drop supported_options and ignored_options;
applicability stays observable in the protocol docstring, cache_params and
the pyannote cache-params test
- diarize_audio and the pipeline's diarize stage call diarize(wav) (the
injectable test-stage seam keeps its (wav, *, options) signature)
- tests: each backend applies the option value it was constructed with (both
were red: diarize() required the extra argument)
The backend name lists existed four times: transcribe's Literal/STT_BACKENDS,
diarize's Literal/DIARIZE_BACKENDS, a dead copy plus a misleading 'single source'
comment in config, and two CLI StrEnums re-spelling the STT names. A new backend
had to be added in three places to be selectable.
- transcribe/diarize: the registry is now a StrEnum (the one spelling of the
names); STT_BACKENDS/DIARIZE_BACKENDS derive from it, so the registry cannot
drift from its own type
- config: drop the dead DIARIZE_BACKENDS copy and the unused STT_BACKENDS alias
(the comment claimed a single source it did not provide); the fields reference
transcribe.SttBackend / diarize.DiarizeBackend directly
- cli: --backend uses the registry enums (typer renders their choices and
rejects unknown values) instead of private StrEnums
- tests: 'va transcribe|diarize --help' and an invalid --backend both show
exactly the registry's names (shown red against a hand-picked choice list)
Settings() was inlined at every command and tool, and three commands still
patched a profile field with model_copy. One construction path, once per
entry point, keeps the profile readable at the seam where a flag arrives.
- config: load_settings(**profile_overrides) constructs Settings once and
applies only the explicit (non-None) profile overrides
- cli: every command builds its settings at entry; --backend/--model go
through load_settings instead of a per-command model_copy; no Settings
import is left in the adapter
- mcp: every tool builds its settings once at entry and hands it to the
operation
- tests: behavioural flags (--no-diarize/--no-describe/--max-shots/--force)
travel in AnalysisOptions and leave the settings profile untouched;
--backend/--model override VA_* at the entry point (both tests were shown
red against a settings patch / an override-dropping load_settings)
The MCP extract_keyframes tool hand-built a dict with per-shot model_dump while
the CLI had its own private _ShotsPayload model for the same shape - a
pydantic-at-the-boundary breach (CONTRACTS 1 rule 2).
- models: add ShotsPayload (source, workdir, shots), exported next to Shot
- cli: drop the private copy and use the shared model
- mcp: structured content is ShotsPayload serialised, not a hand-built dict; the
shot/image counts stay in the human-readable summary
- tests: extract_keyframes structured content carries workdir and no ad-hoc keys
'va shots' and 'va describe' each ran the scheduler twice: a probe call only
to recover the payload's source/workdir, then the outcome operation. One
command must be one scheduler run.
- analysis: shots() and describe() return the assembled Artifacts from their
single run, consistent with probe()/analyse(); doors extract the field they
render (artifacts.shots, artifacts.source, artifacts.workdir)
- cli: 'shots' and 'describe' drop the extra probe run
- mcp: extract_keyframes reads the shot list from the returned artifacts
- tests: CLI command is asserted to be exactly one analysis operation, with
the JSON payload still carrying source/workdir/shots; the MCP/CLI analysis
stubs return artifacts from the narrow outcomes
An uncached http(s) source has no resolved content hash, yet probe/audio/
describe/report still hashed a None hash and then asked for a namespace,
so analysis.cached() (and therefore 'va ask <url>') raised the internal
ValueError 'stage probe needs a resolved source hash' instead of the
documented diagnosis.
- pipeline: the content-keyed stages return no cache key until video_sha is
resolved (one _content_key helper), matching _transcribe_params; cached()
therefore returns None and ask() raises its documented RuntimeError
- tests: cached()/ask() against an uncached URL (the missing case: the old
tests only used local paths)
The finale: mcp_server.py halved, one deep interface behind both front
doors, va moment shipped. Retro #2 on the #8 session: issue bodies drift
as waves land - briefs bridge with current-tree-wins notes. Remaining:
code-review pass, then merge to main.
One STAGES_TABLE of eight descriptors, derived downstream closure, a 72-line
scheduler loop, ingest as a real StageCache-backed stage. New decision entry:
ingest artifacts live in an ingest-key source dir; analysis artifacts stay
content-hash keyed.
The typecheck gate is wired: mypy 35 -> 0 on the branch, 29 sites fixed with
zero type: ignore, five named third-party overrides, 4th gate in verify.json.
New lesson: prose that counts gates goes stale - point at .pi/verify.json
and name no count.
The gate set grew to four with the mypy gate; AGENTS.md now names no count
(gate list is the environment's to hold - .pi/verify.json) and CONTRACTS.md
1.6 lists the typecheck command alongside lint and format.
Wave 1 auto-merged two branches into semantically broken calls while ruff, format and
pytest stayed green; a type checker is the mechanical answer. Measured on the base
(434745d): 35 errors in 10 files.
- pyproject: mypy as a dev dependency plus [tool.mypy] scoped to src/ at python 3.13.
Per-module ignore_missing_imports only for the five genuinely untyped third parties,
each comment naming the library (yt-dlp, PySceneDetect, faster-whisper, sherpa-onnx,
pyannote.audio); no global ignore
- .pi/verify.json: fourth gate, `uv run mypy src/`, on settle
- config: replace the StageOptions union alias (mypy cannot build it while config
imports the option modules that import it back) with five per-stage @overloads, so
options_for("shots").model_copy(...) types as ShotOptions; _stt_backend returns
SttBackend instead of str
- llm: build_model/llama_server_up/build_local_model take a new ModelEndpoints protocol
instead of Settings, so vision and synthesis hand over the DescribeOptions/
ReportOptions value they already hold (the wave-1 drift) rather than rebuilding a
Settings bag; vision.llama_server_up follows and drops its Settings import
- doctor: the two shadowed locals are renamed (a bool over a list[str] in _key_checks,
a ModelAssetCheck over a CheckStatus in _diarization_checks)
- media: narrow the optional activity curve into one adaptive_curve local instead of a
use_curve bool mypy cannot narrow through
- pipeline: the cached-turns re-attribution also requires transcript is not None
- synthesis/vision/transcribe/mcp: separate AgentRunResult names for the map and reduce
calls, list[BinaryImage] frame parts, a str weights location in both readiness
branches, a Segment annotation, and a literal-keyed HTTP_TRANSPORTS map
All 35 sites were type-level: no fix changes runtime behaviour on an existing path (the
vision Agent "no overload" error was a cascade of the invalid build_model argument,
proven with a probe), so there is no failing behaviour test to write; the gate itself is
the regression check. 400 passed / 2 skipped stay green and no `# type: ignore` was
added.
Closes#10
Wave 2: Transcriber identity()/readiness(), Diarizer protocol, single-sourced
routing - 400 passed / 2 skipped on arch-deepening. The retro on the wave-1
merger found the missing typecheck guardrail (25 errors at wave-1 tip, 35
after #6, incl. real bugs and wave-1 signature drift invisible to the three
gates); filed as issue #10, sequenced before the two biggest refactors.
Wave 1 landed #4, #5, #7 on the integration branch, gates 3/3, 373 passed /
2 skipped. Lessons: git auto-merges can be semantically broken (per-merge
full-suite gates are the safety net); worker worktrees come out before the
merger dispatch. New working agreement and two decision entries.
MediaInfo conflated content facts with a run-time handle, so byte-identical aliases could not share a probe artifact and every cache read needed a path-rebasing sweep.
- models: replace MediaInfo in one sweep with content-only MediaFacts and run-time MediaRef; Artifacts gains ref; MediaFacts.extra drops local filename/path keys on construction
- media.probe returns MediaFacts with no path/source and no ffprobe filename
- pipeline: probe params are the content hash only; attach MediaRef on every run; delete _rebase_media/_rebase_report; keep yt-dlp title/metadata as sanitized run-time facts for reports
- synthesis: prompts and metadata consume facts only; report assembly takes the run-time source; report metadata carries no local path
- cli/mcp: compose facts + ref where a local path or source display is needed
- CONTRACTS sections 3-4, README and PLAN reference the new shapes; tests cover the alias cache hit, facts round-trip and path-free report metadata
Cache migration: dropping source from the probe params changes probe keys, so existing probe entries are a one-time invalidation (one cheap ffprobe call per source).
Closes#7
Settings stays a config reader; stages now take a per-stage value (SttOptions, DiarizeOptions, ShotOptions, DescribeOptions, ReportOptions) instead of the whole settings bag. options_for(stage) is the single place that fills defaults, so the 0.7 diarize threshold, minimum segment durations and model resolution rules exist once.
The STT backend rule no longer inspects model_fields_set: an explicit stt_backend wins, else a non-default whisper_model selects whisper, else the profile default. Whisper with the default checkpoint is selected by stt_backend=whisper via env/TOML.
Pipeline runners, cache-key builders and the injectable stages= seam consume the option values. describe_shots and synthesise_report no longer take Settings. DiarizeOptions has no independent threshold default, and diarize_audio's sherpa happy path is covered with a fake sherpa module.
- Add StageCache.cached_run and route Pipeline._execute_stage through it.
- Cache Q&A answers under stage 'ask' keyed by the report fingerprint.
- Return PromptInfo from build_synthesis_prompt and record it in report metadata.
- Pin _report_json budget behaviour with named tests.
Per-project wiki following the aom convention: dated history, cited sources,
superseded entries kept. Seeds the goal page with the wave plan, decisions
page with the effort's record so far, and working agreements including the
wave-0 lesson: dispatch parallel waves only from a green, committed baseline.
The option only accepted "adaptive" and was then dropped: the pipeline
hardcodes the detector name in the shots cache key, so it could never
change behaviour. Typer now rejects --detector as an unknown option.
- cli.py: drop the option and its validation block
- tests/test_cli.py: assert the flag is absent from help and rejected by
typer; drop it from COMMAND_OPTIONS
- README.md: stop advertising the flag
- synthesis.py: rewrap two E501 prompt literals (the issue #1 fix) so the
repository-wide lint gate is green; prompt text is unchanged
Tracker: issue #2.
The repo failed its own lint gate (CONTRACTS.md 1.6): two implicit-concatenation
lines in SYNTHESIS_TASK and CHUNK_TASK were 309 and 121 characters. Both are
split across lines inside the existing parentheses; because Python merges
adjacent literals before anything sees them, the rendered prompt text is
byte-identical (verified by sha256 of every prompt constant before and after).
tests/test_synthesis.py previously only asserted fragments of the rendered
prompt, so the wording was unpinned. test_prompt_text_is_pinned_byte_for_byte
now snapshots all six prompt constants exactly, so a future reformatting or
reword shows up as a test failure rather than silent prompt drift.
Closes#1
The repo's own gate (CONTRACTS.md 1.6) had no enforcement layer - ruff was
failing on main (issue #1) because nothing ran it. Gates now run on settle
and via run_gates: ruff check, ruff format --check, pytest. AGENTS.md gains
a Standards & gates section pointing at CONTRACTS.md 1 as the binding
standard and at ADR-0001 for foundation-file changes.
The phase-2 blanket freeze on foundation files (models.py, config.py,
transcribe/base.py, ...) is reopened: deliberate changes are fine when they
land through a reviewed issue that records the motivation. The freeze left
behind exactly the friction the architecture review surfaced - a config bag
that shadows per-stage options, a one-method Transcriber interface callers
must reach past, a run-time path cached inside a content-addressed value.
- CONTRACTS.md: post-v1 note up top, 1.10 rewritten as the reviewed-issue
rule, ownership-map row updated
- docs/adr/0001-reopen-foundation-freeze.md: the decision and consequences
- GLOSSARY.md: the domain language, including the terms adopted by the
architecture issues (analysis module, front door, MediaFacts/MediaRef,
stage descriptor)
Tracker: issues #5/#6/#7 relabeled ready-for-agent (freeze approved);
#7 disposition decided (MediaInfo replaced in one sweep); #9 divergences
confirmed (transcribe follows settings.diarize, ask gains no_cache,
analyse gains --max-shots/--no-describe, va moment in scope).
Empirical sweep on the fast-cut vlog test video (9:14, single dynamic
narrator): threshold 0.5 split him into 15 speakers/46 turns, 0.7 gives
7 speakers/14 turns with S1 at 94% of speaking time (remaining fragments
coincide with genuinely different B-roll audio); 0.8 identical to 0.7.
New VA_DIARIZE_CLUSTER_THRESHOLD setting (in the diarize cache key);
synthesis prompts now instruct that S-labels come from automatic
diarization and one person may be split across several labels. After the
fix the report's people list is clean: narrator/host, John (off-screen),
the montage woman, Lee Sedol and AlphaGo (from OCR) - no S4/S10/S14 noise.
331 passed, 2 skipped; ruff clean.
Long shots (> VA_SUBDIVIDE_AFTER_SECONDS, default 20s) are now subdivided by a
deterministic frame-difference activity curve (one ffmpeg rawvideo pass, 64x36
gray at 2 fps): segment boundaries land at equal cumulative-activity quantiles,
so busy stretches are sampled densely and quiet ones sparsely; each segment's
keyframe sits at its calmest sample (a settled frame: clean slides, no
mid-transition blends) and carries a relative activity level that the vision
prompt surfaces to the model. Modes: VA_SHOT_SAMPLING=adaptive|uniform|scene.
Shot gains optional keyframe_time + activity fields; extract_keyframes honors
keyframe_time; shots cache key covers the new settings. Research basis: classic
IFD-curve content-adaptive summarization + AKS (arXiv:2502.21271).
330 passed, 2 skipped; ruff clean.
When the average detected shot exceeds 20s (talks, lectures, overlay-style
videos with no hard cuts), re-segment the video into equal ~15s segments
(capped at max-shots) so the vision stage sees the whole video; phash dedup
still drops visually identical frames. New Settings: uniform_sampling,
uniform_interval_seconds, uniform_max_avg_shot_seconds (all in the shots
cache key). Validated on the Two Minute Papers test video: 1 described
frame -> 28, including OCR of the on-screen paper references (Monien &
Speckenmeyer 1985, Schoning 1999), the 3-SAT example cards, and the paper
abstract sentence.
325 passed, 2 skipped; ruff clean.
- Settings.ollama_base_url / ollama_api_key (config.toml or VA_OLLAMA_* env),
falling back to OLLAMA_BASE_URL / OLLAMA_API_KEY, endpoint defaulting to
https://ollama.com/v1; remote endpoints without a key raise with instructions
- va doctor understands the settings-based key and hints at config.toml
- autouse test fixture makes the suite hermetic against the user's real
config.toml and provider-key env vars
- README/CONTRACTS/PLAN: mixed setup (local Parakeet STT + DeepSeek via Ollama
Cloud) documented; live-probed /v1 endpoint (200 on models, 401 on dummy key)
321 passed, 2 skipped; ruff clean