Repository navigation
build: fast agent feedback loop (xtask check/lint/smoke, nextest, qq-mode skills) (ENG-1028) - #282
Conversation
- cargo xtask check: affected-only fmt/lint/clippy/nextest from the git diff and the workspace dependency graph; --full is the merge gate; writes target/qq-check/last.json and --evidence for PR bodies - cargo xtask lint: no mod.rs, forbid(unsafe_code), reasoned #[ignore], no unbounded channels in production, ADR index rows, and a ceiling on fixed sleeps in tests that only moves down - cargo xtask smoke: six scenarios drive the real qq binary (ask, run with a tool call, provider 401, session resume, serve over SSE, doctor/config) against a loopback fake Responses endpoint - .config/nextest.toml: default/quick/ci profiles; long qq-core session suites start first - dev profile: line-tables-only debuginfo, none for deps (qq debug binary 595 MB -> 189 MB) - build.rs: watch every tracked file only for release builds or QQ_EXACT_REVISION=1; docs edits no longer relink qq
…-1028) Pull requests run cargo xtask check against the base branch merge-base plus smoke; merge_group, main, and manual runs run check --full, the embedding and minimal-core profiles, wasm32, and Windows teardown. A ci:full label runs the platform jobs on a pull request. Superseded PR runs are cancelled. Failed runs upload target/qq-check, JUnit, and smoke evidence. Adds .githooks/pre-push (cargo xtask check --profile quick).
…ack loop (ENG-1028) AGENTS.md becomes a router: start with the qq-mode skill, use the cargo xtask check/smoke loop, read target/qq-check/last.json on failure. Repository facts and style rules stay; a Rules -> enforcers table names the tool that checks each rule. Skills (.qq/skills, also .agents/skills for other harnesses): - qq-mode: non-negotiables, autonomy limits, and eleven playbooks (bug fix, feature, refactoring, perf, test audit, investigation, slice, babysit, session pickup, correct, opening a PR) - principles: the engineering principles qq-mode cites - verify-qq: isolated home plus scripted fake provider (qq-home.sh) and a feature map for ask, run, serve, TUI, sessions, tools/approvals, delegation, compaction, MCP, and config/doctor; replaces qq-verify docs/runbooks/testing.md documents the loop, failure reports, test policy, nextest profiles, and CI; local-dev, workflow, and the slice template point at it.
check:
- refuse when the merge-base is missing instead of checking only the
working tree (a clean tree passed untested commits)
- diff with --no-renames; README/CHANGELOG reach the root docs_truth
tests, docs/guide reaches xtask release tests, build.rs maps to qq
- any qq-provider change runs the minimal profile, now Clippy and tests
- parse real nextest 0.9.140 output: --color never, TRY n retries,
ABRT/TMT/SIG*, timed-out and aborted messages; record test counts;
fixtures under xtask/tests/fixtures
- stream gate output to the log file; run lint in-process; add a doctest
gate to full scope; reports live in the checkout's own target/
- --evidence refuses a report for another commit or tree state; a run
deletes the previous report first; hint when the pre-push hook is off
lint:
- only inline #[cfg(test)] mod { } blocks are test code (brace depth);
out-of-line mod tests; no longer exempts the rest of the file
- strings, raw strings, and char literals never match rules
- the sleep ceiling must equal the count (70), so it only moves down
smoke:
- serve logs to files; resume is proven by a second run after
reconnecting; per-invocation evidence; doctor exit checked; private
binary copy; blocking setup off the runtime
verify-qq: the fake restarts its script when script.jsonl changes;
qq-home.sh refuses a live home, execs qq, honours QQ_CONTEXT_WINDOW;
serve, TUI, and tools drives verified and corrected.
Docs: restore AGENTS.md rules lost in the rewrite (Executor MCP, git
status first, non-interactive, branch without an issue, architecture
caveat, ledger every session, bounded blocking); one regression-test
rule; review playbook and rows for protocol, TUI, docs-only, CI/xtask,
dependency and release work; repo-relative playbook paths; name: in
every SKILL.md; .worktrees/ ignored.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3a66f8dc21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Review fixes pushed in 293f458 (fast-forward, no shared branch rewrite); current main merged and AGENTS conflict resolved. All 15 findings addressed: flaky CI fails; SHA-256 index/working/untracked snapshot binds evidence; --full bypasses merge-base; Windows package and executable paths; compound cfg and test-function linting; code-only forbid; crossbeam/std unbounded detection; actual ADR links; async provider logging; stronger 401/resume assertions; duplicate --only deduplication; process identity + pidfd cleanup; ordinary .agents compatibility files. Independent review also found/fixed missing docs_truth mappings for architecture and run-output-queries. Verification at 293f458: cargo xtask check --full --profile ci passed: fmt/lint/Clippy; 2439/2439 tests (14 skipped); doctests; minimal provider Clippy and 211/211 tests, 146.1s. cargo xtask smoke 6/6; cargo build --workspace passed; xtask focused 95/95; duplicate --only invocation ran once; --full --base does-not-exist --dry-run passed; real verify-home fake/ask/stop passed. First unconstrained run exposed two shell-heavy delegation timeouts; both passed focused. Bounded nextest to eight test processes rather than increasing timeouts or accepting flaky retries; full CI-profile rerun passed twice. Corrected pre-existing sleep baseline 70→78 (four missed by scanner, four from main), no new sleeps. Windows is not locally verified. Follow-up stack starts AF6 cancellation module audit; AF5 tracing, remaining AF6 modules, AF9 mining, AF10 eval stay planned. |
|
Follow-up ca7709b fixes the GitHub-only flaky gate failure: removed the duplicate 50,000-directory watermark test, retaining search::tests::ab2_depth_excluded_siblings_advance_the_scan_frontier (three pages, deterministic 70-entry budget, cursor roundtrip/progress/depth exclusions/final discovery). Focused regression passes in 0.02s; full CI-profile local gate and 6/6 smoke pass. Nextest FLKY-FL statuses now appear in failure reports. Stacked follow-up opened: #311 (AF6.1 cancellation audit), based directly on this branch. No merge performed. Remaining AF5/AF6/AF9/AF10 work remains tracked in the plan and ENG-1028. |
|
Final independent review found and fixed one additional compound-cfg hole in 30f5168: cfg(any(test, feature=...)) must not exempt production channels. Only cfg(test) and top-level all(..., test, ...) now qualify; regression covers any, nested any and not(test). Ten lint regressions and the full CI-profile gate passed, smoke 6/6. Latest head is conflict-free; GitHub checks are still running. Stacked #311 synchronized at 7529dd7, full local gate 2438/2438 plus minimal 211/211 and smoke 6/6 green. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30f5168101
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| } | ||
|
|
||
| if let Some(index) = adr_index { |
There was a problem hiding this comment.
Fail when the ADR index itself is missing
When docs/adr/README.md is deleted or renamed, adr_index remains None and this entire validation block is skipped, so cargo xtask lint passes even though none of the remaining ADRs has an index row. Report the missing index as a finding before validating individual rows.
AGENTS.md reference: AGENTS.md:L153-L153
Useful? React with 👍 / 👎.
| - `.qq/skills/`: agent skills (`qq-mode`, `principles`, `verify-qq`, | ||
| `design-skill-or-pack`), with checked-in compatibility copies under | ||
| `.agents/skills/` (keep them identical to `.qq/skills/`). Packs with |
There was a problem hiding this comment.
Enforce synchronization of compatibility skill copies
When a maintainer updates a canonical .qq/skills/ file without manually repeating the edit under .agents/skills/, every new gate still passes because the lint only reads Rust files and the ADR index. The two agent surfaces then expose different instructions, so add a lint that compares both trees, including file presence and executable modes, rather than relying on this prose requirement.
AGENTS.md reference: AGENTS.md:L72-L74
Useful? React with 👍 / 👎.
| pub fn run(args: CheckArgs) -> Result<(), CheckError> { | ||
| let root = crate::smoke::root(); | ||
| let path = report_path(&root); | ||
| if args.evidence { |
There was a problem hiding this comment.
Reject execution flags combined with --evidence
When a user runs a natural combination such as cargo xtask check --full --evidence, this early return ignores --full and exits successfully after printing the previous affected-only report, so the requested merge gate never runs. Mark --evidence as conflicting with execution flags, or run the requested gate before emitting its evidence, so --full cannot be silently reduced to report display.
AGENTS.md reference: AGENTS.md:L31-L33
Useful? React with 👍 / 👎.
| let counted = sleeps.len(); | ||
| if counted < sleep_ceiling { | ||
| findings.push(Finding { | ||
| rule: Rule::SleepInTests, | ||
| path: "xtask/src/lint.rs".to_owned(), | ||
| line: 0, | ||
| detail: format!( | ||
| "{counted} fixed sleeps in test code is below the ceiling of {sleep_ceiling}; \ | ||
| lower SLEEP_CEILING to {counted} so the ceiling only moves down" | ||
| ), | ||
| }); | ||
| } | ||
| if counted > sleep_ceiling { |
There was a problem hiding this comment.
Track legacy sleep locations instead of only their count
When a change removes one existing fixed sleep and introduces a different one, counted remains equal to SLEEP_CEILING and the lint passes, despite the rule promising that every new fixed sleep fails. Preserve the legacy locations in an allowlist or require explicit per-site exemptions so deleting one violation cannot grant permission to add another elsewhere.
AGENTS.md reference: AGENTS.md:L151-L151
Useful? React with 👍 / 👎.
|
CI fixes pushed in 07dd915: retained all pagination assertions using a panic-safe thread-local test scan budget (128 entries instead of 50k fixture entries; production stays 50k). Blocking attachment/guidance/skill deadline fixture now admits the held operation with paused time, then explicitly advances past the deadline; no 500ms admission race. Full CI-profile local gate and smoke 6/6 pass. All original 15 review findings have fixing commits documented above, plus independent-review fixes. Please re-review latest head. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07dd915700
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed the four latest Codex findings in dab35ef/f7cb1765: pull_request labeled trigger preserves opened/synchronize/reopened; dry-run no longer removes report (real full gate → dry-run → --evidence verified); pre-push consumes every ref update and refuses unchecked non-HEAD tips; ignore reasons reject empty/whitespace with regression rows. Full CI-profile gate and smoke 6/6 pass. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7cb176562
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Fixed latest findings in 423c7df: pre-push refuses dirty index/worktree/untracked state; ignore reason validation decodes JSON-style escapes and raw literal contents (unknown literal forms fail closed); Git init runs with cleared environment, isolated HOME/config and empty template in smoke and verify homes; revision watcher watches absent loose refs as well as packed refs. Full CI-profile gate and smoke 6/6 green. @codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 423c7df72a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review Stack conflicts are resolved and pushed. Both PRs now report mergeable=true. Parent preserves current main action_bias wiring and previous review fixes; child includes the updated parent. Focused lint 11/11 and smoke unit tests 4/4 passed locally; the full local gate was interrupted, so remote CI is the outstanding full verification. Please review the latest tip. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9e0bfc286
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| false | ||
| } | ||
| }; | ||
| (passed, fs::read_to_string(&log_path).unwrap_or_default()) |
There was a problem hiding this comment.
Stream gate logs when constructing reports
When a failing test or compiler invocation produces a large log, this reads the entire file back into memory despite the preceding comment claiming bounded memory; the subsequent lines().collect() also retains an index over the whole output. A sufficiently noisy failure can therefore OOM cargo xtask check before it writes last.json, losing the actionable report. Parse counts and failures with a buffered reader while retaining only the bounded tail.
AGENTS.md reference: AGENTS.md:L92-L93
Useful? React with 👍 / 👎.
| repo=$(git -C "$(dirname "$0")" rev-parse --show-toplevel) | ||
| # Homes live in this checkout even when CARGO_TARGET_DIR is shared. | ||
| target=$repo/target | ||
| qq_bin=${QQ_BIN:-${CARGO_TARGET_DIR:-$repo/target}/debug/qq} |
There was a problem hiding this comment.
Resolve the verification binary before changing directories
When CARGO_TARGET_DIR is relative, such as CARGO_TARGET_DIR=target-cache, qq_bin remains relative to the caller's directory and passes the executable check, but both the qq and serve branches then cd into the isolated workspace before executing it. The command consequently looks for target-cache/debug/qq under that workspace and fails with “No such file”; resolve relative target directories against $repo when constructing this path.
Useful? React with 👍 / 👎.
| port=$(python3 -c 'import socket; s=socket.socket(); s.bind(("127.0.0.1",0)); print(s.getsockname()[1])') | ||
| echo "$port" > "$home/port" | ||
| fake_server "$home" "$port" >"$home/fake.log" 2>&1 & |
There was a problem hiding this comment.
Bind the fake server before publishing its port
When multiple verification homes or other loopback services start concurrently, the allocator closes its ephemeral socket before fake_server binds the selected port, so another process can claim it in between. The fake then either fails nondeterministically or the readiness probe can connect to an unrelated HTTP service, defeating the isolated verification drive; start the server on port 0 while retaining the listener and communicate the actual bound port back to the script.
AGENTS.md reference: AGENTS.md:L85-L87
Useful? React with 👍 / 👎.
| | `{"tool":"write_file","args":{"path":"x.txt","content":"hi"}}` | (read-only) | `tool_call_finished` with state `denied`; exit 0; no `x.txt` | | ||
| | same | `--approval auto` | state `completed`; `workspace/x.txt` exists | | ||
| | `{"tool":"shell","args":{"command":"rm -f gone.txt"}}` | `--approval auto` | `tool_approval_requested`, then `tool_approval_resolved` with `denied` | |
There was a problem hiding this comment.
Terminate scripted tool runs with a text reply
When an agent follows any of these first three rows literally, script.jsonl contains only the tool call, and the fake repeats its last reply after the runtime sends the tool result or denial back to the model. The run therefore requests the same tool repeatedly until a stall or turn limit instead of producing the documented exit or single approval result. Specify a second {"text":"done"} reply for each row that is expected to complete.
Useful? React with 👍 / 👎.
| http://$ADDR/v1/workspaces/$WS/events > $QQ_HOME/evidence/sse.txt & | ||
| SID=$(api /v1/sessions "{\"command_id\":\"$(cid)\",\"command\":{\"type\":\"create_session\",\"workspace_id\":\"$WS\",\"model\":{\"model\":\"verify/model\"}}}" | jq -r .outcome.session_id) | ||
| api /v1/sessions/prompts "{\"command_id\":\"$(cid)\",\"command\":{\"type\":\"submit_prompt\",\"session_id\":\"$SID\",\"input\":[{\"type\":\"text\",\"text\":\"hi\"}]}}" | jq -c .outcome | ||
| sleep 3; rg -o '"type":"(session_created|text_appended|run_finished)"' $QQ_HOME/evidence/sse.txt |
There was a problem hiding this comment.
Wait for the SSE completion event instead of sleeping
On a loaded host, the submitted run can take longer than three seconds, so this recipe can inspect the evidence file before run_finished arrives and falsely report that the end-to-end server path is broken; on a fast host it also waits longer than necessary. Poll or stream until the specific run's completion event is observed rather than using a fixed delay.
AGENTS.md reference: AGENTS.md:L169-L171
Useful? React with 👍 / 👎.
What this gives agents (and humans)
A fast, legible feedback loop and an exact workflow, so an agent can change qq, see immediately what broke, and prove what works. Inspired by poteto's pstack: a mode skill routing to playbooks, principle skills, a project verification skill with a feature map, and lessons encoded as tools instead of prose.
cargo xtask checktarget/qq-check/last.jsonwith each failing test, its panic, and the exact rerun commandqq-tuichange 46 s; full scope 53 scargo xtask smokeqqbinary (ask, run with a tool call, provider 401, session resume, serve + SSE reconnect, doctor/config) against an in-process loopback fake. Failures keep stdout/stderr, every provider request, and the storecargo xtask lintmod.rs,forbid(unsafe_code), reasoned#[ignore], no unbounded channels in production, ADR index rows, fixed sleeps in tests ratcheted at 70 (ceiling must equal the count)cargo xtask check --evidenceCI: PRs run the affected gate plus smoke;
merge_group,main, and manual runs runcheck --full, the embed and minimal-core profiles, wasm32, and Windows. Theci:fulllabel runs the platform jobs on a PR. Superseded PR runs are cancelled. Failed runs upload the report, JUnit, and smoke evidence.Operator action needed: enable the merge queue in branch protection and require
checks,client-wasm,windows-teardown. Until then the full gate only runs post-merge onmain(documented in AGENTS.md anddocs/runbooks/testing.md).Agent instructions:
AGENTS.mdbecomes a router (start withqq-mode, the loop in four commands, a Rules → enforcers table). Skills in.qq/skills(also.agents/skillsfor other harnesses):qq-mode: non-negotiables, autonomy limits, 13 playbooks (bug fix, feature, refactoring, perf, test audit, investigation, slice, review, babysit, session pickup, correct, opening a PR) plus routing rows for protocol, TUI, docs-only, CI/xtask, dependency, and release work.principles: the engineering principles the playbooks cite.verify-qq:qq-home.sh(isolated home plus a scripted fake provider) and a feature map for ask, run, serve, TUI, sessions, tools/approvals, delegation, compaction, MCP, and config/doctor. Replacesqq-verify.Build speed (AF0 baseline → now, loaded 32-core host)
cargo test --workspacewarmqq)src/edit, rebuild teststarget/debug/qqChanges:
[profile.dev] debug = "line-tables-only", no debuginfo for deps;build.rswatches every tracked file only for release builds (orQQ_EXACT_REVISION=1). A dev binary's-dirtyflag can lag until the next commit; release builds stay exact.Design decisions
qq: the smoke fake lives in xtask, the verify fake in a skill script..cargo/,.config/, andnix/select the full workspace; known cross-crate test inputs (docs/guide, README, fixtures) are mapped explicitly. A missing merge-base is an error, never a working-tree-only check. Feature-unification differences between-psubsets and--workspaceare caught by the merge-queue gate.target/, even with a sharedCARGO_TARGET_DIR, so parallel agents never read each other's results.How verified
cargo xtask check
Head
3a66f8dc217cvsorigin/main; 55 changed file(s); scope: full workspace.cargo fmt --all -- --checkcargo xtask lintcargo clippy --color never --workspace --all-targets --all-features -- -D warningscargo nextest run --color never --profile default --workspacecargo test --color never --workspace --doccargo clippy --color never -p qq-provider --no-default-features --features test-support --all-targets -- -D warningscargo nextest run --color never --profile default -p qq-provider --no-default-features --features test-supportAll gates passed in 36.3s.
run-tool-callfailed and kept the provider requests as evidence. Reverted.--evidencenamed the test, the panic (render.rs:429:9, left/right), and the rerun command.serve-ssefailed with "resume replayed sequence 1, at or before the cursor 11".verify-qqdrives run end to end: tools/approvals (denied vs completed), delegation (child session events), sessions/resume, serve via curl, and the TUI viascript.Not done here (planned in
docs/plans/agent-feedback.md)QQ_LOGstructured tracing (needs an ADR).qq-core sessions::tests::deadlines::duration_cancels_read_only_and_mutating_external_callsfailed once under load and passed 65/65 under stress.Linear: ENG-1028