Skip to content

Fix Tier 2 scans for contained compatibility alias - #36

Merged
rng1995 merged 1 commit into
mainfrom
feat/christopherk/issue-32-relevance-aware-links
Aug 11, 2026
Merged

rng1995 merged 1 commit into
mainfrom
feat/christopherk/issue-32-relevance-aware-links

Conversation

@chrisknvidia

Copy link
Copy Markdown
Collaborator

Summary

Fixes #32.

Tier 2 now recognizes the exact contained compatibility layout used by OpenClaw:

CLAUDE.md -> AGENTS.md

The alias is validated but never followed. Skill discovery skips it as unrelated to SKILL.md, while context collection processes the regular AGENTS.md target once.

All existing fail-closed behavior remains in place for linked roots, linked directories, linked manifests, broken or escaping links, non-exact aliases, reparse points, and non-regular inputs.

Root cause

Collection traversal rejected every linked filename before determining whether it was relevant to the selected Tier 2 operation. OpenClaw's contained CLAUDE.md compatibility alias therefore aborted the full collection before embeddings were requested.

Changes

  • add one shared validator for the exact CLAUDE.md -> AGENTS.md sibling alias;
  • apply it to inter-skill discovery and intra-skill context collection;
  • add rejection coverage for non-exact and broken variants;
  • add the exact similarity-check PATH --type skill CLI regression;
  • document the security contract and release impact.

Verification

  • uv run make lint
  • affected Tier 2 regression set: 170 passed, 1 skipped
  • full repository suite: 3,069 passed, 7 skipped, 3 deselected
  • wheel and sdist build: passed
  • strict Twine validation: passed
  • independent focused code review: no critical, important, or minor findings
  • pinned OpenClaw commit 2a409d348a4bcf6f15e41e9a20efd0b298a32528:
    • confirmed skills/autoreview/CLAUDE.md -> AGENTS.md;
    • similarity-check <skills> --type skill --report cli: exit 0, 8 skills indexed;
    • context-optimization-check <autoreview> --report cli: exit 0, 5 regular files and 166 chunks processed;
    • exercised through the OpenAI SDK against a real loopback HTTP embeddings/chat server.

The loopback provider returned deterministic synthetic vectors and chat output, so hosted-provider authentication, quality, latency, and billing were not evaluated. Native Windows behavior remains gated by GitHub Actions before merge.

@chrisknvidia
chrisknvidia requested a review from rng1995 August 4, 2026 22:08
@chrisknvidia
chrisknvidia marked this pull request as ready for review August 5, 2026 09:02

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the exact CLAUDE.md to AGENTS.md alias recognition, no-follow behavior, regular-target checks, collector/discovery integration, and negative target cases. I found no blocking issues. The focused Tier 2 and CLI suite passed locally (116 passed, 1 platform skip), and the GitHub check matrix is green.

rng1995
rng1995 previously approved these changes Aug 5, 2026

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after reviewing the exact no-follow compatibility-alias handling and focused Tier 2 coverage; all checks are green.

@chrisknvidia
chrisknvidia force-pushed the feat/christopherk/issue-32-relevance-aware-links branch from 004afcf to 2a3ace4 Compare August 7, 2026 00:47
@chrisknvidia
chrisknvidia requested a review from rng1995 August 7, 2026 01:13

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 2a3ace49c5515f10022c761ec7977ddf599a3e37; I found no actionable findings.

I checked the exact-alias recognition and its call sites in both inter-skill discovery and intra-skill collection, including:

  • exact CLAUDE.md -> AGENTS.md name/target matching and traversal-snapshot membership;
  • no-follow behavior for the alias and independent processing of the regular target;
  • single-link, regular-file, and Windows reparse-point checks;
  • fail-closed handling for broken, escaping, non-exact, linked-directory, linked-manifest, and hard-linked selected-file cases;
  • replacement-race behavior through the descriptor-anchored target read;
  • documentation and regression coverage consistency.

Verification on the exact PR archive:

  • focused collector/extractor/CLI suite: 124 passed, 1 platform skip;
  • Ruff on all changed Python files: passed;
  • full suite: 3,075 passed, 8 skipped, 3 deselected; the sole initial failure was the OSS-boundary test detecting .ruff_cache/.pytest_cache generated by this review run, and that test passed after those temporary caches were cleaned;
  • all six GitHub workflow runs reported success.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after two review passes against head 2a3ace49c5515f10022c761ec7977ddf599a3e37. No actionable correctness, security, compatibility, or test-coverage issues found; focused, full-suite, lint, CI, and Windows Tier 2 evidence are satisfactory.

@rng1995
rng1995 merged commit e5e0702 into main Aug 11, 2026
25 checks passed
rng1995 added a commit that referenced this pull request Nov 16, 2026
The missing-reference line check reads a line as written and decoded. A
bold or italic label and a $ before a space are read narrowly only on a
line without a quoted or escaped space or delimiter, but that was decided
for each decoded text on its own. Removing Markdown escapes such as `\#`
and `\ ` and then resolving an HTML reference could show a $ or a label
in a text that no longer held the escaped space, while the text with the
escaped space held neither. Such a line, like
`Run &\#36; sh setup\ h*.sh now.`, passed with `setup helper.sh` left
out, though a shell may read it as naming that file.

Decide it once for all texts of the line, so a quoted or escaped split in
any of them keeps labels and $ as globs and expansions in every one.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995 added a commit that referenced this pull request Nov 16, 2026
…urate (#564)

* fix(tier1): keep the missing-reference line check and its warning accurate

Follow-up to #457.

The missing-reference line check split each shell word at `=`, `:` and
`,`, so the closing `**` of a bold label such as `**Note:**` or
`**Step 1:**`, or the `*` of `*Tip:*`, became a piece of its own that
matched every name left out of the scan, and a lone `$` in a shell prompt
such as `$ python run.py` was read as a parameter expansion. Such a line
stayed INCOMPLETE whenever anything, even .git, was left out. A bold or
italic label outside code is now read as its text, and as a glob that is
not split at its `:`, and a `$` before whitespace or the end of the line
is read as written. A wildcard elsewhere, or a label inside code, still
counts.

Words were split at whitespace before quotes were removed, so
`setup' 'helper.sh`, `setup" "helper.sh` or `setup\ h*.sh` never named
the left-out file `setup helper.sh`. Words are now also read as a POSIX
shell splits them. The line-check budget charges the extra reading.

With `validate --workers` above 1, a catalog child detects a skill that
holds .claude-plugin/plugin.json as a plugin, and the plugin root took
precedence over --catalog-root when missing references were judged, so
the skill passed where one worker kept it INCOMPLETE. The catalog root
now comes first; finding scoping still uses the plugin root.

An --llm-verify downgrade rebuilt the result from its findings and
dropped every warning and error that no finding repeats: the accepted
missing-reference warning, and the error that says why a scan is
INCOMPLETE. They are now kept, as the deduplication of static and LLM
findings already does.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): read no short name in a word part that holds whitespace

The missing-reference line check also reads a word as a POSIX shell
splits it, so an apostrophe or quotes in prose can join several words
into one path part, such as "It's ~5 lines; don't" or
"roughly ~200 words". A part with text after a ~ was then also read as a
Windows short or Samba mangled name standing for any name that holds its
first character, so such a line stayed INCOMPLETE whenever a left-out
name, such as .git or results, held that letter. Those names never hold
whitespace, so a part that does is no longer read as one. Real short
names such as NODE_M~1 still come from the whitespace-split words.

The docs and the docstring now say that each word of a bold or italic
label is its own pattern, so **Step 1:** stands for names that end in
step or start with 1:, not only for names that hold the label's text.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): wrap the missing-reference entry like the others

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): read a word joined at quotes as a shell reads it

Follow-up to #457.

The missing-reference line check also reads each word as a POSIX shell
splits it, so that a quoted or escaped space keeps it one word. Such a
word can join prose at its quotes, and it was then read like a word
without spaces. Brace expansion from its first `{` to its last `}` turned
quoted JSON or a template, such as '{"a": 1, "b": 2}' or
"{name}, {score}", into `*`, and a cmd.exe variable spanned its spaces,
so "%s %s" stood for every name that ends in `s`. Such a line stayed
INCOMPLETE when .git, evals or node_modules was left out, although
splitting at whitespace alone passed it. A quoted `{`, `,` or `.` in a
word that holds a quoted space or delimiter now forms no brace expansion,
as in a shell, and a cmd.exe variable is read only between spaces.
Unquoted braces still expand, so setup{' ',}helper.sh names
`setup helper.sh`.

An apostrophe in prose, as in "Don't", paired with the quote of a later
command, so `setup' 'helper.sh` after it was not read as one word. The
words are now also split with each apostrophe between two letters
removed.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): keep a stale-baseline error out of a passing --llm-verify result

A downgrade restored every error that no finding repeats. One of them is
the note that SkillSpector baseline fingerprints were ignored, which the
scan adds only while blocking findings remain. Once the last blocker was
downgraded, that note turned a passing scan into a failed one. Errors are
now restored only when the scan is incomplete, where they say why.
Warnings that no finding repeats, such as the accepted missing-reference
warning, are still kept.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): read a label word joined at a quoted space as a shell word

A bold or italic label was split only at whitespace. So in
*a' 'b c:* the words *a' and 'b were read apart, and the glob a shell
reads, *a b, was never formed. A line that names a left-out file
through such a label passed. Each label is now also split as a POSIX
shell splits it, as the rest of the line already is.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): read a $ before whitespace as a literal $

The missing-reference line check deleted each $ before whitespace or the
end of the line, so that a shell prompt such as `$ python run.py` was not
read as a wildcard. In a word with other shell syntax that also dropped a
character the shell keeps: `sh *a$` was read as `*a`, so a left-out file
named `xa$` was no longer named, although a shell glob matches it.

Read that $ as a literal $ instead. It is swapped for a stand-in while the
words of the line are split and read, and each pattern reads the stand-in
as $ again, so `*a$` matches names that end in `a$` and a lone prompt $
still adds no pattern. A $ after another $ still ends the parameter $$, and
a line that already holds the stand-in reads such a $ as an expansion.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): keep why a scan is INCOMPLETE after a policy severity override

A severity override from --policy or --profile rebuilds the result from
its findings, which dropped every error that no finding repeats. A skill
in a folder whose SkillSpector 2.13.4 missing-reference caveats are not
accepted then stayed INCOMPLETE with no error that says why. The rebuild
now keeps those errors when the scan is incomplete, as an --llm-verify
downgrade does. On a complete scan they are dropped, as before.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): keep %02 to %05 from changing how a reference line reads

The missing-reference line check read a quoted `{`, `,` or `.` in a word
joined at quotes, and a `$` before whitespace, through fixed control
characters, the same ones that `%02` to `%05` decode to. A line holding
one, such as `printf '{"h": "%02d", "m": "%02d"}' 3 4` or
`$ printf '%05d' 7 > output/notes.md`, then read its quoted JSON as a
brace expansion or its `$` prompt as an expansion, and stayed INCOMPLETE
whenever anything was left out of the scan.

The stand-ins are now the first private-use characters that the text
being read does not hold: the word for the quoted braces, and every
reading of the line for the `$`. Should none be left, the line is read
as before, with quoted braces and such a `$` expanding.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): name the lines the missing-reference check now keeps INCOMPLETE

Compact JSON outside shell quotes with a space in a quoted value, such as
`{"title":"My note","tags":[]}`, is now read as one shell word, so it
stands for any text and keeps the scan INCOMPLETE whenever anything is
left out, and `["a b","c"]` stands for any one-character name. The work
charged per character of a line has also doubled, so the line check
reaches its bound with about half as many long lines. Say so in the
entry, which listed only the lines that now pass.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(tier1): write private-use characters in the reference tests as escapes

The stand-in tests held private-use characters (U+E000 to U+E003) as raw
text, so some cases printed the same as their neighbours or looked empty.
Write each one as its backslash-u escape in the same string literal. The
tested values do not change.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): drop the quoted-name reading from the missing-reference check

The missing-reference line check no longer reads a word as a POSIX shell
splits it. `setup' 'helper.sh`, `setup" "helper.sh` and `setup\ h*.sh`
are again split at whitespace, as on main, so they do not name
`setup helper.sh`. The rules that existed only for that reading go with
it: the second reading with each apostrophe between two letters removed,
quoted `{`, `,` and `.` that form no brace expansion, cmd.exe variables
read only between spaces, no short-name reading for a part that holds
whitespace, and the doubled work charged per character of a line, which
is 9,000 again. The literal `$` keeps its private-use stand-in, so the
allocator now returns a single code point.

Without that reading, a bold or italic label read as its text, or a `$`
before whitespace read as written, would let some lines pass that main
keeps INCOMPLETE: `*a' 'b c:*` is a glob that a shell joins at its quoted
space, and `"a$ b*"` a word that continues past its `$`, and on main the
label's closing `*` and that `$` stood for any text. A line with a space
or shell delimiter between two of the same quote or after a backslash
(_SKILLSPECTOR_QUOTED_SPLIT_RE) now keeps that reading of its labels and
`$`, so it is read no more narrowly than on main. The label and `$`
reading still applies to every other line, such as `**What's new:**`,
`**Say "hi":**` or `$ printf '%05d' 7`.

The docs and the CHANGELOG entry say so, and the docs now name the
quoted or escaped space as something the check does not read.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(tier1): share one rebuild for --llm-verify downgrades and overrides

The --llm-verify downgrade and a --policy or --profile severity override
each rebuilt a result from its findings and then put back the errors and
warnings that no finding repeats, by rules copied into each place. Both
now call ValidationResult.recalculate_keeping_independent: every such
warning is put back, and such an error only when the scan is incomplete,
once, so a gate failure that the rebuild already lists is not repeated.

A severity override behaves as before. After an --llm-verify downgrade, a
warning that the result held twice is now listed twice, as it is without
--llm-verify and after an override; it used to be listed once. The
deduplication of SkillSpector findings keeps its own rule, which also
keeps such errors on a complete scan, since it changes no severity.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(tier1): list the missing-reference word readings one family a line

The bullet that says how the missing-reference check reads a word as a
pattern held every shell, Windows and Markdown rule in one paragraph.
Split it into sub-bullets: POSIX shells, zsh, bash and ksh, cmd.exe,
PowerShell, Windows separators and short names, Markdown code spans,
list markers and labels, shell prompts, lines with a quoted or escaped
space, and wildcards and prose. The rules and examples are unchanged.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(tier1): split the reference-word bullet into one item per shell family

The bullet that explains how a word in a reference line is read as a pattern
had grown to about 3,900 characters on one line. Split it into one sub-bullet
each for POSIX shells, zsh, bash and ksh, cmd.exe, PowerShell, the directory
separator, short names, quoted and escaped spaces, Markdown code, the `$`
prompt, labels and prose. The rules are unchanged; only the cmd.exe variable
sentence now says which kind of word it applies to, since it moved away from
the sentence it referred to.

Signed-off-by: Christopher Kevin <[email protected]>

* refactor(tier1): share the rebuild that keeps errors and warnings no finding repeats

The LLM downgrade, the finding deduplication and the policy override each
rebuilt a result from its findings and then put back, by hand, the errors and
warnings that no finding repeats, each with slightly different rules. Add
ValidationResult.recalculate_keeping_independent and call it from all three.

Behavior is unchanged. The differences between the three are now named
options: the deduplication keeps every error (keep_all_errors), the other two
only for an incomplete scan, and the policy path still puts a repeated warning
back as often as it was recorded (keep_repeated_warnings). Tests cover the
helper and pin each call site's rule.

Signed-off-by: Christopher Kevin <[email protected]>

* fix(security): decide the quoted-split check once per reference line

The missing-reference line check reads a line as written and decoded. A
bold or italic label and a $ before a space are read narrowly only on a
line without a quoted or escaped space or delimiter, but that was decided
for each decoded text on its own. Removing Markdown escapes such as `\#`
and `\ ` and then resolving an HTML reference could show a $ or a label
in a text that no longer held the escaped space, while the text with the
escaped space held neither. Such a line, like
`Run &\#36; sh setup\ h*.sh now.`, passed with `setup helper.sh` left
out, though a shell may read it as naming that file.

Decide it once for all texts of the line, so a quoted or escaped split in
any of them keeps labels and $ as globs and expansions in every one.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: word the quoted-split rule as the missing-reference check applies it

The CHANGELOG said a label and a $ keep their meaning on a line with a
quoted or escaped space. The check looks for a space or shell delimiter
between two of the same quote or after a backslash, in the line as
written or decoded, and that also covers quotes that a shell pairs
otherwise, as in `"a" and "b"`. Say so in both places.

A PowerShell backtick before a space does not count, as a backtick also
ends Markdown code, so the line

    $ sh setup` h*.ps1

does not name `setup helper.ps1`. Note that in the docs, and reword a
comment in the line-check table.

Signed-off-by: Narendran Raghavan <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Signed-off-by: Narendran Raghavan <[email protected]>
Signed-off-by: Christopher Kevin <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Christopher Kevin <[email protected]>
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.

[BUG]: Tier 2 collection scan aborts on unrelated in-root symlinks

2 participants