Commit ef6dec9
fix(java): the agent-context staleness nudge compared two version lines, so it fired forever (#347)
meta agent-docs COPIES the agent-instruction files into a consuming repo; it does not
link. The copy freezes at whatever version wrote it and a dependency bump never touches
it, so an agent reads old instructions and authors vocabulary the current loader rejects.
The staleness advisory exists to break that silence.
On the JVM it could never fire correctly. generatedBy is always an NPM version, because
meta agent-docs is the canonical scaffolder for every port and the others redirect to it.
installedVersion() reads the MAVEN artifact version, which carries a historical major of 7
by design. The comparison is exact equality -- deliberately, so prerelease drift still
nudges -- so "7.24.1".equals("0.24.1") was false and always would be. The nudge fired on
every mvn metaobjects:generate forever, including when the context was perfectly in sync.
Not silent: permanently loud, which carries the same signal and is tuned out faster.
C# and Python were never affected; both read a version on the 0.x line. Java and Kotlin
are the broken pair, and only because the Maven major is deliberately different. This is
the two-version-lines contract biting somewhere nobody looked.
The fix is in the COORDINATE, not the comparison. stalenessAcrossVersionLines reduces both
sides to the release they name and keeps the equality EXACT, so every property the original
contract defends survives -- an RC-scaffolded context against a final release still nudges,
and the message still names both real versions. staleness() is untouched; its javadoc
forbids relaxing it into a semver compare and is right.
Correct while the four registries share a minor.patch. That is the documented lockstep rule
and is already relied on by scripts/prerelease.mjs:210 and scripts/release-verify.mjs:27,
which both build the Maven version as `7.` + npm's remainder -- so this reuses a convention
rather than inventing one, and is a third site for it rather than a first. It is a
convention and not a gate; if lockstep ever breaks this reports in-sync across a real gap.
That trade is accepted and stated in the javadoc, because it is strictly better than a
check that can never match.
Why it survived: every existing test used a generatedBy of "7.2.1" -- a shape production
CANNOT produce, since only the Node CLI writes that field. The fixtures asserted a world
where both operands sat on the Maven line, so the pure function looked correct while the
deployed comparison was never exercised once. Six cases now use the real shape, including
the in-sync case that is the whole point.
Option A of four, chosen after a two-arm adjudication that converged independently on it.
Rejected: comparing metamodelVersion instead -- it is identical across ports by
construction, but 91 commits touched agent-context/skills/ in 90 days against 5 distinct
values of that constant in the project's whole history, so its blind spot is dominant
rather than marginal. Rejected: stamping every port's line into the manifest -- the Node
scaffolder cannot know a consumer's Maven version. Rejected: a content digest -- the
manifest does carry per-file hashes, but they exist to detect hand-edits, and the JVM
ships no skill content at all, so the port with the bug cannot compute the current side.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NynrRND6ZUwGvq3ZUTCfxG1 parent 2a6c417 commit ef6dec9
4 files changed
Lines changed: 154 additions & 1 deletion
File tree
- server/java
- maven-plugin/src/main/java/com/metaobjects/mojo
- metadata/src
- main/java/com/metaobjects/agentcontext
- test/java/com/metaobjects/agentcontext
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
10 | 48 | | |
11 | 49 | | |
12 | 50 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
225 | 228 | | |
226 | 229 | | |
227 | 230 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
80 | 139 | | |
81 | 140 | | |
82 | 141 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
31 | 84 | | |
32 | 85 | | |
33 | 86 | | |
| |||
0 commit comments