Repository navigation
feat(skills): report-from-sources inventories data files and reads series exactly - #5453
Conversation
Deliverables built from a user's files came out complete-looking but missed what a careful analyst catches: facts the source stressed, the newest file, the rare incident behind the routine noise, commitments said in passing, and items the user explicitly asked for. These skills carry that practice. - report-from-sources: inventory inputs and pin the newest matching period, keep a key-facts ledger per source, put source and period on every figure, check the saved file against the ledger, and finish with a numbered requirements check against the request. - log-triage: whole-range parsing, message templates, ranking by severity, hosts hit and rarity rather than volume, burst detection, exact first and last timestamps, and results derived only from the provided logs. - meeting-actions: explicit and implicit commitments, owner/due/evidence, one row per item across meetings with status taken only from the text. - transcribe-meeting: its brief now counts spoken commitments as action items. Every python snippet was run against invented sample files. Eval scenarios are deferred in the coverage test until a corpus exists for each.
… companions report-from-sources pairs with office-docs and data-explore, meeting-actions with transcribe-meeting, so the catalogue and load_skill point to them together once pairs_with (amd#5422) lands; the key is ignored until then.
…e FATAL lines as alerts meeting-actions folds an item that the user's notes or another source restate into the row from the minutes, and checks rows with the same owner and similar wording for duplicates before saving. log-triage says a steady FATAL/ERROR template is baseline: report it once as background, never in an alert total.
…cates log-triage builds an entity list only from anomaly templates and checks the share flagged: a list holding most entities means the rule matches the baseline. meeting-actions runs a duplicate check (same owner, overlapping key words) before saving, so an item restated in a second source stays one row.
A follow-up such as "chase Sam for the budget" belongs on Sam's row, not a new action. The duplicate check now also pairs rows with different owners when one row's task names the other's owner.
…ot done meeting-actions states the test for a row (someone took on a specific future task), says discussion points and decisions are not actions, flags a tracker with far more rows than the meetings assigned, and keeps an item open when only a plan or date for it was stated.
…core tools A skill shipped inside GAIA already registered its tools.py on load_skill in a checkout (code-trust deferral only applies to captured skills), but the frozen flagship binary never carried hub/skills, so a domain tool moved into a starter skill vanished from the release. Skill tools were also classified by their namespaced name, so a skill's write_* tool skipped the confirmation set and the verify-after-change / turn-scope checks its core namesake meets. - freeze.py stages every hub/skills/<name> under gaia_agent/skills, adds the imports of each bundled tools.py and scripts/*.py as hidden imports, and fails the build on a missing import or a name clash between roots. - bare_tool_name() strips the <skill>/ namespace; is_mutating_tool and the confirmation gate use it. A skill tool named like a gated core tool always asks; no skill grant pre-authorizes it. - The tool-description lint now also checks bundled skill tools. - Tests: bundled tool registers on load and unregisters on unload, scripts/ run by path via run_python, every code-shipping bundled skill audits ALLOW, freeze staging and import collection.
…and python-docx A skill that imports pptx or docx and declares python-pptx or python-docx in metadata.gaia.requirements.dependencies was still flagged with supply.undeclared_dependency, because the import-to-distribution map had no entry for either. Declaring the import name instead would name a package that is not the one installed.
…ries exactly Small models picked last year's workbook when this year's sat beside it, misread two-row headers, and retyped or guessed series values. The skill now ships three tools in its tools.py: - inventory_data_files(folder): per sheet the layout, header rows (multi-row and merged), units, period coverage and series names; files holding the same dataset grouped and ranked by vintage (data through, as-of line, name period, revision, mtime), with older copies named. - series_from_workbook(file_path, labels, periods): label match echoed back, ambiguity and missing labels reported with candidates instead of guessed, wide and long layouts, units and footnote markers, values exactly as stored with each value's cell and a provenance line. chart_input is shaped for pptx_chart.add_native_chart, which the deck skill can import. - chart_into_workbook: the same series as a table plus a native Excel chart with a source and period footnote, reread and compared before success. The procedure now leads with the tools (manual snippet kept as fallback), puts the summary first, an as-of line in the header and a Conflicts and gaps section in every deliverable, marks figures as stated or computed, and adds a reverse trace so a number with no source is caught. Example paths are placeholders.
|
Verdict: Approve with suggestions This gives the Two things to settle before or soon after merge:
Real-world evidenceN/A: no evidence bundle was produced for this run. These are skill tools, called by the agent at runtime, with no CLI, REST or Agent UI surface of their own. This runner also had no test environment (no pytest or openpyxl), so I couldn't re-run the PR's test plan here. The verdict rests on static review plus the author's checked test plan and CI. Real tool use by a model, the eval item above, is still unproven. 🔍 Technical details🟡 Important
🟢 Minor
Strengths
|
…references A skill's tools.py had no way to see the agent calling it, so a skill tool read any path the model passed, and a tool that needed a program or a scratch file had to use subprocess / tempfile directly, which the audit flags and the loader cannot admit. gaia.skills.context gives skill tools a sanctioned route for each, checked against the running agent and the skill's manifest. - Paths: check_read / check_write use the agent's validate_read / validate_write. Path-named tool arguments are read-checked before a skill tool body runs. - program:run:<name> (scoped) and scratch:write are new bridged permissions, reachable only through run_program (no shell, scrubbed env, timeout) and temp_dir / write_temp_file / copy_to_temp (per-call folder, deleted after). The audit matches these calls to declarations; tier ceilings cover them; a non-bundled skill that runs programs asks before each tool call. - preferences(): per-user, per-skill JSON under <gaia_home>/skill-preferences, validated against an optional preferences.schema.json, writes skipped in private chats and with memory off. Agent UI endpoints list, read, update and reset them.
…art-from-data-tool
…s allowed folders The tools used their own GAIA_ALLOWED_PATHS and secret-file checks, so a folder the user approved this session was refused. They now go through gaia.skills.context: check_read and check_write, readable_entry for files found in an inventoried folder, and a new open_read for the CSV and JSON readers. open_read is open() for reading after check_read, so the audit no longer flags those reads and returns ALLOW.
Skill tools that stream the user's files (logs, CSV exports) had no scope-checked way to open them, so the log-triage and report skills each grew their own open_read. One set now lives in gaia.skills.context: - open_read(path, mode="r"|"rb", encoding/errors/newline): opens the path check_read resolved, so a symlink or junction landing outside the allowed folders is refused; text defaults to UTF-8, never the locale's. - open_write(path, mode="w"|"x"|"a" [+b], ...): check_write first, overwrite confirmation included, then creates missing parent folders. - list_readable(root, recursive=True, include_hidden=False): files under an approved folder; secrets and out-of-scope links are dropped without a prompt per file, and linked folders are not entered. None needs a filesystem permission; the audit still flags a raw open().
…art-from-data-tool # Conflicts: # docs/spec/agent-skills.mdx # src/gaia/skills/context.py # tests/unit/test_skill_context.py
|
Dropped this PR's own 🔍 Technical details
|
…ILL.md A small local model with a 64K window followed long skill bodies less reliably, and this body was about 3,800 tokens with five scripts inline. - SKILL.md body drops to about 890 tokens: newest data vintage, a key-facts ledger per source, every number sourced, nothing from outside the sources, check the saved file, plus a five-step procedure and a two-row ledger example. - The inventory fallback, ledger detail, build rules, coverage and untraced-number scripts, and the worked requirements checklist move to references/*.md, each linked with when to read it. - Tool descriptions are trimmed to what each call returns.
|
Trimmed the report-from-sources instructions so they stop crowding small 64K-context models: about 3,800 tokens loaded per turn is now about 890. The body keeps newest vintage, the key-facts ledger, every number sourced and the saved-file check; the five scripts and the worked checklist now sit in reference files. |
# Conflicts: # .github/workflows/test_unit.yml # hub/agents/gaia/python/packaging/freeze.py
A file the model could read only by forcing orientation in series_from_workbook could not be charted, because the chart tool always auto-detected. It now takes the same orientation argument and passes it through, so the two tools agree on every file. The trimmed SKILL.md body also stopped naming list_files, which it still declares in tools_required; the procedure now points at it for the not_read fallback, which clears the starter-skill manifest test.
|
Merged main and fixed two things: the chart tool now takes the same This PR still carries #5421, #5450 and #5454 underneath it, so land those first; on its own it is about 6.4k lines (4.0k skill code, 1.4k tests, 0.6k fixtures). 🔍 Technical details
|
…reach (amd#5653) Of the last 150 bug fixes, 147 shipped a regression test, yet CI caught only about 7 of those bugs before users or RC testing did. Each test guards the one call site that broke, and the next site with the same flaw ships untested. Meanwhile every PR ran all ~27k unit tests on three operating systems, even for a docs edit, and most main-branch runs were cancelled before they finished. This PR guards the recurring bug shapes everywhere, fixes a real bug the new tests found, and makes a PR run only the tests it can affect. - **Guards for the shapes behind most recent fixes.** A ratchet counts subprocess and HTTP calls with no timeout, kill-by-image-name, and `except Exception` bodies that only pass or return a placeholder. Existing sites are grandfathered, new ones fail CI, and fixing one lowers the count. - **Folder grants were lost when several GAIA processes saved at once.** A four-process test lost 96–98 of 100: the read-modify-write had no lock, and a torn read "rebuilt" the file from empty. It is now locked and atomic. Six runtime calls that could hang forever now time out, with actionable errors. - **PRs run only the reachable tests.** `util/select_tests.py` combines a nightly per-test coverage map with static rules for what coverage can't see. Windows and macOS run the OS-touching subset of that. The median PR runs about a quarter of the suite. On ~1,150 recent commits, it selected every bug fix's own regression test from the fix's source changes alone. - **Full coverage moves to main and nightly.** Every push to main runs the full suite on Linux and now finishes instead of being cancelled. The nightly run covers all three operating systems and rebuilds the map. The frozen flagship binary also builds on packaging PRs and weekly, not only at an RC. - **Duplicates trimmed.** The email unit lane no longer re-runs ~90 files `test_unit.yml` already covers, and the warning-only C++ benchmarks run on main instead of every PR. Also unbreaks main's TUI build: amd#5464 documented the desktop app's `gaia` shim in backticks, and the TUI doc check only exempted it before a space, so every PR's TUI checks went red. The shim is the Python CLI's, so the exemption now accepts any punctuation after it. Trade-offs to know: a Windows- or macOS-only bug outside the OS-touching subset surfaces at the nightly run, not on the PR, and PRs no longer upload partial coverage to Codecov. To run the full suite on a branch, dispatch `test_unit.yml` on it. ## Test plan - [x] `pytest tests/unit/test_select_tests.py tests/unit/test_process_safety_ratchet.py tests/unit/test_allowed_paths_concurrency.py`: 26 + 33 + 1 passed; the concurrency test fails on the old code (96–98 of 100 grants lost) - [x] Full `tests/unit` locally: 27,501 passed; 26 failures that fail identically on main in this environment (PATH-installed `gaia`, real wheel installs) - [x] `python util/lint.py --all` passes, including the lane-coverage, path-coverage, trigger and ancestor-skip checks - [x] Selector replayed over ~1,150 recent commits with a map built from a real `--cov-context=test` run - [ ] After merge: the first nightly run saves `unit-test-map-*`, and the next PR's "Select unit tests" summary reports a map-based selection <details> <summary>🔍 Technical details</summary> - Static rules: module-level imports (transitive); every import and module-naming string in tests and tooling (transitive); filename strings and directory scans (one hop); nested `conftest.py`; top-level fixtures by requested name, through fixture chains; autouse isolation fixtures (one hop); CLIs run with `python -m`, whose lazy imports coverage can't see. A package `__init__` reaches everything below it when it changes, but the walk never continues through one. - Full-run triggers: any `conftest.py`, packaging or pytest config, the selector or `test_unit.yml`, and any deleted or renamed file (`git diff --no-renames`). So does a selection over 70% of the suite. - With no map (a cache miss), function-level imports are followed too and the job summary says so; a map over 3 days old raises a warning. - A push diffs against the last commit a successful main run tested, so merges whose runs were dropped while pending still reach Windows and macOS. The event name is in the concurrency group, so a push can't drop the nightly. - Known blind spot, documented in `docs/reference/dev.mdx`: code behind a cache or shared fixture is credited in coverage only to the first test that ran it. - Open PRs touching the same files (amd#5453, amd#5417, amd#5511, amd#5600, amd#5475, amd#5542, amd#5558) test-merge cleanly against this branch; none gains a conflict from it. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: v <v@x>
The stub agent borrowed Agent methods one by one and broke when unload_skill gained a helper. The test now builds the flagship as the other bundled-skill tests do, and also checks the three tools reach the model's tool schemas.
…ces no longer needs The skill's pptx chart writer is removed, so nothing on this branch imports pptx or docx from skill code. slide-decks carries the mapping with its own change.
- A row of year-like numbers under a text header is data, not the period header; month names with no year are periods and the result says the year is not stated; a column of bare years needs a header that says so. - Two labels that name one row both return its values. - One period over several columns (Actual, Budget) is ambiguous; choose with filters='header=Actual' or 'column=D'. - A formula row with no stored values is reported as never calculated. - UTF-16 CSVs and semicolon, decimal-comma CSVs are read; a note says which convention was assumed. - Categorical tables and row-level records get a time-series-only error that points at run_python. - Results carry periods_available; chart_input uses categories, series, source. - The inventory leads with summary and datasets, fits an 18,000 character budget and says what it cut; the folder walk is filtered and capped. - Workbooks open and save through the skill context; the overwrite question comes after the series lookup. - The unused pptx chart writer is removed.
…and a new description SKILL.md leads with the sourcing rule, adds a three-step path for a small ask, bounds document reading, and hands chart_input to slide-decks by its field names. pairs_with is office-docs and slide-decks. python-pptx is no longer a dependency. The guide and references follow the tool changes.
…mport it The three library test modules left the skill folder at the front of sys.path, so its tools.py answered a bare 'import tools' for every test that ran later in the same process. The folder is now on the path only while the library imports, as the skill loader and the log-triage tests do it.
…ew description The skill's catalogue line changed with its description, and it no longer pairs with data-explore. Regenerated with GAIA_UPDATE_PROMPT_GOLDEN=1; only those two lines differ.
…-tool # Conflicts: # hub/agents/gaia/python/tests/fixtures/non_claude_system_prompt.txt # tests/unit/test_skill_catalog.py
report-from-sourcesnow does the parts small models get wrong with spreadsheets. One call lists a folder's data files, says which period each covers, and names the newest copy of each dataset. A second call reads named series exactly as stored and cites each value's cell. When a label is ambiguous it says so instead of guessing. A third call charts those series into an .xlsx and checks the saved chart against the source. All three read and write only inside the agent's allowed folders, including a folder the user approved this session. Builds on #5421.Depends on #5450 and #5454, both merged into this branch.
🔍 Technical details
Tools (the skill's
tools.py, registered asreport-from-sources/<tool>when the skill loads; the default tool count is unchanged):inventory_data_files(folder, recursive=False): covers .xlsx/.xlsm/.csv/.tsv/.json/.jsonl. For each sheet it reports the layout (wide, columns or stacked), header rows (including multi-row and merged), units row or column, period coverage (first, last, last with data), footnotes and series names. Files holding the same dataset (same name stem or overlapping series labels) are grouped and ranked: data through, then an as-of line in the content, then the period or revision in the file name, then mtime. Example note: "two versions of the same series: X (through 2026Q2, newest) and Y (through 2025Q2)". PDF, Word and other documents are listed as narrative sources. .xls/.xlsb/.ods files are reported as unreadable, with what to do.series_from_workbook(file_path, labels, sheet, periods, orientation, filters): matches labels exact, then exact path ("Section > Label"), then containment, then fuzzy (≥0.88, clear lead). Two hits at the same tier come backambiguouswith candidates; no hit comes backnot_foundwith the nearest labels. Period labels handled: quarters, months, ISO and US/EU dates (day/month order settled once per axis), fiscal years and quarters, halves, year rows over quarter rows. "123.4(a)", "(12.5)", "1,234", "n/a" and blanks are handled too. The result includeschart_input= {categories, series: {name: values}, source_note}.chart_into_workbook(...): native openpyxl line/column/bar/stacked/area/combo chart over a written table, with axis title, number format and a footnote. It refuses workbooks openpyxl would damage (pivots, macros, shapes) and compares the reread chart with the source.report_from_sources_lib/pptx_chart.py::add_native_chart(prs_or_path, slide, chart_type, categories, series, title, number_format, source_note, *, y_axis_title="", x_axis_title="") -> dictis a library function for the deck skill. It is not a tool.Scenarios (
tests/fixtures/report_from_sources_data.py, 6 types × 5 seeds): every score is 1.000. That covers newest-file choice (40/40), older-copy precision and recall (5 TP, 0 FP), exact values (55/55 series), period labels (35/35), ambiguity precision and recall (10/10, 0 FP), not-found precision and recall (10/10, 0 FP), and xlsx/pptx chart round-trip (35/35 each). A 300k-row long CSV streams in well under the test's 120 s cap.Known limits
gaia.skills.context(feat(skills): skill context API for paths, programs, temp files and preferences #5454):folder,file_pathandoutput_pathare read-checked before a tool runs, the output is write-checked, and files met while inventorying a folder are filtered withreadable_entry.open()as an undeclaredfilesystemread. This PR addsopen_read(path, mode="r", **kw)togaia.skills.context, which isopen()aftercheck_readand refuses a mode that writes. The audit does not flag it, sogaia skill auditreturns ALLOW with no permissions declared. It belongs with feat(skills): skill context API for paths, programs, temp files and preferences #5454's API and can move there.pptx/docximports topython-pptx/python-docx.Test plan
pytest tests/unit/test_report_from_sources_*.py tests/unit/test_skill_context.py tests/unit/test_skill_tool_gating.py tests/unit/test_skills_audit_engine.py hub/agents/gaia/python/tests/test_report_from_sources_skill_tools.py hub/agents/gaia/python/tests/test_bundled_skill_tools.py(the tools run through an agent: out-of-scope paths refused, a session-approved folder allowed)gaia skill audit hub/skills/report-from-sources: ALLOWpytest tests/unit/test_starter_skills.py tests/unit/test_skill_catalog.py hub/agents/gaia/python/tests/test_capability_matrix.pypython util/lint.py --allgaia eval agenton a report-from-sources scenario with a folder holding two vintages of one workbook