Skip to content

fix(loop): the awaiting census could never see a PR - #47

Merged
Ardnived merged 2 commits into
mainfrom
claude/fix-awaiting-census-query
Sep 5, 2026
Merged

Ardnived merged 2 commits into
mainfrom
claude/fix-awaiting-census-query

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Three runs today reported label:awaiting returns zero while PRs demonstrably carry the label, and journalled it under ⚠️ Failed as a fault of the label or the index. It was the query. mcp__github__search_issues scopes to is:issue when a query names no is: qualifier — its own tool description says so — and the census query was $SCOPE is:open label:awaiting, with none. Every item carrying awaiting right now is a pull request, so it could not have returned one.

The failure this prevents

The census's one read-only view of what needs a human reads blank and wrong while PRs sit waiting on the reviewer — and it fails the way an empty search always fails, indistinguishable from "nothing qualifies". Two runs then spent their most valuable ⚠️ Failed line on a fact that was never true, which is the training-to-skim cost already recorded under #hasworkflows-is-a-filesystem-check.

Measured, not reasoned

Four queries against the same live data the failing runs saw, in the 19:03Z run:

Query Returned
$SCOPE is:open label:awaiting 0
$SCOPE is:pr is:open label:awaiting 3 — SahajCloud #692, #691, #686
repo:sydevs/SahajCloud is:issue is:open label:awaiting 0
repo:sydevs/SahajCloud is:open author:sydevs-bot (control) 8, all issues, no PRs

The control is what settles it, and it is why this is a rule rather than a patch: the omission hides PRs from any query, not just a label one. Row 2 against row 1 is the same query one qualifier apart — the "watch it fail" step, run on the live defect rather than a simulation of it.

What changes

  • awaiting becomes two queries — is:issue and is:pr. The label sits on both shapes and one query cannot see both; that is not redundancy.
  • Preflight gains rule 7, beside the > gotcha, which is the same class of failure: a qualifier problem that returns zero without erroring.
  • The two other census queries that omitted the qualifier gain is:issue explicitly — mentions: here, commenter: in survey-routine. Both are ticket sweeps by intent and neither changes behaviour; they already returned issues only. A census that states rule 7 while quietly breaking it is how the next reader learns to disbelieve the rule.
  • Rule 4 stops over-promising. "Never let a mention pass silently" was true of mentions as a class and is now true only of mentions on issues, so the rule says so: a mention on a PR reaches the loop through rung 2 or not at all.

⚠ One consequence to know before merging: the drift sweep gains half a row

survey-routine's awaiting drift sweep reads this census, and its table already has a PR row. Until the is:pr query existed, the sweep could see a PR that should carry the label (from the author: query) but never one that carries it wrongly. That half becomes enforceable on the first survey run after this merges.

That is the sweep doing what its own table specifies, not a second behaviour — scoping it out would mean editing that table, which genuinely would be one. But if a run starts stripping awaiting off PRs it never touched before, this change is why, and docs/why.md now says so rather than leaving it to a bisect.

Two decisions, recorded rather than left as omissions

  • search_issues with a hand-written is:pr stays the one tool. mcp__github__search_pull_requests exists and is scoped to is:pr by default. Eight run-skill queries already depend on the explicit-qualifier override and return PRs daily, so it is proven by operation. One tool with one syntax is easier to check than two tools with two defaults, and rule 7 makes every query state its shape anyway.
  • Whether a mention of the bot on a PR should count as rung-4 feedback is still unanswered, deliberately. It has not been measured, and widening the mention sweep would be a second behaviour. Say the word and I will file it.
Scope, gate and the version bump

version 0.2.0 → 0.2.1. #49 landed after this branch opened and made version the cache key for /plugin install workflow@sydevs. This branch changes two skills, so leaving it alone would serve every installed cache the old ones.

origin/main is merged in, so this is built against #48 (the STE rewrite of preflight) and #49. The one conflict was the label:awaiting paragraph, which #48 tightened and this branch made plural — #48's register kept, the plural fact carried into it.

survey-routine's commenter: sweep is genuinely ticket-scoped by its own prose — "the ticket is not the loop's to act on", "assigning the bot is the user's call" — so is:issue states its intent rather than narrowing it.

No ceiling or hook is touched, so this is a skill change alone.

Gate: claude plugin validate ./workflow --strict → passed. node workflow/lib/rule-delta.mjs --base origin/main workflow/skills → 57 directives before, 57 after, no directive removed. There is no CI in this repo, by design.

🤖 Written by the sydevs autonomous loop — see what this is


🤖 Generated with Claude Code

https://claude.ai/code/session_017bAFozAESzffZgcfH3REWX

`mcp__github__search_issues` scopes to `is:issue` when a query names no
`is:` qualifier — the tool says so in its own description — and the
census's `awaiting` query was `$SCOPE is:open label:awaiting`, with none.
Every item carrying `awaiting` is currently a pull request, so that query
returned zero for three consecutive runs while three PRs sat waiting on
the reviewer. Two runs journalled it under `⚠️ Failed` as a fault of the
label or the index.

Measured against the same live data those runs saw:

  $SCOPE is:open label:awaiting                     -> 0
  $SCOPE is:pr is:open label:awaiting               -> 3  (#692 #691 #686)
  repo:sydevs/SahajCloud is:issue ... label:awaiting -> 0
  repo:sydevs/SahajCloud is:open author:sydevs-bot  -> 8, all issues (control)

The control is what settles it: the omission hides PRs from any query,
not only a label one.

The label sits on issues and on PRs alike, so seeing both takes two
queries; one cannot be made to do it. The general rule is stated as
preflight rule 7 beside the `>` gotcha, which is the same class of
failure — a qualifier problem that returns zero without erroring, and so
reads as "nothing qualifies".

The two other census queries that omitted the qualifier are ticket
sweeps by intent (`mentions:` in preflight, `commenter:` in
survey-routine). Both gain `is:issue` explicitly. Neither changes
behaviour — they already returned issues only — but a census that states
rule 7 while quietly breaking it is how the next reader learns to
disbelieve the rule.

Whether a mention of the bot ON a PR should count as feedback is a real
question this does not answer, and deliberately: it has not been
measured, and it would be a second behaviour.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01BWsjnBcL2v4LZ4dPjCeJeP

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

Holistic assessment. The diff is the size of the problem: one census query becomes two, one rule states why, one docs/why.md heading carries the story. Nothing here is an abstraction for one caller, no ceiling or config value moves, and the root cause was established against the live defect — the author:sydevs-bot control row is what turns this from a label patch into a rule, and it is the right evidence for a repo where you cannot validate a change by running it. Two claims in the body outrun the diff, though, and both are about scope stated rather than code written: the mentions query now hard-codes the narrow answer while preflight rule 4 still promises the wide one, and the new is:pr label:awaiting set quietly gives survey-routine's awaiting drift sweep a PR input it has never had — a second behaviour, in a file this PR already edits. No cross-repo contract surface is touched; the blast radius is the next run of both routines in all five repos, which is the norm here.

Findings

  • should-fix — preflight/SKILL.md:148: rule 4's "Never let one pass silently" is now false for mentions on PRs, and nothing says so. (thread)
  • should-fix — preflight/SKILL.md:147: the new PR-shaped awaiting query changes what survey-routine's drift sweep can correct — an unstated second behaviour. (thread)
  • consider — preflight/SKILL.md:209: rule 7 mandates hand-written is:pr on search_issues; should it name search_pull_requests, or is one-tool-one-syntax the deliberate answer? (thread)

What was checked

  • The diff, from the attached checkout: git fetch origin claude/fix-awaiting-census-query → git diff origin/main...FETCH_HEAD. 3 files, +47/−5.
  • No linked ticket, and none is required — prAllowlistGlobs is ** here and the PR body is the proposal. Judged against the body accordingly.
  • The measured claim, re-derived from the tool contracts. mcp__github__search_issues describes itself as "Already scoped to is:issue"; mcp__github__search_pull_requests as "already scoped to is:pr". Neither documents the override the fix depends on, which is what the third finding is about. The PR's row-2 result (3 PRs) is consistent with override working, and so is the repo's existing daily use of it.
  • Did the rule generalise? git grep -n search_issues over the whole tree, on main and on the branch. On main, three literal queries omitted an is: qualifier: preflight:146 (label:awaiting), preflight:147 (mentions:), survey-routine:84 (commenter:). All three are fixed here. After the branch, every literal search_issues query in the repo carries is:issue or is:pr — preflight ×6, work-routine:42/:319, reflect:45/:56, journal:52, survey-routine:37/:84, implement-issue:70. The two remaining bare references (draft-ticket:19, triage-issue:358) are prose, not queries. The rule was applied everywhere it applies.
  • The consumer side of awaiting. git grep -n awaiting across workflow/skills. The label is written by the state machine, by cross-repo-issue/draft-ticket/implement-issue on local filing, and by work-routine's four dead ends. The only thing that reads and corrects it is survey-routine's drift sweep (:67–:79), whose table has a PR row — read whole, and the basis of the second finding. journal/SKILL.md confirms no 📋 Awaiting you table consumes the count, so the two result sets need no summing rule.
  • Surrounding files read whole: workflow/skills/preflight/SKILL.md (census + all seven read-narrowly rules), workflow/skills/survey-routine/SKILL.md, workflow/skills/journal/SKILL.md, the new docs/why.md section, and CLAUDE.md's one-behaviour-per-PR and values-only rules.
  • Reviewer profile: read, workflow/skills/adversarial-review/reviewer-profile.md. It records no learned sensitivities for claude-workflow (merged without formal reviews historically), so the findings lean on the transferable values — every layer pays rent, work with the platform, a local finding should generalise — and deliberately raise nothing about style, prose length, or test coverage.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread workflow/skills/preflight/SKILL.md Resolved
Comment thread workflow/skills/preflight/SKILL.md Resolved
Comment thread workflow/skills/preflight/SKILL.md Resolved
`main` gained #48, which rewrote `preflight/SKILL.md` in Simplified Technical
English, and #49, which made `version` a cache key. The one conflict was the
`label:awaiting` paragraph: #48 tightened it, this branch made it plural. Kept
#48's register and carried the plural fact into it in three short sentences.

Folded into the same commit, because two of the three touch the file the merge
had to reconcile:

- Rule 4 said "never let a mention pass silently" while the mention query is
  now issue-scoped. It now says the query is issue-scoped, and that a mention
  on a PR reaches the loop through rung 2 or not at all.
- `docs/why.md` records the two decisions the fix forced. First, the new
  `is:pr label:awaiting` query is what the survey routine's drift sweep reads,
  so half of that sweep's PR row becomes enforceable on the first survey after
  the merge — the sweep doing what its own table specifies, but worth knowing
  without a bisect. Second, `search_issues` with a hand-written `is:pr` stays
  the one tool rather than `search_pull_requests`, deliberately.
- `version` 0.2.0 -> 0.2.1. #49 landed after this branch did, and this branch
  changes two skills, so an unchanged version would leave every installed cache
  serving the old ones.

Gate: `claude plugin validate ./workflow --strict` passed. `rule-delta.mjs
--base origin/main` reports 57 -> 57 directives and no removal.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017bAFozAESzffZgcfH3REWX
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

All three review threads answered and resolved, origin/main merged in, nothing waiting on you but the review itself (04ddee4).

  • Rule 4 stopped over-promising — adopted. "Never let a mention pass silently" now says the query is issue-scoped, and that a mention on a PR reaches the loop through rung 2 or not at all.
  • The drift sweep gains half a row — named, in docs/why.md and in the body under its own heading. survey-routine's awaiting sweep reads this census and could never see a PR carrying the label wrongly. It can now, on the first survey after merge. That is the sweep doing what its table specifies, so it is not scoped out — but a bisect should not be how anyone finds out.
  • search_pull_requests vs a hand-written is:pr — decided: one tool, one syntax, recorded under rule 7's why anchor.

Also version 0.2.0 → 0.2.1: #49 landed after this branch opened and made it the install cache key.

Validator passed. rule-delta.mjs --base origin/main reports 57 → 57 directives, no removal.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@Ardnived
Ardnived merged commit bd86b84 into main Sep 5, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in SYDevelopers Technical Roadmap Sep 5, 2026
@Ardnived
Ardnived deleted the claude/fix-awaiting-census-query branch September 5, 2026 04:54
Ardnived added a commit that referenced this pull request Sep 5, 2026
Rewrites every prose file in this repo (skills, AGENTS.md, README.md,
docs/why.md, docs/routine-setup.md, loop-config.json's $comments, and every
comment in workflow/hooks|lib and the two CI-adjacent workflow yml files)
into strict Simplified Technical English: active voice, one instruction per
sentence, zero semicolons, no phrasal verbs, simple tenses.

Numbers (tracked *.md, git blob bytes, CLAUDE.md symlink excluded to avoid
double-counting AGENTS.md):
  270,253 -> 244,765 chars (-9.4%, -25,488 chars)
Hot path (workspace CLAUDE.md + AGENTS.md + loop-config.json + preflight +
work-routine + survey-routine + journal, the files loaded on every run):
  72,087 -> 66,312 chars (-8.0%)
loop-config.json $comment strings: 6,897 -> 6,743 chars (-2.2%, light polish
per the audit's "already disciplined" verdict).

Debris removed (audit report, section 3):
- Dead trigger IDs (trig_01GyUCMWmPLekwTzYL7Xzobi, trig_016XeEsVa7dfSCum7t4Vmeuw)
  and the retired `sydevs-loop` name, deleted outright from routine-setup.md.
- The six-label retired roll-call (ready-to-implement, proposal, needs-info,
  blocked-upstream, hold, claude:working) cut to one clause in routine-setup.md.
- why.md heading "Hand the baton back even with CI unsettled" renamed to
  "Mark the PR ready despite unsettled CI" (lesson unchanged); its one citer
  in finalize-pr/SKILL.md updated in this same commit (was left dangling by
  the rewrite partitions — caught and fixed during finishing).
- Two genuinely-orphaned why.md headings folded into the sections they
  duplicated ("The body is rewritten, not appended" into "Correcting an
  earlier claim"; "Awaiting is the one label that earns its place" into
  "The state machine is not the loop's job").
- Duplicated rules consolidated to one canonical home + pointers: issue
  fields not-searchable (preflight), CI-truth-lives-in-check-runs
  (merge-gate.mjs), PR-assignee prohibition (triage-issue + README),
  branch-vs-commit preview alias (finalize-pr).

Traps preserved (compressed wording only, per the audit's exempt-from-
deletion registry — all verified present after the rewrite):
- PUT to issue-field-values replaces the whole field set (state-machine.yml,
  triage-issue)
- A conflicted PR schedules zero CI runs, silently (finalize-pr, why.md)
- A write under .claude/ trips Protected Paths, stalls a run invisibly
  (AGENTS.md, why.md, reflect)
- MCP read strips <details> on readback even though the write succeeded
  (journal, why.md)
- Issue fields are readable/writable but not searchable via REST (preflight,
  triage-issue)
- HTML-escaped &gt; in a search qualifier is silently accepted and returns
  zero (preflight rule 6)
- get_status is deploy signals only, not check runs (work-routine,
  merge-gate.mjs)
- Search lags review events by tens of minutes (work-routine, why.md)
- A machine account is type: User, never type: Bot (routine-setup.md)
- api.github.com returns identical 403 with valid, invalid, or no credential
  (why.md)
- Sentry is DE-region; Client Secret vs Token both 64 hex, swap easily
  (survey-sentry)
- Railway Mailpit needs PORT=8025 explicit, volume before first boot
  (routine-setup.md)
- enabledPlugins must be an object map, not an array (README.md)
- An installed plugin pins its commit at install; only `version` invalidates
  the cache (AGENTS.md)
- The Stage: Implement write-prohibition (loop may revoke, never grant) kept
  as the intentional 4x+ repetition across README, why.md, preflight,
  implement-issue, draft-ticket, and triage-issue — not collapsed.

Gates run, all green:
- claude plugin validate ./workflow --strict — pass
- node --check on all 11 tracked .mjs files — pass; bash -n on
  dev-server.sh — pass
- node workflow/lib/rule-delta.mjs --base origin/main workflow/skills —
  57 -> 57 directives. Two ADDED/REMOVED pairs, both adjudicated as kept
  (see PR body for the full run and reasoning).
- python3 workflow/lib/ste-lint.py --json on all 22 changed .md files —
  zero regressions; hard violations fell from 231 to 38 combined (the
  remainder is markdown-table false positives and one deliberately-kept
  banned-phrasal-verb example in preflight's own Register section).
- Every `(why: docs/why.md#...)` citation across all tracked .md/.mjs/.yml
  files plus loop-config.json (89 occurrences, 54 unique anchors) resolves
  against a live why.md heading — verified after the heading rename.
- workflow/.claude-plugin/plugin.json version bumped 0.2.1 -> 0.2.2 (patch),
  required because workflow/skills|hooks|lib/** are touched.
- .claude/worktrees/claude+feat-adversarial-review-rung (gitignored, stale)
  confirmed untouched by every partition.
- PR #47 (the awaiting-census fix) is already merged into main; this branch
  is up to date with origin/main, so no rebase was needed.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants