Skip to content

Record typed pre-routing signals in telemetry (#35) - #41

Merged
datacas merged 2 commits into
mainfrom
issue-35-pre-routing-signals
Sep 23, 2026
Merged

datacas merged 2 commits into
mainfrom
issue-35-pre-routing-signals

Conversation

@datacas

@datacas datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Closes #35 — #35

What changes in behaviour

Every stage row now records the signals its router could have known before choosing a model. Telemetry schema moves to version 2; the change is additive (all new fields live in payload), so version-1 rows are read exactly as written.

Kind Fields Source
declared difficulty, verifiability, security_sensitive router.TaskSignals (now also on blocked-routing rows)
observed changed_files_count, has_tests, touches_{dependencies,database,auth,api,migrations,ci}, changed_<language>_files diff against origin/<default_branch>, new scripts/stage_signals.py
observed prior_findings_{total,blocking,critical,high,medium,low} latest verdict recorded before the stage
observed previous_failed_attempts, resolution_round, verification_available cycle state; --verification available|unavailable
estimated changed_lines_estimate, test_count_estimate numstat text lines; added lines matching a test definition

telemetry.PRE_ROUTING_SIGNALS carries the same classification.

Temporal rule

  • implement is routed before any diff exists: no change signals at all (the observer is not even called).
  • prior_findings_* come from the previous verdict; a verdict without findings leaves them unknown instead of carrying an older count forward. Severity counts are recorded only when every finding names its severity.
  • previous_failed_attempts counts non-succeeded dispatches (including an attempt abandoned for a reroute and blocked routings) before this routing.
  • resolution_round only on resolve/rereview.

Unknown ≠ zero

Unreadable diff (no worktree, no resolvable base, no Git) → every change signal omitted. A readable empty diff → zero. --verification omitted → not recorded.

Privacy boundary

Paths and diff text are classified in memory and dropped. Languages are a fixed list of scalar counters (13 fields incl. other), never arrays or maps. New counts are bounded by FIELD_LIMITS (non-negative, difficulty 1–3). Unknown field names and containers are still refused by FIELD_SPECS. Path classifiers are heuristics (auth matched by whole word so processor ≠ sso), documented as such.

Out of scope, unchanged: the routing decision itself, Jev, any prompt/prose/path storage.

Verification

  • python3 -m unittest discover -s tests → 519 tests OK (33 new in tests/test_stage_signals.py: classifiers, real-Git collector, recorder temporal rules, driver severity counts, field validation/bounds, v1→v2 database compatibility)
  • python3 scripts/validate-package.py → VALID (manifest includes stage_signals.py)

Every stage row now carries what its router could have known before
choosing a model, and nothing learned afterwards:

- declared: difficulty, verifiability, security_sensitive;
- observed: diff counts, area flags and fixed per-language counters from
  the new scripts/stage_signals.py, for stages routed after the
  implementation only; prior findings by severity from the latest verdict;
  previous failed attempts; resolution round; and verification
  availability when declared with --verification;
- estimated: changed_lines_estimate and test_count_estimate.

Unknown signals are omitted rather than recorded as zero. Paths are
classified in memory and dropped; only bounded counts and flags reach
FIELD_SPECS. Telemetry schema moves to version 2 additively: all new
fields live in payload, so version-1 rows remain readable.

Closes #35
@datacas

datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Revisión inicial — CHANGES_REQUESTED

Revisé el diff acumulado de main (eb753452f2339c1e2a437e2ab65140e6e3802abc) a 563bb281cdfd67217805c4afdcc80f3a5a339fff para el alcance de #35: señales pre-routing, su persistencia tipada y documentación.

Hallazgos

[REV-001] · medium · open · blocks:yes — El rol run omite las señales del diff

Archivo: scripts/stage_signals.py, línea 62.

run está declarado como rol admitido en scripts/cycle.py:82, pero no aparece en CHANGE_OBSERVED_ROLES. Por eso, cuando CycleRecorder.stage("run", ...) se ejecuta después de que ya existe un cambio, no llama al observador y la fila de esa etapa omite los conteos y flags del diff que el router tenía disponibles. Esto incumple el criterio de que cada etapa registre su contexto pre-routing. Incluid run entre los roles observados y cubridlo con una prueba que confirme que el observador se ejecuta.

Triage y auditoría de seguridad

El cambio es sensible porque añade datos de observabilidad derivados del repositorio y define explícitamente límites de privacidad. Ejecuté la revisión de seguridad sobre el clasificador y la escritura en telemetry: no encontré vulnerabilidades confirmadas. El colector usa argumentos fijos para Git y reduce el diff a campos de una allowlist; las clasificaciones de rutas siguen siendo heurísticas.

Verificación ejecutada

  • python3 -m unittest discover -s tests -v — Ran 519 tests; OK.
  • python3 scripts/validate-package.py — VALID: 12 skills (6 cycle, 6 supporting), shared sections in sync, cross-agent manifests aligned.
  • Comprobación de roles soportados frente a roles observados — confirmó run supported: True y run observed: False.

No ejecuté un ciclo con agentes o proveedores externos; las pruebas unitarias y el validador del paquete sí se ejecutaron localmente.

CI y riesgos residuales

Los checks de GitHub observados para este HEAD están en SUCCESS: Skills, manifests, and Bash installer; PowerShell installer. No hay checks pendientes o fallidos. Las métricas de líneas, definiciones de tests y áreas tocadas mantienen el riesgo de error propio de las heurísticas descritas en la documentación.

Veredicto

Request changes hasta corregir y cubrir run con señales del diff. Revisé el HEAD 563bb281cdfd67217805c4afdcc80f3a5a339fff.

run is a supported role that is routed after a change exists, so its row
now carries the diff signals like review, resolve, security and verify.
A regression test covers every post-implementation role.
@datacas

datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Comment resolution — RESOLVED

Previous HEAD 563bb281cdfd67217805c4afdcc80f3a5a339fff → new HEAD 1a41be9231e08e61c94058f8b36135c8b7ae79a0.

Findings

[REV-001] · medium · resolved · blocks:yes — The run role omits diff signals

Files: scripts/stage_signals.py, tests/test_stage_signals.py.

Disposition: valid. run is a supported role (scripts/cycle.py) routed after a change exists, so it now belongs to CHANGE_OBSERVED_ROLES alongside review, rereview, resolve, security and verify. implement stays excluded on purpose: it is routed before its own diff exists.

Regression: test_every_post_implementation_role_is_routed_knowing_the_change asserts that the observer is called once and that the row carries changed_files_count for every post-implementation role. Reproduced before the fix — with the fix stashed it fails for role='run' — and passes after it.

Fix commit: 1a41be9231e08e61c94058f8b36135c8b7ae79a0.

Post-change passes

  • Code review of the accumulated fix diff (one role added to a frozenset, one test): no new findings.
  • Sensitivity triage: the fix touches no auth, input, API, dependency or security configuration, so no new security pass was needed. The PR-level security review from the initial review still applies.

Verification

  • python3 -m unittest tests.test_stage_signals — 34 tests OK
  • python3 -m unittest discover -s tests — Ran 520 tests, OK
  • python3 scripts/validate-package.py — VALID

CI

Checks for 1a41be9: Skills, manifests, and Bash installer — pass; PowerShell installer — pass. Nothing pending, failed or skipped.

Residual risk

Unchanged: path classifiers and the two estimates remain heuristics, as documented.

@datacas

datacas commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Rerevisión — APPROVED

Revisé el diff acumulado de main (eb753452f2339c1e2a437e2ab65140e6e3802abc) a 1a41be9231e08e61c94058f8b36135c8b7ae79a0. Desde la revisión anterior (563bb281cdfd67217805c4afdcc80f3a5a339fff), el commit 1a41be9 añade run a los roles que observan el diff y una prueba de regresión.

Hallazgo anterior

[REV-001] · medium · resolved · blocks:yes — El rol run omite las señales del diff

Estado: corregido y verificado por ejecución. run ahora figura en CHANGE_OBSERVED_ROLES; la prueba test_every_post_implementation_role_is_routed_knowing_the_change confirma que el observador se llama y que la fila incluye changed_files_count para todos los roles posteriores a implementación. No encontré hallazgos nuevos en el diff acumulado.

Triage y auditoría de seguridad

La triage sigue marcando el PR como sensible por sus cambios de observabilidad y privacidad en telemetry. Revisé el diff actualizado y la corrección: el commit nuevo solo amplía el conjunto de roles y añade cobertura; no introduce una nueva superficie de seguridad ni hallazgos confirmados.

Verificación

  • python3 -m unittest tests.test_stage_signals.RecorderSignalTests.test_every_post_implementation_role_is_routed_knowing_the_change -v — pasa.
  • python3 -m unittest discover -s tests -v — Ran 520 tests; OK.
  • python3 scripts/validate-package.py — VALID: 12 skills (6 cycle, 6 supporting), shared sections in sync, cross-agent manifests aligned.

No se ejecutó un ciclo completo con agentes o proveedores externos.

CI y riesgos residuales

Los cuatro checks actuales de GitHub están en pass: PowerShell installer y Skills, manifests, and Bash installer (dos ejecuciones de cada uno). Se mantienen los riesgos conocidos de las métricas derivadas mediante heurísticas, documentados en el PR.

Veredicto

Approve en el HEAD 1a41be9231e08e61c94058f8b36135c8b7ae79a0.

@datacas
datacas merged commit e7f14fe into main Sep 23, 2026
4 checks passed
@datacas
datacas deleted the issue-35-pre-routing-signals branch September 24, 2026 09:21
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.

Añadir señales tipadas y estrictamente pre-routing a telemetry

1 participant