[claude-hackernews] Reconcile drafts/ vs comments/ split; add cron no-op alert#4
Conversation
…-op alert Why the cron was firing OK with no PR: README.md (PR #3) said comments/ + commit/push/PR; CLAUDE.md and INSTRUCTIONS.md said drafts/<ts>.md with no Git steps. The agent reads CLAUDE.md as the binding always-on rules, so it would write a drafts/ file in the luv clone and stop -- never committing or pushing -- and the cron's "ok" event fired regardless because rc=0 was the only completion signal. Changes: - CLAUDE.md "Drafts only (never post)" -> "Comments via PR (never direct post)". Folder is comments/<utc-timestamp>.md. Adds the four-step PR workflow inline so the always-on rules now match README.md and the cron prompt. Drops drafts-as-pending-state language; the PR open/merged state is the source of truth. - INSTRUCTIONS.md "Writes (drafts only)" -> "Writes (comments via PR)". Step 6 saves to comments/, step 7 is the four-step PR flow. The three-surface coverage check becomes two-surface (drops drafts/). Inert composer recipe section header updated to match. - .gitignore re-adds drafts/ (was un-ignored in PR #2). - drafts/.gitkeep removed. - scripts/hourly_hackernews_cron.py: snapshot PR numbers on GH_REPO before and after _run_luv. On rc=0, post green "ok" only if a new PR appeared (with PR URL in the body); otherwise post a yellow "noop" embed so silent dead-ends are visible. If the gh query fails on either snapshot, the run downgrades to noop rather than risk a false-positive new-PR claim. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe pull request transitions the Hacker News interaction workflow from a "drafts-only" model to a "comments via PR" model. Changes include excluding Changes
Sequence DiagramsequenceDiagram
participant Cron as Hourly Cron
participant GH as GitHub (gh CLI)
participant Luv as Luv Tool
participant Discord as Discord Webhook
Cron->>GH: Snapshot existing PR numbers (before)
alt gh CLI available
GH-->>Cron: Set of PR numbers or None
else
GH-->>Cron: None (unavailable/timeout/error)
end
Cron->>Luv: Run luv workflow
alt luv succeeds
Luv-->>Cron: Exit 0
else
Luv-->>Cron: Non-zero exit
Cron->>Discord: Send fail embed
Cron->>Cron: Return error code
end
Cron->>GH: Snapshot existing PR numbers (after)
alt gh CLI available
GH-->>Cron: Set of PR numbers or None
else
GH-->>Cron: None (unavailable/timeout/error)
end
Cron->>Cron: Compute new_prs = prs_after - prs_before
alt new_prs exist and snapshots valid
Cron->>Discord: Send ok embed with PR URLs
else
Cron->>Discord: Send noop embed (yellow)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
…it prompt (#5) Why no comment PRs were appearing despite PR #4: the cron's prompt deferred all operational detail to README.md ("Follow the strict comment workflow in README.md") and let the agent in each luv clone infer how to discover threads, what commit-message format to use, what to put in the PR body, and how to surface the result. The agent dutifully read README, then either got stuck on discovery or stopped short of all four steps. Cron's noop alert from PR #4 made the dead-ends visible but didn't fix the underlying ambiguity. Cross-checked against the sibling repo: claude-reddit's hourly_reddit_cron.py has been producing one comment-draft PR per cron tick reliably (12 comment files, 30 PRs, including hourly drafts like "[claude-reddit] draft: r/<sub> - <topic>"). Its prompt is ~3x denser and inlines every step. Mirrored that structure here with HN-appropriate substitutions: - "DRAFT-ONLY MODE" -> "COMMENTS-VIA-PR MODE" (HN moved past drafts-only in PR #4; CLAUDE.md and INSTRUCTIONS.md now use the comments-via-PR language). - Reddit "search or sub feed" -> HN feed list "/news, /newest, /ask, /show, hn.algolia.com search, /from?site=..." (straight from INSTRUCTIONS.md "Where to look"). - "INSTRUCTIONS.md step 9" -> "INSTRUCTIONS.md Writes-comments-via-PR step 6" (the HN file-save step). - Commit message format: [claude-hackernews] draft: <short topic>. - Kept verbatim: ASCII-only punctuation reminder, one-draft-one-commit- one-PR anti-batching rule, final-reply surface instruction. Verification: - Python file parses (ast.parse passes). - New default prompt resolves to 943 chars (was ~520). - The prompt override variable still works (the new constant is the default for _env_str). - Smoke test: run with the force-flag override during HN working hours with an Operating Chrome session logged in; the run should produce a comment-file + commit + push + PR end-to-end. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Summary
The hourly cron was completing OK on Discord but not opening any PRs. Root cause: instructions disagreed about where writes go and whether to PR.
README.md(added in PR #3)comments/<ts>.mdLUV_PROMPTinhourly_hackernews_cron.pycomments/<ts>.mdCLAUDE.md"Drafts only (never post)"drafts/<ts>.mdINSTRUCTIONS.md"Writes (drafts only)"drafts/<ts>.mdThe agent reads CLAUDE.md as binding always-on rules, so it would write a
drafts/file in the luv clone and stop -- never committing or pushing -- and the cron's "ok" event fired regardless becauserc=0was the only completion signal. PR #3 explicitly flagged this divergence as a follow-up; this is that follow-up.Changes
comments/, step 7 is the commit/push/PR flow. Three-surface coverage check becomes two-surface (dropsdrafts/). Inert composer-recipe header updated.drafts/(was un-ignored in PR [claude-hackernews] Switch HN automation to drafts-only mode #2)._snapshot_pr_numbershelper. Cron snapshots PR numbers onGH_REPObefore and after_run_luv. Onrc=0, posts green "ok" only if a new PR appeared (PR URL in the body); otherwise posts a yellow "noop" embed so silent dead-ends are visible. If theghquery fails on either snapshot, the run downgrades to noop rather than risk a false-positive new-PR claim.Test plan
CLAUDE.md"Comments via PR (never direct post)" -- check the four-step workflow is unambiguous.INSTRUCTIONS.md"Writes (comments via PR)" steps 6 and 7 -- verify the comment file format and the PR command form match the existing convention ([claude-hackernews] ...titles).grep -rn 'drafts/' CLAUDE.md INSTRUCTIONS.md README.md scripts/ .gitignore-- only.gitignoreshould match.CRON_FORCE=1 python3 scripts/hourly_hackernews_cron.pyagainst a known fresh thread -- expect green "ok" Discord embed with PR URL.🤖 Generated with Claude Code
Summary by CodeRabbit