feat(cli): aelf confirm — explicit user affirmation (#441) - #445
Conversation
Reviewer's GuideImplements a new Sequence diagram for the new aelf confirm CLI flowsequenceDiagram
actor User
participant CLI as aelf_cli
participant Store as belief_store
participant MCP as mcp_server_tool_confirm
participant DB as database
User->>CLI: run aelf confirm belief_id [--source] [--note]
CLI->>Store: _open_store()
CLI->>MCP: tool_confirm(store, belief_id, source, note)
MCP->>DB: apply_feedback(write row to feedback_history)
DB-->>MCP: write_result
MCP-->>CLI: result(prior_alpha, new_alpha, new_beta, note, kind)
CLI->>Store: close()
alt unknown_belief
CLI->>User: stderr confirm error: unknown belief
CLI-->User: exit code 1
else success
CLI->>User: stdout confirmed belief_id: alpha prior_alpha->new_alpha, mean posterior_mean
CLI-->User: exit code 0
end
Entity relationship diagram for feedback_history and belief_corroborationserDiagram
beliefs {
int id
string statement
}
feedback_history {
int id
int belief_id
float valence
string source
string created_at
}
belief_corroborations {
int id
int belief_id
string ingest_source
string content_hash
string created_at
}
beliefs ||--o{ feedback_history : has_feedback
beliefs ||--o{ belief_corroborations : has_corroborations
feedback_history ||..|| belief_corroborations : distinct_purposes
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 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. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The CLI output currently only prints the new posterior mean (
mean {posterior_mean:.3f}), but the feature spec shows a prior→new mean transition (e.g.,mean 0.500->0.667); consider either updating the implementation to emit both values or aligning the docs/spec to the current behavior. - The integration test
test_confirm_does_not_write_belief_corroborationsreaches intoMemoryStore._connand runs raw SQL; if possible, it would be more robust to expose a small public helper onMemoryStorefor this inspection rather than depending on a private attribute.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The CLI output currently only prints the new posterior mean (`mean {posterior_mean:.3f}`), but the feature spec shows a prior→new mean transition (e.g., `mean 0.500->0.667`); consider either updating the implementation to emit both values or aligning the docs/spec to the current behavior.
- The integration test `test_confirm_does_not_write_belief_corroborations` reaches into `MemoryStore._conn` and runs raw SQL; if possible, it would be more robust to expose a small public helper on `MemoryStore` for this inspection rather than depending on a private attribute.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
This PR is now behind Auto-rebase was removed because the bot has no signing key; rebasing as the bot strips author signatures and the |
|
[claim:review:Toug:2026-05-05T17:33:09Z] |
6cba6bc to
cbcce36
Compare
|
[release:review:Toug:2026-05-05T17:37:36Z] |
Closes #441.
Summary
Adds the CLI port of the shipped MCP
aelf_confirmtool (#390).aelf confirm <belief-id>is an explicit user affirmation: it bumps the Beta-Bernoulli α by 1.0 withsource="user_confirmed", distinguishable from the implicitfeedback usedsignal infeedback_historyqueries.5 atomic SSH-signed commits (all
G):Reconciliation note (issue body acceptance #2)
#441's body says confirm "Writes a row to the
belief_corroborationstable (#190)." That's stale — the shipped MCPtool_confirmwrites tofeedback_historyviaapply_feedback, not tobelief_corroborations. Thebelief_corroborationstable tracks duplicate re-ingests (a structural dedup concern); confirm is an explicit user signal. The CLI follows the MCP. The spec memo (docs/feature-aelf-confirm-cli.md§ "Reconciliation with issue #441 body") makes this explicit.Verification
uv run pytest tests/test_cli_confirm.py— 9 passeduv run pytest tests/test_cli.py tests/test_mcp_server.py tests/test_lock_management.py tests/test_corroborations.py— 137 passeduv run aelf confirm --help— visible subcommandG)Files
docs/feature-aelf-confirm-cli.md(new, +113)docs/COMMANDS.md(count bump 28→29 + row)src/aelfrice/cli.py(+56:_cmd_confirm+ argparse subparser + top-of-file help line)src/aelfrice/slash_commands/confirm.md(new, +21)tests/test_cli_confirm.py(new, +196: 9 tests covering happy path / unknown belief /--note/--source/ posterior mean / non-write to belief_corroborations)Summary by Sourcery
Add an explicit CLI and slash-command entry point for affirming beliefs via the existing confirmation feedback path.
New Features:
aelf confirmCLI subcommand to explicitly affirm a belief and update its Beta-Bernoulli posterior via feedback_history./aelf:confirmslash command that routes to the CLI confirmation behavior.Enhancements:
aelf confirmCLI in a dedicated feature spec and update the commands reference.Documentation:
aelf confirmCLI behavior and its relationship to existing feedback and lock operations.confirmsubcommand and its semantics.Tests:
aelf confirmcovering happy path, custom source and note handling, unknown beliefs, and storage behavior./aelf:confirmentry.