Skip to content

Watchlist: persist multi-owner PR state in watchlist.json - #190

Open
rmems wants to merge 14 commits into
mainfrom
cursor/watchlist-persistent-state-81d0
Open

rmems wants to merge 14 commits into
mainfrom
cursor/watchlist-persistent-state-81d0

Conversation

@rmems

@rmems rmems commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Important

Current owner direction (2026-09-21): this PR is a view/consumer, not a second coordination authority. RM-825 owns shared Rust/SQLite coordination state. Preserve useful watchlist/status work, but remove or avoid duplicate state/schema that competes with RM-825. Harnesses own checkouts; writ registers/coordinates them. Normal assigned-branch local integration is allowed. Linear/RM-116 is current task steering; do not revive Python orchestration, GitHub issue mirroring, or a new merge gate.

User description

Update (RM-116 alignment + CI fixes)

Session bc-f3cdb75f on cursor/watchlist-persistent-state-81d0.

Scope preserved: writ watchlist remains a visibility surface for multi-owner PR state (watchlist.json), not a scheduler, permission store, or merge gate. Coordinated on Linear with RM-825 (lease/message contract consumer only) and RM-145 (status shape alignment — watchlist stays external PR visibility, separate from lease/job rows).

Head: f0138da — focused coverage + maintainability without silencing checks:

  • In-crate CLI unit tests for watchlist::run (list/add error/remove human paths)
  • writ-core tests: WatchlistError display/codes, import/probe edge paths, --reset, timeout refresh, run_with_timeout fast-fail
  • Split CLI dispatch + pr-babysit import helpers (Codacy/CodeScene surface reduction)
  • Test scratch under target/ instead of temp_dir where flagged

Local patch coverage (merge-base diff, cargo llvm-cov): 87.26% (was ~77.7% on Codecov report).

Not in this PR: RM-825 shared inbox schema, RM-145 AGENTS simplification, GitHub settings/merge.

Linear Issue: RM-127

Open in Web Open in Cursor 

Summary by cubic

Implements Linear RM-127 by persisting the multi-owner PR watchlist in a separate versioned watchlist.json (distinct from watched.json), so writ status and writ jobs keep their JSON-array read path. The watchlist is external GitHub PR visibility only, never coordination authority.

New Features

  • Adds writ watchlist add|remove|list|check|check-all|import-pr-babysit; import refreshes source fields and preserves fix_count.
  • Entries use (repo, number) identity with case-insensitive repo comparison and include stack_type; add uses allowlisted gh pr view, skips MERGED/CLOSED, and preserves fix_count unless --reset.
  • Multi-owner check-all requires WRIT_ALLOWED_OWNERS (or WH_ALLOWED_OWNERS), refreshes status/residuals/check count, prunes MERGED/CLOSED, and never increments fix_count or spawns babysit workers.
  • Empty/in-progress CI, drafts, and unknown mergeability classify as pending; STARTUP_FAILURE and STALE rollups fail; each check persists before the next gh call.
  • Stack identity follows the parent chain regardless of add order; missing identities return NOT_FOUND.
  • Writes are atomic temp-file + rename with mode 600, crash-safe Windows replacement, and corrupt-file quarantine; default path {user_data}/writ/watchlist.json with legacy fallback and WRIT_WATCHLIST_PATH/WH_WATCHLIST_PATH overrides.

Written for commit ff6c874. Summary will update on new commits.

Review in cubic


CodeAnt-AI Description

Add persistent multi-owner PR watchlist commands

What Changed

  • Added writ watchlist commands to add, remove, list, check, check all, and import pull requests from existing babysit state.
  • Watchlist entries persist in a separate watchlist.json, support owner and repository filters, preserve stacked PR relationships, and recognize case-insensitive repository identities.
  • Checks classify pull requests as healthy, pending, failed, residual, conflicted, or timed out; merged and closed PRs are removed during refreshes.
  • Multi-owner check-all requires an explicit allowed-owner list, while corrupt files are quarantined and writes preserve a recoverable private file.
  • Added JSON and human-readable CLI output, documentation, and coverage for persistence, filtering, imports, failures, timeouts, and stack ordering.

Impact

✅ Persistent PR tracking across check cycles
✅ Safer multi-owner check-all scope
✅ Clearer pending, failure, conflict, and timeout status
✅ Recovery from corrupt watchlist files

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Reimplement GitHub #12 / Linear RM-127 in Rust after the Python
orchestrator was removed. The store is a separate file from job-status
watched.json, with add/remove/list/check/check-all, atomic writes,
quarantine of corrupt state, and allowlisted check-all.

Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
@linear-code

linear-code Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RM-127

@coderabbitai

coderabbitai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 19 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: rmems/writ/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9e062687-adba-493f-9691-6633765b2752
📥 Commits

Reviewing files that changed from the base of the PR and between d79311c and ff6c874.

📒 Files selected for processing (29)
  • AGENTS.md
  • README.md
  • REVIEW.md
  • SKILL.md
  • crates/writ-core/src/owners.rs
  • crates/writ-core/src/paths.rs
  • crates/writ-core/src/state.rs
  • crates/writ-core/src/watchlist/classify.rs
  • crates/writ-core/src/watchlist/coord_read.rs
  • crates/writ-core/src/watchlist/github.rs
  • crates/writ-core/src/watchlist/import.rs
  • crates/writ-core/src/watchlist/mod.rs
  • crates/writ-core/src/watchlist/ops.rs
  • crates/writ-core/src/watchlist/ops_tests.rs
  • crates/writ-core/src/watchlist/probe.rs
  • crates/writ-core/src/watchlist/schema.rs
  • crates/writ-core/src/watchlist/stack.rs
  • crates/writ-core/src/watchlist/store.rs
  • crates/writ-core/src/watchlist/types.rs
  • crates/writ-core/src/watchlist/view.rs
  • crates/writ-core/src/watchlist/view_tests.rs
  • crates/writ/src/main.rs
  • crates/writ/src/watchlist.rs
  • crates/writ/tests/watchlist_cli.rs
  • docs/cli-contract.md
  • docs/examples/README.md
  • docs/examples/watchlist-list.json
  • docs/status-schema.md
  • docs/watchlist-schema.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR successfully implements persistent multi-owner PR watchlist state in Rust. The implementation shows strong attention to detail with atomic file operations, proper error quarantining, POSIX file mode security (600), comprehensive test coverage, and well-structured error types.

Key strengths:

  • Atomic temp-file + rename pattern prevents partial writes
  • Corrupt files are quarantined rather than silently overwritten
  • Schema versioning with forward compatibility checks
  • Comprehensive test coverage including edge cases
  • Proper security with file mode 600 for sensitive PR titles

Critical issue identified:
One security vulnerability requires attention: the quarantine operation has a TOCTOU (time-of-check-time-of-use) race condition between checking file existence and renaming. This should be fixed to use atomic operations.

All tests pass (cargo test, cargo clippy, cargo fmt), and the feature is well-documented in SKILL.md and watchlist-schema.md.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread crates/writ-core/src/watchlist/store.rs Outdated
codescene-access[bot]

This comment was marked as outdated.

@codacy-production

codacy-production Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Security 1 high

View in Codacy

🟢 Metrics 0 complexity · 53 duplication

Metric Results
Complexity 0
Duplication 53

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…ding

Address independent review of the watchlist store: empty status rollups
are pending, each check is saved before the next gh call, Windows replaces
an existing file, filtered check of a disallowed owner is rejected, and
stack identity walks the parent chain regardless of add order.

Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
@rmems
rmems marked this pull request as ready for review September 15, 2026 05:42
@codeant-ai

codeant-ai Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 108a912 Oct 03, 2026 · 10:30 10:31
✅ Incremental review completed f0138da Sep 19, 2026 · 21:54 21:54
✅ Incremental review completed c3a4b94 Sep 19, 2026 · 01:16 01:17
✅ Incremental review completed 1030612 Sep 18, 2026 · 21:28 21:29
✅ Incremental review completed 18e0a46 Sep 18, 2026 · 01:06 01:07

@codeant-ai

codeant-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-03T10:52:35.837794Z 5a10fb7 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Sep 15, 2026
codescene-access[bot]

This comment was marked as outdated.

Comment thread crates/writ-core/src/watchlist/store.rs Outdated
Comment thread crates/writ-core/src/watchlist/store.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: befd6761f3

ℹ️ 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".

Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ/src/watchlist.rs Outdated
Comment thread crates/writ-core/src/watchlist/store.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/store.rs Outdated
Comment thread crates/writ/src/watchlist.rs

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

  • ✅ Fixed: Check succeeds for missing entries
    • select_check_targets now validates --repo and returns NOT_FOUND when a requested number is not on the watchlist.
  • ✅ Fixed: Repo identity is case-sensitive
    • Repo identity and --repo filters now compare owner/name slugs with eq_ignore_ascii_case so mixed-case GitHub slugs match one row.
  • ✅ Fixed: Startup failures mark PRs healthy
    • classify_snapshot treats STARTUP_FAILURE and STALE conclusions as failing checks instead of falling through to healthy.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit befd676. Configure here.

Comment thread crates/writ/src/watchlist.rs
Comment thread crates/writ-core/src/watchlist/schema.rs
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
`watchlist check --repo` now returns NOT_FOUND for absent identities and
rejects malformed slugs instead of succeeding on an empty target set.
Repo identity compares owner/name case-insensitively so mixed-case GitHub
slugs cannot duplicate or miss a row. STARTUP_FAILURE and STALE rollup
conclusions classify as failed rather than healthy.

Agent: Cursor Grok 4.6

Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

Address substantive bot review findings on PR #190:
- store: crash-safe Windows replace_file (backup/restore, never zero copies)
- store: create temp file with mode 0600 at creation time on Unix
- store: quarantine_corrupt uses a rename loop instead of exists() precheck
- ops: treat empty CheckRun conclusion/state/status as absent (in-progress
  no longer looks healthy)
- ops: classify mergeable UNKNOWN/empty and draft PRs as Pending
- ops: bounded gh probe via SafeGhCommand::run_with_timeout mapped to
  WatchlistError::Timeout (self-contained, no async supervisor rewrite)
- ops: import_pr_babysit rejects malformed repo identities and refreshes
  existing entry source fields while preserving fix_count

Adds unit tests for each; fmt/clippy/test gates green.
…st biomarkers

- write_add takes a command name so import-pr-babysit emits
  watchlist.import_pr_babysit instead of watchlist.add
- entry_json now includes stack_type (additive, v1-compatible)
- detect_stacks picks the lowest PR number on head-branch collisions
  for deterministic parent inference (cycle-safe walk preserved)
- extract classify_readiness/checks/review, compute_parents/
  assign_positions/walk_to_root, insert_or_refresh_entry (AddContext),
  CheckScope/validate_check_scope, is_valid_slug, accept_parsed/
  quarantine_and_report, and CLI run_add/add_report_is_empty to cut
  CodeScene complexity/arg-count/bumpy-road biomarkers, behavior intact
- dedupe watchlist_cli tests via run_json/write_sample helpers
@codereviewbot-ai

Copy link
Copy Markdown

🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews.

rmems commented Sep 18, 2026

Copy link
Copy Markdown
Owner Author

Bot comments addressed (45 inline across 5 reviewers)

Substantive fixes (persistence, classification, gh probe)

  • Windows replace loses watchlist (codex/codeant): backup/restore sequence so a readable copy always survives (was remove-then-rename).
  • Temp file permissions (codex): temp created mode 0600 at creation via OpenOptionsExt (was chmod after umask).
  • Quarantine exists()/rename race (amazon-q): TOCTOU-free rename loop reacting to AlreadyExists.
  • Empty conclusion → healthy (codex): non_empty() maps Some("")→None; in-progress checks now Pending.
  • mergeable UNKNOWN stays healthy (codex): non-MERGEABLE classified Pending (pending:mergeable_unknown); CONFLICTING still short-circuits.
  • Draft PRs (codex): isDraft added to gh field list + snapshot; drafts classified Pending.
  • gh probe no timeout (codex/codeant): new run_with_timeout(Duration) with drained pipes + 120s deadline → WatchlistError::Timeout.
  • Import accepts malformed repo (codeant): owner_of_repo validation skips malformed slugs.
  • Import doesn't refresh existing (codeant): existing entries refresh source fields while preserving fix_count.
  • Stack inference first-match/cycles (codeant): deterministic lowest-PR-number parent selection; cycle-safety preserved.
  • CLI import command name (codex): write_add now emits watchlist.import_pr_babysit.
  • stack_type in JSON (codex): additive stack_type field in entry_json.

Already fixed at HEAD (cursor[bot], verified present)

check --repo NOT_FOUND for missing entries · case-insensitive repo identity · STARTUP_FAILURE/STALE in hard-fail set.

codescene-access (26 biomarkers)

Addressed by behavior-preserving extraction: classify_snapshot split into readiness/checks/review/resolve; select_check_targets → CheckScope; add_prs → insert_or_refresh_entry/AddContext; detect_stacks → compute_parents/assign_positions/walk_to_root; owner_of_repo → is_valid_slug; load_watchlist split; CLI run_add; test dedup helpers. Left with rationale: the public/adapter arg-count biomarkers on add_prs_at/check_prs_at/check_prs/CLI add_command (param-struct wrapping would ripple through re-exports + ~15 call sites for no behavior gain) and module-level cohesion (full submodule split judged higher-risk than the gain).

Not applicable

  • codex "class_a regardless of provider": deferred — no provider metadata exists in the gh rollup; the class_a/b/c tokens are opaque advisory strings, not merge-authority signals (AGENTS.md keeps merge authority out of runtime).
  • codex Codex-attribution demands: false positive per AGENTS.md (commits are Cursor-authored); no rewrite.

Verification (Linux)

cargo fmt --all -- --check clean · cargo clippy --workspace --all-targets -- -D warnings clean · cargo test --workspace 181 unit + 28 + 11 + 6 integration, 0 failures (+9 new tests, reversion-sensitive).

codescene-access[bot]

This comment was marked as outdated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18e0a46c53

ℹ️ 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".

Comment thread crates/writ-core/src/git_safe.rs Outdated
Comment thread crates/writ-core/src/watchlist/store.rs
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs Outdated
Keep the watchlist persistence work together with main's hook, lease,
and fork-PR import changes. Conflicts were resolved by preserving both
sides.

Agent: Cursor Grok 4.6

Co-authored-by: Grok <noreply@x.ai>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Raul Montoya Cardenas  <montoyaraul34@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

Add writ-core and in-crate CLI unit tests for error display, import/probe
paths, reset/timeout refresh, and gh run_with_timeout fast-fail. Split
watchlist CLI dispatch and pr-babysit import helpers for maintainability.
Use target/ scratch dirs in tests instead of system temp_dir.

Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

@rmems

rmems commented Sep 21, 2026

Copy link
Copy Markdown
Owner Author

RM-127 owner direction (2026-09-21) retargets this as a view over leases.db, not a competing watchlist.json store.

Continuation after rebase onto current main (#199/#197): #200 (cursor/watchlist-status-view-e493 @ af4b4c6).

This PR (#190) is left in place; I am not merging or closing it from this session.

Agent: Cursor Grok 4.6

devin-ai-integration Bot pushed a commit that referenced this pull request Sep 21, 2026
Retarget RM-127 / PR #190 as a consumer of the shared SQLite lease
store instead of a competing watchlist.json. list/check/check-all
compose lease ownership, optional coord_claims/messages, recovery,
and live GitHub PR overlay. add/remove do not persist.

Local collab_status is independent of GitHub check_status and is not
a merge gate. Coord tables are read when present and skipped when
absent (RM-825 owns that schema).

Refs: Linear RM-127, RM-825, RM-116

Agent: Cursor Grok 4.6

Co-authored-by: Cursor <cursoragent@cursor.com>
devin-ai-integration Bot pushed a commit that referenced this pull request Sep 21, 2026
Retarget RM-127 / PR #190 as a consumer of the shared SQLite lease
store instead of a competing watchlist.json. list/check/check-all
compose lease ownership, optional coord_claims/messages, recovery,
and live GitHub PR overlay. add/remove do not persist.

Local collab_status is independent of GitHub check_status and is not
a merge gate. Coord tables are read when present and skipped when
absent (RM-825 owns that schema).

Refs: Linear RM-127, RM-825, RM-116

Agent: Cursor Grok 4.6

Co-authored-by: Cursor <cursoragent@cursor.com>
@rmems rmems added enhancement New feature or request core rust labels Oct 1, 2026 — with Cursor
…istent-state-81d0

Amp-Thread-ID: https://ampcode.com/threads/T-01a1014a-23d3-721b-adf3-ff6fe4f0f31b

# Conflicts:
#	AGENTS.md
#	README.md
#	REVIEW.md
#	SKILL.md
#	crates/writ-core/src/git_safe.rs
#	crates/writ-core/src/lib.rs
#	crates/writ-core/src/state.rs
#	crates/writ-core/src/watchlist/classify.rs
#	crates/writ-core/src/watchlist/mod.rs
#	crates/writ/src/main.rs
#	crates/writ/src/watchlist.rs
#	crates/writ/tests/watchlist_cli.rs
#	docs/examples/README.md
#	docs/status-schema.md
#	docs/watchlist-schema.md
#	docs/workflows/safe-issue-verified-commit.md
#	docs/workflows/safe-verified-commit-to-pr.md
codescene-access[bot]

This comment was marked as outdated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 108a912a0b

ℹ️ 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".

Comment thread crates/writ/src/main.rs Outdated
Comment thread docs/watchlist-schema.md Outdated
Comment thread crates/writ-core/src/watchlist/ops.rs
.iter()
.enumerate()
.filter(|(j, other)| {
*j != i && repos_match(&other.repo, &entry.repo) && other.branch == base

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Distinguish fork heads when inferring stack parents

When two watched PRs target the same repository, this predicate treats any matching head branch name as the parent even if that head belongs to a fork. For example, a fork PR whose head is release is falsely made the parent of an unrelated PR based on the upstream repository's release branch, corrupting the persisted group and bottom-up check order. The replaced probe retained headRepositoryOwner, and gh pr view --help confirms that field is available; request and store it so only a head in the base repository can satisfy this parent match.

AGENTS.md reference: AGENTS.md:L24-L24

Useful? React with 👍 / 👎.

Comment thread crates/writ-core/src/watchlist/import.rs Outdated
Amp-Thread-ID: https://ampcode.com/threads/T-01a1014a-23d3-721b-adf3-ff6fe4f0f31b
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1014a-23d3-721b-adf3-ff6fe4f0f31b
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
codescene-access[bot]

This comment was marked as outdated.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1014a-23d3-721b-adf3-ff6fe4f0f31b
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

codescene-access[bot]

This comment was marked as outdated.

@codacy-production

codacy-production Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Security 1 high

View in Codacy

🟢 Metrics 0 complexity · 53 duplication

Metric Results
Complexity 0
Duplication 53

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1014a-23d3-721b-adf3-ff6fe4f0f31b
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a10fb7603

ℹ️ 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".

Comment on lines +60 to +62
Err(err) if err.kind() == io::ErrorKind::NotFound => {
if !recover_replacement_backup(path)? {
return Ok(Watchlist::default());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid backup recovery during an active Windows replacement

On Windows, a read-only list can hit this NotFound branch after replace_file has renamed the destination to .bak-replace but before it installs the temporary file. Because reads do not acquire the sidecar lock, the reader restores the backup to the canonical path and removes the backup; the writer's subsequent fs::rename(from, to) then fails because the destination exists, causing an otherwise valid concurrent mutation to return IO_ERROR. Coordinate recovery with the writer lock or use a replacement scheme whose transient missing path cannot be mistaken for crash recovery.

Useful? React with 👍 / 👎.

Comment on lines +86 to +89
if parent[i].is_none() && !has_child[i] {
list.prs[i].stack_id = None;
list.prs[i].stack_type = None;
list.prs[i].stack_position = None;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve imported stack annotations across later refreshes

When an import contains a partial or otherwise non-inferable stack, the import path now restores its source stack_id and stack_position, but every subsequent add, remove, or check calls detect_stacks again and this branch clears those annotations whenever no watched parent/child relation is currently visible. ordered_identities then falls back to repository/PR-number sorting, so later check cycles can lose the imported bottom-up order. Fresh evidence after the earlier import fix is that these later detection calls have no corresponding restoration step; retain explicit annotations until a complete inferred chain supersedes them.

AGENTS.md reference: AGENTS.md:L24-L24

Useful? React with 👍 / 👎.

Comment on lines +107 to +112
let github_state = snapshot.state.to_ascii_uppercase();
if github_state == "MERGED" || github_state == "CLOSED" {
report
.skipped
.push((repo.to_owned(), number, snapshot.state.clone()));
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove an existing entry when add finds it closed

When add is used to refresh an identity already on the watchlist and GitHub now reports it as MERGED or CLOSED, this early return records the PR as skipped but leaves the existing entry untouched. The command can therefore report that the closed PR was skipped while list continues to expose its stale pre-closure status until a separate check cycle happens to prune it; remove a matching existing entry here and recompute its stack metadata.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Failed
New code is healthy (2 new files with code health below 10.00)
Enforce critical code health rules (1 file with Low Cohesion)
Enforce advisory code health rules (2 files with Excess Number of Function Arguments, Large Method, String Heavy Function Arguments, Large Assertion Blocks)

Our agent can fix these. Install it.

Gates Passed
3 Quality Gates Passed

Reason for failure
New code is healthy Violations Code Health Impact
ops_tests.rs 4 rules 7.45 Suppress
ops.rs 1 rule 9.69 Suppress
Enforce critical code health rules Violations Code Health Impact
ops_tests.rs 1 critical rule 7.45 Suppress
Enforce advisory code health rules Violations Code Health Impact
ops_tests.rs 3 advisory rules 7.45 Suppress
ops.rs 1 advisory rule 9.69 Suppress

See analysis details in CodeScene

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core enhancement New feature or request rust size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

4 participants