Skip to content

fix(guardian): make feature-check posts reliable#1341

Open
khaliqgant wants to merge 4 commits into
mainfrom
fix/relay-feature-guardian-narrow-slack-mount
Open

fix(guardian): make feature-check posts reliable#1341
khaliqgant wants to merge 4 commits into
mainfrom
fix/relay-feature-guardian-narrow-slack-mount

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

  • picker-gate Slack with SLACK_CHANNEL so Cloud derives only the selected production channel mirror
  • surface both thrown Slack write failures and successful-looking writes without a provider timestamp so the runner emits runner.handler.error instead of falsely reporting runner.handler.ok
  • move this low-reasoning hourly check from the Claude subscription shared by fleet orchestration to opencode / deepseek-v4-flash-free

The harness/model change is robustness hardening after the unusual multi-worker contention on 2026-07-19. The prior useSubscription: true configuration had run successfully since 2026-07-16; this PR does not characterize it as a standing configuration defect.

Validation

  • RED first for thrown write failure: focused guardian suite failed because the simulated post rejection resolved undefined instead of rejecting
  • RED first for receiptless success: focused guardian suite failed because a Slack write without provider ts resolved undefined instead of rejecting
  • GREEN: focused guardian suite 33/33
  • Prettier check passed for all changed source, persona, test, and changelog files
  • git diff --check passed after rebase onto current Relay main
  • exact-head content-identity bundle guard passed with relay helpers 0.4.9, adapter core 0.5.10, and all required writeback markers

Production gate

Do not merge on source/CI proof alone. Deploy this exact persona bundle with all current production inputs preserved, announce the exact redeploy command before execution, then require a real guardian fire on opencode / deepseek-v4-flash-free to reach relay-feature-guardian.posted with a real Slack ts and runner.handler.ok. Any miss is fail/stop, not retry.

@khaliqgant
khaliqgant requested a review from willwashburn as a code owner July 19, 2026 08:13
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c144b09c-5c8c-4942-affb-37e0b52595af

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The relay-feature-guardian now uses an explicit OpenCode model, gates Slack activation on SLACK_CHANNEL, and propagates Slack posting failures. Tests validate configuration, missing receipts, cycle state, and logging; trajectory records and the changelog document the changes.

Changes

Relay feature guardian Slack behavior

Layer / File(s) Summary
Persona configuration and contract validation
.agentworkforce/agents/relay-feature-guardian/persona.json, .agentworkforce/agents/relay-feature-guardian/agent.test.ts
The persona uses opencode with deepseek-v4-flash-free; Slack is optional and enabled by SLACK_CHANNEL, with tests covering the integration contract and mount paths.
Slack posting failure propagation
.agentworkforce/agents/relay-feature-guardian/agent.ts, .agentworkforce/agents/relay-feature-guardian/agent.test.ts
runGuardian rethrows Slack write errors and rejects when no delivery timestamp is returned; tests verify unchanged cycle state and structured error logging.
Completion and release records
.agentworkforce/trajectories/completed/2026-07/..., CHANGELOG.md
Trajectory artifacts and the unreleased patch changelog record the updated Slack gating and failure behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Guardian
  participant Slack
  participant CycleState
  Guardian->>Slack: messages.write
  Slack-->>Guardian: error or receipt
  Guardian->>CycleState: advance only after valid timestamp
  Guardian-->>Guardian: log post-failed and reject on failure
Loading

Possibly related PRs

Suggested reviewers: willwashburn

Poem

I’m a rabbit guarding Slack’s lane,
With channel gates and model brains.
Failed posts now hop upward clear,
Tests keep cycle state sincere.
Hop, hop—the patch is here!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the main change: making Guardian feature-check posts reliable.
Description check ✅ Passed The description covers the summary and validation details, but it uses a Validation section instead of the template's Test Plan heading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/relay-feature-guardian-narrow-slack-mount

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request picker-gates the 'relay-feature-guardian' Slack integration to the configured 'SLACK_CHANNEL' by adding 'optional: true' and 'enabledByInput: 'SLACK_CHANNEL'' to the Slack integration configuration in 'persona.json'. It also updates the corresponding TypeScript tests, documents the changes in 'CHANGELOG.md' under a new '[Unreleased - Patch]' section, and includes the completed trajectory files tracking the decisions made during this task. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@khaliqgant
khaliqgant force-pushed the fix/relay-feature-guardian-narrow-slack-mount branch from 5db3f94 to 0ae936f Compare July 19, 2026 19:57
@khaliqgant khaliqgant changed the title fix(guardian): narrow Slack bootstrap to selected channel fix(guardian): make feature-check posts reliable Jul 19, 2026
@khaliqgant

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 0ae936f5c1

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agentworkforce/agents/relay-feature-guardian/agent.ts (1)

783-788: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Throw an error when the Slack timestamp is missing to ensure the run fails.

While you correctly added throw err; in the catch block (line 783), the subsequent check for missing timestamps (!ts) still uses an early return. This results in a silent success for the agent run, which contradicts the PR objective to surface failed posts as failed runs.

More importantly, returning here skips the progress checkpoint, causing the agent to silently get stuck in an infinite loop picking the exact same feature on every subsequent cron tick. Throwing an error here ensures the run fails loudly and behaves identically to the exception path.

🐛 Proposed fix
     throw err;
   }
   const ts = deliveredSlackTs(result);
   if (!ts) {
     ctx.log('error', 'relay-feature-guardian.post-failed', { channel, feature: feature.id });
-    return;
+    throw new Error(`Slack post failed: no timestamp returned for feature ${feature.id}`);
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.agentworkforce/agents/relay-feature-guardian/agent.ts around lines 783 -
788, In the missing-timestamp branch after deliveredSlackTs(result), replace the
early return with a thrown error so the run fails and does not skip the progress
checkpoint. Preserve the existing relay-feature-guardian.post-failed log before
throwing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.agentworkforce/agents/relay-feature-guardian/agent.ts:
- Around line 783-788: In the missing-timestamp branch after
deliveredSlackTs(result), replace the early return with a thrown error so the
run fails and does not skip the progress checkpoint. Preserve the existing
relay-feature-guardian.post-failed log before throwing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 27df195b-9d01-4c3d-95aa-1f61ca1f4dfe

📥 Commits

Reviewing files that changed from the base of the PR and between 5db3f94 and 0ae936f.

📒 Files selected for processing (6)
  • .agentworkforce/agents/relay-feature-guardian/agent.test.ts
  • .agentworkforce/agents/relay-feature-guardian/agent.ts
  • .agentworkforce/agents/relay-feature-guardian/persona.json
  • .agentworkforce/trajectories/completed/2026-07/traj_u2rlmhnu5q7f/summary.md
  • .agentworkforce/trajectories/completed/2026-07/traj_u2rlmhnu5q7f/trajectory.json
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • .agentworkforce/trajectories/completed/2026-07/traj_u2rlmhnu5q7f/trajectory.json
  • .agentworkforce/trajectories/completed/2026-07/traj_u2rlmhnu5q7f/summary.md

@khaliqgant

Copy link
Copy Markdown
Member Author

Addressed the fresh CodeRabbit finding at exact head 7c2aa36070c71ddc566b1f4b672ca034de61ec5e: the no-provider-timestamp path now preserves the existing post-failed log and throws, with a RED-first regression (promise resolved "undefined" instead of rejecting) followed by 33/33 green. Fresh exact-head content-identity bundle preflight is green. @codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 7c2aa36070

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

@khaliqgant

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@khaliqgant
khaliqgant force-pushed the fix/relay-feature-guardian-narrow-slack-mount branch from 7c2aa36 to a01f310 Compare July 19, 2026 20:20
@khaliqgant

Copy link
Copy Markdown
Member Author

Rebased byte-equivalently onto live Relay main 09d2e359c (v10.6.6 release); range-diff shows all four PR commits equivalent. Exact new head a01f3109f3bbad55a38fd76ba1c8ec47ba7d3de2: guardian 33/33, Prettier/diff green, content-identity bundle guard green. @codex review

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

@khaliqgant: Reviewing the rebased PR head now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: a01f3109f3

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

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.

1 participant