Hotfix blocked messages with Holochain debug fork#642
Conversation
The kitsune2 patches from holochain weren't being applied because Cargo patches need to be in the workspace root, not in individual crates. Added explicit patches for kitsune2 crates to use lucksus/kitsune2 fix/unexpected-blocked-messages branch which contains: - Fix for default-to-blocked behavior when no access decision exists - Debug logging to distinguish network vs warrant-based blocking This ensures ad4m builds use the fixed kitsune2 version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughPatches kitsune2 crates from a forked branch to address blocked-messages issues. Removes global SurrealDB singleton initialization and refactors retry logic to reduce parameter coupling. Updates dependency branches for holochain-related crates and API calls. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
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.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on January 4
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| setup_wallet(); | ||
| Ad4mDb::init_global_instance(":memory:").unwrap(); | ||
| AgentService::init_global_test_instance(); | ||
| init_prolog_service().await; |
There was a problem hiding this comment.
Test missing prolog service initialization will panic
The test_perspective_isolation_surreal_query test removes the init_prolog_service().await call but still invokes create_perspective().await, which internally calls ensure_prolog_engine_pool(). This function calls get_prolog_service().await, which panics with "PrologServiceInterface not set" if the prolog service hasn't been initialized. The test will fail at runtime.
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
rust-executor/src/perspectives/perspective_instance.rs (1)
1662-1692: Surreal retry helper is reasonable; string‑match is a bit brittleThe new
retry_surreal_ophelper gives you bounded retries on Surreal read/write conflicts with simple linear backoff and logs any non‑conflict failures, which is appropriate given Surreal is just a cache.The only minor concern is relying on the exact error message substring
"Failed to commit transaction due to a read or write conflict"; if SurrealDB changes its wording, retries will silently stop matching. If the Surreal client exposes a structured error type or code for conflicts, consider matching on that instead (or at least centralizing the message constant).
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
Cargo.tomlcli/src/repl.rsrust-executor/Cargo.tomlrust-executor/src/lib.rsrust-executor/src/perspectives/perspective_instance.rsrust-executor/src/surreal_service/mod.rsui/src-tauri/src/system_tray.rs
💤 Files with no reviewable changes (1)
- rust-executor/src/surreal_service/mod.rs
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-13T12:18:07.305Z
Learnt from: lucksus
Repo: coasys/ad4m PR: 630
File: bootstrap-languages/p-diff-sync/hc-dna/zomes/perspective_diff_sync/Cargo.toml:28-29
Timestamp: 2025-11-13T12:18:07.305Z
Learning: For Holochain 0.6.0-rc.0 (branch 0.6.0-rc.0-coasys), the correct and compatible HDI/HDK pairing is: hdi version 0.7.0-rc.0 and hdk version 0.6.0-rc.0. HDI is intentionally one minor version ahead of HDK in this release.
Applied to files:
rust-executor/Cargo.toml
📚 Learning: 2025-11-13T12:17:37.357Z
Learnt from: lucksus
Repo: coasys/ad4m PR: 630
File: bootstrap-languages/p-diff-sync/hc-dna/workdir/dna.yaml:2-2
Timestamp: 2025-11-13T12:17:37.357Z
Learning: For Holochain 0.6.0-rc.0, the correct manifest_version in DNA YAML files (dna.yaml) is 0, not 1. The mr_bundle library in Holochain 0.6.0-rc.0 errors when manifest_version is set to 1. The versioning appears to have been reset in this release.
Applied to files:
rust-executor/Cargo.toml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cursor Bugbot
🔇 Additional comments (4)
cli/src/repl.rs (1)
6-6: Import cleanup is correctRemoving the unused
Styleimport and keeping onlyThemeSetmatches actual usage and just silences a warning; no behavioral impact.rust-executor/src/lib.rs (1)
37-41: SurrealDB init removal here is consistent with per‑perspective setupDropping
init_surreal_servicefrom the imports (and fromrun()) fits with the new design where eachPerspectiveInstanceowns its ownSurrealDBService. This keeps executor startup focused on core services only; just ensure all runtime call‑sites that need Surreal now construct a service explicitly (as in the tests) and there are no lingering calls to the old initializer elsewhere.rust-executor/src/perspectives/perspective_instance.rs (1)
3286-3330: Test setup now matches per‑perspective Surreal usageImporting
SurrealDBServiceand constructing it directly insetup()/create_perspective()keeps tests aligned with the new “one Surreal instance per perspective” model and avoids relying on any removed global initializer. The in‑memory DB plus explicit service construction makes these tests good coverage for the new path.ui/src-tauri/src/system_tray.rs (1)
61-61: ✓ Tauri 2 API is correctThe
.show_menu_on_left_click(false)call is the correct Tauri 2.x API. It properly replaces the oldermenu_on_left_clickmethod and preserves the behavior of disabling the tray menu on left-click.
|
|
||
| [patch.crates-io] | ||
| # DEBUG: Using forked kitsune2 with debugging instrumentation and fixed default behavior | ||
| # These patches ensure ad4m uses the fixed kitsune2 that doesn't default to blocking | ||
| kitsune2_api = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2_core = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2 = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2_dht = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2_gossip = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2_bootstrap_srv = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } | ||
| kitsune2_bootstrap_client = { git = "https://github.com/lucksus/kitsune2.git", branch = "fix/unexpected-blocked-messages" } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, check if Cargo.toml exists and display the patch section
if [ -f "Cargo.toml" ]; then
echo "=== Cargo.toml [patch.crates-io] section ==="
sed -n '/\[patch\.crates-io\]/,/^\[/p' Cargo.toml | head -20
else
echo "Cargo.toml not found"
fi
# Try to run cargo tree if cargo is available
if command -v cargo &> /dev/null; then
echo ""
echo "=== Attempting cargo tree for kitsune2_api ==="
cargo tree -p kitsune2_api 2>&1 | head -30 || echo "cargo tree failed or package not found"
else
echo "Cargo command not available"
fi
# Check if there are any TODO comments related to kitsune2 patches
echo ""
echo "=== Searching for TODO comments related to kitsune2 or patches ==="
rg -i "todo.*kitsune2|todo.*patch" --max-count=20 || echo "No TODO comments found"
# Check for any commit hashes in the Cargo.toml to see if commits are pinned
echo ""
echo "=== Checking for commit-based patches ==="
rg "rev\s*=" Cargo.toml || echo "No rev= fields found (not pinned to commits)"Repository: coasys/ad4m
Length of output: 1565
Branch-pinned kitsune2 patches lack reproducibility and cleanup tracking
The [patch.crates-io] for all kitsune2* crates correctly redirects to your forked branch and will work for the hotfix. However:
- Pinning to a branch instead of a commit is fragile: If the branch is force-pushed or reset, the build's behavior changes unpredictably. For reproducibility and CI stability, specify a
revfield with an explicit commit hash. - No TODO to track patch removal: Add a comment or GitHub issue to remove this patch once the upstream Kitsune2 fix is merged and released. Without it, this temporary workaround risks becoming permanent technical debt.
Example improvement:
kitsune2_api = { git = "https://github.com/lucksus/kitsune2.git", rev = "<commit-hash>" } # TODO: Remove once lucksus/kitsune2#XXX is merged upstream
🤖 Prompt for AI Agents
In Cargo.toml around lines 9 to 19, the [patch.crates-io] entries use branch
pins for multiple kitsune2 crates which is non-reproducible and lacks cleanup
tracking; update each entry to pin to a specific commit by replacing the branch
with a rev = "<commit-hash>" value (use the exact commit hash you tested) and
add a short TODO comment on each line referencing the upstream PR/issue (e.g.,
"TODO: remove once lucksus/kitsune2#<PR> is merged") so CI builds are
deterministic and the temporary patch is tracked for removal.
| holochain = { version = "0.6.0", features = ["test_utils", "default", "backend-go-pion"], git = "https://github.com/coasys/holochain.git", branch = "blocked-messages-debugging" } | ||
| holochain_cli_bundle = { version = "0.6.0", git = "https://github.com/coasys/holochain.git", branch = "blocked-messages-debugging" } | ||
| holochain_types = { version = "0.6.0", git = "https://github.com/coasys/holochain.git", branch = "blocked-messages-debugging" } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# First, locate and examine the rust-executor/Cargo.toml file
find . -path "*/rust-executor/Cargo.toml" -type fRepository: coasys/ad4m
Length of output: 81
🏁 Script executed:
#!/bin/bash
# Examine the specific lines in rust-executor/Cargo.toml around holochain dependencies
if [ -f "rust-executor/Cargo.toml" ]; then
echo "=== Lines around 98-100 ==="
sed -n '90,110p' rust-executor/Cargo.toml
echo ""
echo "=== All holochain dependencies ==="
grep -n "holochain" rust-executor/Cargo.toml
fiRepository: coasys/ad4m
Length of output: 2176
🏁 Script executed:
#!/bin/bash
# Check for HDI/HDK dependencies as the learnings mention version pairing requirements
if [ -f "rust-executor/Cargo.toml" ]; then
echo "=== HDI/HDK dependencies in rust-executor ==="
grep -n "hdi\|hdk" rust-executor/Cargo.toml
fiRepository: coasys/ad4m
Length of output: 100
🏁 Script executed:
#!/bin/bash
# Check workspace structure for other Cargo.toml files that might have holochain deps
find . -name "Cargo.toml" -type f | head -20 | while read f; do
if grep -q "holochain\|hdi\|hdk" "$f" 2>/dev/null; then
echo "=== $f ==="
grep -n "holochain\|hdi\|hdk" "$f" | head -10
fi
doneRepository: coasys/ad4m
Length of output: 3946
🏁 Script executed:
#!/bin/bash
# Check git log to understand the blocked-messages-debugging branch context
cd rust-executor
git log --oneline --decorate -n 1 Cargo.toml 2>/dev/null || echo "Not a git repo in sandbox"
cd ..Repository: coasys/ad4m
Length of output: 158
🏁 Script executed:
#!/bin/bash
# Check if there's any documentation or comments about the blocked-messages-debugging branch
grep -r "blocked-messages-debugging" . --include="*.md" --include="*.toml" 2>/dev/null | head -20Repository: coasys/ad4m
Length of output: 575
Holochain debug branch pinning and rollback plan
Pointing holochain* crates at the blocked-messages-debugging branch is appropriate for this Kitsune2 fix, but without commit pinning, the build depends on a moving branch. This is acceptable for a temporary hotfix, but pin to a specific commit hash and track a follow-up task to revert back to the upstream 0.6.0-coasys branch once the Kitsune2 fix lands upstream.
🤖 Prompt for AI Agents
In rust-executor/Cargo.toml around lines 98 to 100, the holochain* dependencies
are currently referencing the moving branch "blocked-messages-debugging"; change
each dependency to pin to the specific commit SHA (use rev = "<commit-hash>" or
replace branch with the commit notation for the git dependency) so the build is
deterministic, add a short inline comment noting this is a temporary hotfix and
reference a follow-up task/issue to revert the three dependencies back to the
upstream 0.6.0-coasys branch once the Kitsune2 fix is merged, and commit the
updated Cargo.toml.
We've encountered "blocked_message_count" in our Holochain network stats, correlated with syncing lagging between the blocked node. This is a bug in Holochain that appears when network connections are flaky. See this PR in Kitsune2: holochain/kitsune2#417.
This needs more investigation in Holochain/Kitsune. My quickfix in that branch is not a sufficient fix because it breaks blocking when it's needed (see comments on that PR).
Currently we don't have membranes and no language with important validation code that would need warrents being executed. So we can run with above quick fix.
This branch switches to a temporary branch in Holochain/Kitsune2 in our forks until the issue is resolved in Holochian.
Also removes some warnings.
Note
Mitigates network "blocked messages" by moving to forked Holochain/Kitsune2 and refreshing dependencies.
kitsune2*fromfix/unexpected-blocked-messages; Holochain crates retargeted toblocked-messages-debuggingCargo.lock(notablyhyper1.7.0,reqwestalignment,sbd-server0.4.0, opentelemetry crates), several version pins/adjustmentsinit_surreal_service, global getter) and related test/setup calls; rely on per‑perspective instances; simplifyretry_surreal_opsignatureshow_menu_on_left_click(false)Written by Cursor Bugbot for commit 5e5aa83. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.