Skip to content

plugin: answer at once from the last graph with stale rows marked; watch what each parser reads (#1594, #1595) - #1614

Merged
swapnilpaliwal-sd merged 1 commit into
0.1.4from
fix/1594-stale-while-revalidate
Sep 28, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
0.1.4from
fix/1594-stale-while-revalidate

Conversation

@swapnilpaliwal-sd

Copy link
Copy Markdown
Contributor

Fixes #1594
Fixes #1595

What was wrong

The change (plugin only; no engine or parser change)

  • ax_fresh.py query runs context, path and impact stale-while-revalidate. The answer comes from the last good graph at once. Every row that lies in a file edited, added or removed since the graph was built ends with (may be out of date); rows from untouched files carry nothing. --json rows get "stale": true plus a top-level freshness object. MCP returns the marked text.
  • It waits (up to AXIOMCODE_FRESH_WAIT, now 30 s) only when the answer or the name asked about touches an edited file, the rebuild is not compiling rules, and the last build of this repository (build-seconds, now written by axiomcode-build) says the refresh will finish within the budget. Otherwise it answers immediately. The never-block rule from Query latency: do once what every query repeated; first build reports its stage instead of blocking #1576 and the safe swaps from Refresh after edit: one engine lookup, no silent fallback, safe swaps, .gitignore honoured #1565 are unchanged.
  • --fresh (CLI) and fresh=true (MCP context, path, impact) wait for the refresh, print progress every 10 s, and answer from the new graph. SKILL.md tells agents to use it before a delete or a rename.
  • The file table prunes, per language, exactly what that language's parser skips (SKIP in ax_fresh.py, taken from the parser's own constants). tests/freshness.py reads those constants back from parser/src, so the two lists cannot drift apart unnoticed.

Tests

  • New tests/freshness.py, 24/24 (no engine). Covers: prune lists equal to the parser's, per language; marks in text and --json, with near-miss controls (a same-named file in another directory, quoted code lines, next: lines, an edit the answer never names); the wait decision in each direction, including one control per case where it must not wait; --fresh; MCP fresh.
  • tests/refresh.py gets two new checks (marked rows, --fresh). Results: python, java and csharp all pass. tests/latency.py passes (27). tests/mcp.py passes.
  • tests/refresh_races.py has 2 failures here ("query mid-build", "no rules"). The same 2 checks fail on unmodified 0.1.4 at a3f0fa3 (the commit this branch is on) on this machine, so they are not caused by this change.

Repros (before = 0.1.4 at f71faef, one merge behind a3f0fa3 that only changes the JavaScript engine; after = this branch)

  • The pruned-dir repro (python, java, csharp): FAIL before, PASS after in all three.
  • The first-query repro (a 2-file Python project): PASS after in 2 of 2 runs, answered in 4-5 s after a short wait. Before, it failed 3 of 3 earlier runs but passed 2 of 2 later runs. Rebuilds of that tiny project now finish within the old 10 s, so this repro no longer separates the two versions.
  • Smoke on a 78-file Python CLI project, adding a caller in a second file:
    • Before: the query waited 10 s and answered without the new caller.
    • After: it waited 9 s (the last build took 7 s) and listed the new caller.
    • With the wait disabled, it answered in 0.5 s. The edited file's row was marked, and the other file's row was not.

Deep scan deferred: no held-out corpus measurement or regression gate was run for this change.

@swapnilpaliwal-sd swapnilpaliwal-sd added python Python java Java csharp C# plugin the axiomcode plugin: skill + MCP layer bug Something isn't working labels Sep 28, 2026
…tch what each parser reads (#1594, #1595)

A query no longer spends a fixed 10 s wait that no measured rebuild fits in. It answers from the last good
graph and marks every row that lies in a file edited, added or removed since, "(may be out of date)" in
text and "stale": true in --json (MCP gets the text). It waits, up to AXIOMCODE_FRESH_WAIT (30 s), only when
the answer or the name asked about touches an edited file and the last build of the repository says the
refresh will finish within that; never on a compile of the engine's rules. --fresh (MCP fresh=true) waits
for the refresh with progress lines and answers from the new graph; SKILL.md says to use it before a
delete or a rename. axiomcode-build records how long each build took (build-seconds).

The file table now prunes, per language, exactly the directories that language's parser skips, so an
edit under out/, build/, target/ or coverage/ where the parser reads it makes the graph stale.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working csharp C# java Java plugin the axiomcode plugin: skill + MCP layer python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant