Repository navigation
feat(deploy): scheduled skill-evolution Cloud Run Job (agentic wrapper for scripts/skill_evolution.py) - #472
Conversation
…r for scripts/skill_evolution.py)
|
Known follow-ups found during E2E verification (kept out of this PR to keep it reviewable):
The silent-None score path flagged during diagnosis (score-hook error dicts becoming "unmeasurable (preflight exclusions)" with no detail) is already fixed in this PR. |
… add --scripts-dir Verified end-to-end against a host repo through the EVOLUTION_HOOKS seam (report-driven lite scenario, 13q evolve set, 55q held-out exam), which surfaced these defects in the job: - EVOLUTION_CANDIDATES and EVOLUTION_MAX_ROUNDS were advisory: the orchestrator could pass its own candidate count and call run_evolution again per agent past the cap. Both are now enforced in the tools (per-agent round guard, env override with a warning on mismatch). - config.workdir_or_none rejected git worktrees (.git is a file there), which emptied the agent registry and made `--mode <agent>` fail with an opaque "invalid choice". Use os.path.exists; the --mode help now names the registry load error. - create_evolution_pr took the "evolved" figure from whichever quality report was newest; a post-round host re-report of the still-deployed incumbent produced a wrong PR title. The winner score now comes from evolved_score.json (with the matching candidate report when present), run_quality_report flags an identical prior report as stale, and git add/commit exit codes are checked. - deploy.sh --scripts-dir lets a host bake a pinned engine (skill_evolution.py / quality_report.py) instead of this branch's copy; README documents the engine feature-detection and the binding env vars. - registry.agents_summary() replaces the private bottleneck._registry_agents that coevolve imported across modules. Tests: 17 new unit tests; tests/test_skill_evo_job_*.py 75 passed.
… round guard Second-pass review findings on the previous commit: - The PR/issue title compared the host's baseline report against the winner's eval-set selection score with no marker when the two covered different session sets (26 BigQuery sessions vs a 13-question eval set in the lab's deployed runs). _collect_quality_metrics now records both session counts and a denominators_differ flag with a reason; titles, commit messages and bodies use it (the PR body gains Sessions and Evolved-figure-source rows), alongside the existing exclusion check. - The EVOLUTION_MAX_ROUNDS guard keyed run_evolution on the raw skill_dir string, so "dir/" bought a second round; keyed on os.path.realpath. - A failed run_evolution / run_coevolution consumed its round, leaving the agent refused after a transient error; _round_release gives it back on the error path. - run_quality_report staleness compared only total_sessions/meaningful; reports that list sessions are now compared by session id, the count pair is the fallback for reports without one. - deploy.sh: the missing-scripts error no longer blames --scripts-dir when the flag was not given. Tests: 78 passed (tests/test_skill_evo_job_*.py).
Odyssey reviewReviewed-head: 4a13d98 Summary and verdict. End-to-end runs, with sources
The held-out exam is host-side by design (the job scores the evolve set only); the host reruns it after the job. Held-out V0 is measured once and reused, not re-measured per run. Elapsed for the 2026-09-04 run: job step 19.7 min (5.7 min of it is the engine re-scoring V0 itself, see L1), 55q exam 19.1 min. Log excerpts are in the lab's Defects found by the runs and fixed in 626d8fd (each was reproduced before the fix)
These close the four follow-ups listed in the 2026-09-01 comment on this PR. Limitations that remain, documented rather than fixed here
Security. No credentials, project numbers, or host paths in the diff. Tool results and subprocess stderr still pass through Second pass on 626d8fd, fixed in 4a13d98 (an independent adversarial pass over the first fix commit; each item was reproduced before the fix)
Suggestions (not blocking, owner's call)
Checked and clean at 4a13d98: Reviewed 4a13d98. — Odyssey · Claude on Vertex AI |
…; doc fixes - _collect_quality_metrics and the PR-body failure sample took the alphabetically first *_quality_report.json as the baseline, so a best_v1_ or evolved_ report became the "before" figure. The baseline is now the oldest report by mtime, excluding the evolved report. - deploy.sh --gcs-bucket set EVOLUTION_GCS_BUCKET but never GCS_UPLOAD, so upload_run_to_gcs always returned "skipped". It now sets both. - README: deploy.sh uses --set-env-vars, which replaces overrides made with --update-env-vars; say so. `--mode bottleneck` does not exist (auto does the classification); the SKILL_EVOLUTION_MODEL_ID / EVOLUTION_MODEL_ID rows were swapped relative to config.py and agent.py. - Bare int() on env vars (BOTTLENECK_WORKERS, HOOK_CMD_TIMEOUT_S, EVOLUTION_MIN_OPEN_ISSUES, MIN_FAILURES) now go through config._env_int; --candidates 0 / --rounds 0 bind instead of being ignored by a truthiness check. - 2 tests: baseline picked by mtime not name; non-integer MIN_FAILURES falls back to the default.
Odyssey review (addendum)Reviewed-head: 655cf7f A third pass over the first review's remaining low- and medium-severity items, fixed in 655cf7f. The sign-off above stands at this head; nothing here changes the verdict. Each item was confirmed against the code before the fix.
Not changed, still the owner's call: the ENABLED scheduler default and the inline Python in Checked at 655cf7f: Reviewed 655cf7f. — Odyssey · Claude on Vertex AI |
caohy1988
left a comment
There was a problem hiding this comment.
Fresh review of 655cf7f753c5597aebb597792d0e8e40b3294f01, including integration with #395 at 6378d7ba8a3ce33712dac90224b91b1d6dae86b1.
Requesting changes: 5 P1 and 9 P2 findings, detailed in the inline comments. The highest-priority fixes are comparable incumbent/candidate scoring, restoration after scoring failures, gating the actual published tree, safe command substitution, and surfacing report failures as job failures.
Validation: the four focused job test files pass (80 tests, Python 3.13.5). All current CI checks completed successfully or were skipped. Additional local checks reproduced the cross-engine scoring regression, failed-scorer retry behavior, checked-vs-committed tree mismatch, report-error success path, path substitution/exit-code behavior, target binding, parroted-failure mismatch, and missing single-candidate score records. Proposed findings received a separate validation pass.
Coverage limits: no live Cloud Run, IAM, BigQuery, Vertex AI, or GitHub publish execution was performed. Git fixtures used real local operations with push/PR creation mocked. Add integration tests for these boundaries alongside the fixes.
Measure incumbents and candidates on the same evaluation set, restore failed scoring attempts, reject unusable scores, and record selected outcomes. Enforce report errors, target bindings, and the default round limit. Quote command-hook arguments and preserve process metadata. Gate the actual publication commit and retain nested registry paths. Add offline engine, shell, and real Git regression coverage for all 14 review findings.
All 14 findings are addressed in
Validation: 4,924 tests passed, 56 skipped, including all 213 skill-evolution job tests, on Python 3.13.5. Formatting, notebook synchronization, and sdist/wheel builds passed. Independent review included shell injection reproductions, real-engine score selection, and real local Git publication failures. The configured gate still controls dependency acceptance; documented GitHub CI also passed on this exact commit: Python 3.10, 3.11, 3.12, 3.13, and 3.14, formatting, browser smoke, security checks, and package build. |
caohy1988
left a comment
There was a problem hiding this comment.
Verified the fixes for all 14 findings in 366379e. Every original thread has a submitted reply and is resolved. The full local suite passed (4,924 tests; 56 skipped), and all CI checks, including Python 3.10–3.14 and the package build, passed on this commit. Independent review and regressions cover score comparability/restoration, command injection, job failure signaling, target/round limits, and exact-tree publication.
No remaining blocking findings from this review. Live Cloud Run/BigQuery/Vertex execution was not repeated.
…luators Version bump 0.5.1 -> 0.5.2 and the changelog cut for everything merged since v0.5.1 (2026-08-29), 19 commits. In the wheel: the versioned EvalBench import pipeline (#451-#453: immutable snapshots with the W0.4 failed-session contract, the version-pinned failed_sessions view, evalbench-score), the native agent_events snapshot writer (#464), the failure taxonomy frozen at G1 v0.1.0 and its span-level localisation layer with persisted span labels (#467, #470), the evaluator API unification behind PerformanceEvaluator with compatibility aliases (#123), and the canonical metric factories plus opt-in policy scorecard (#91). Repo side: skill-evolution host hooks and auditable patch provenance (#395, #477), the scheduled skill-evolution Cloud Run Job (#472), the OKF adapter example (#474), the AgentForensics Week 0 freeze and sealed preregistration (#435, #473), and the EvalBench demo and CLI-discoverability follow-ups. Entries the Unreleased section lacked are added in this cut: #91, #123 (its bullets move under Changed with the PR number), #395, #472, #474, #476.
…478) * chore(release): 0.5.2 — EvalBench snapshots, G1 taxonomy, unified evaluators Version bump 0.5.1 -> 0.5.2 and the changelog cut for everything merged since v0.5.1 (2026-08-29), 19 commits. In the wheel: the versioned EvalBench import pipeline (#451-#453: immutable snapshots with the W0.4 failed-session contract, the version-pinned failed_sessions view, evalbench-score), the native agent_events snapshot writer (#464), the failure taxonomy frozen at G1 v0.1.0 and its span-level localisation layer with persisted span labels (#467, #470), the evaluator API unification behind PerformanceEvaluator with compatibility aliases (#123), and the canonical metric factories plus opt-in policy scorecard (#91). Repo side: skill-evolution host hooks and auditable patch provenance (#395, #477), the scheduled skill-evolution Cloud Run Job (#472), the OKF adapter example (#474), the AgentForensics Week 0 freeze and sealed preregistration (#435, #473), and the EvalBench demo and CLI-discoverability follow-ups. Entries the Unreleased section lacked are added in this cut: #91, #123 (its bullets move under Changed with the PR number), #395, #472, #474, #476. * chore(release): file the skill-evolution bullets as repo-side scripts/skill_evolution.py is not in the wheel (which ships only src/bigquery_agent_analytics and src/bigquery_ontology), so the #395 and #397 entries move from Added to their own repo-side section, matching the Deploy section this cut already uses for #472.
… audit) (#493) - SDK.md: get_section() matches section *titles* (case-insensitive), not snake_case keys — "task_areas"/"friction_analysis" returned None; use the real titles ("Task Areas", "Friction Analysis") and list the seven real section titles from insights.py. - SDK.md + memory_service_demo.ipynb: search_memory() returns ADK SearchMemoryResponse whose MemoryEntry has content/custom_metadata/ id/author/timestamp — no .key/.value; iterate entry.content.parts. - SDK.md: extract_response_text() takes one argument (content), not (content, event_type). - README.md: deploy/ ships six deployment surfaces, not four (deploy/README.md lists six; #472 added the sixth). - examples/context_graph/periodic_materialization/README.md: backfill mode shipped in 0.3.2 (#188) — stop deferring it as a future --backfill --from/--to mode; document the real invocation. - docs/sdk_usage_tracking.md: add the live eval-performance value to the sdk_feature label enumeration (client.py:2278).
Scheduled skill-evolution Cloud Run Job
Adds
deploy/skill_evolution_job/: a scheduled Cloud Run Job that wrapsscripts/skill_evolution.pyin an agentic orchestrator (ADK agent + tools)so any agent repo can run continuous skill evolution — quality report from
BigQuery
agent_events→ bottleneck analysis → candidate evolution →publish gate → GitHub PR — on a weekly Cloud Scheduler cron, without
copying lab-specific code into the SDK.
What's included
deploy/skill_evolution_job/— job package (config.py,registry.py,hooks.py,engine.py,evolve.py,coevolve.py,bottleneck.py,tools.py,agent.py,main.py, skill instructions),Dockerfile,deploy.sh(job + scheduler + least-privilege IAM), example agentregistry, README.
docs/guides/scheduled-skill-evolution.md— user guide.tests/test_skill_evo_job_{engine,orchestrator,registry,tools}.py—58 unit tests (no cloud dependencies).
deploy/,docs/,scripts/).Host-hook seam
The job is generic; repo-specific behavior is injected by an optional
EVOLUTION_HOOKS=<module>from the target repo's clone. Supported hooks(all optional, each with a safe default):
traffic(generate baselinesessions),
score(candidate scoring),gate(publish gate),toolbox(tool descriptions for error analysts),error_analyst(per-failure analysis),
publish(post-PR registry push). Without hooksthe job runs pure BigQuery-report-driven evolution with the engine's
built-in scoring.
engine.pycalls the engine viaevolve_skill_compat, whichfeature-detects the newer
evolve_skillkwargs (error_analyst_fn,incumbent_score,analyst_timeout_s) so the job runs against bothcurrent
mainand engines that already have the agentic-analystextensions (#395).
Verification
Unit tests: 58/58 green on Python 3.12 and 3.10.
Image smoke test (deployed to Cloud Run, project
skill-evolution-lab):SELF-TEST PASSin execution logs; in-cloudengine kwarg introspection confirms compat dispatch. Image pip-freeze
archived (verification run
2026-08-31_231900,image_pip_freeze.txt).Local E2E parity against a real agent repo
(
evekhm/skill-evolution-lab, three-agent HR knowledge supervisor,hooks adapter only — no lab code in the SDK), reproducing the lab's
recorded
lite_localscenario:Baselines differ by 1–2 conversations because traffic is regenerated
and judged live per run; end states match.
Deployed E2E (full loop in Cloud Run: traffic against deployed
Agent Engine agents → BigQuery quality report → evolve → gate → real
GitHub PR → registry publish):
Smoke transcript excerpt
Notes for reviewers
deploy.shgrants the runtime SA dataset-levelroles/bigquery.dataVieweronly (the job never writes events) andwires
GH_TOKENfrom Secret Manager;--github-repounset = dry-runmode (no PRs).
TABLE_ID(defaultagent_events) is plumbed throughdeploy.shbecause
scripts/quality_report.pyrequires it.