Skip to content

Commit 66f022f

Browse files
author
CodeWhale Bot
committed
fix: stabilize continuous sessions and automation recovery
Keep active tool schemas stable through emergency compaction, account for retained reasoning, and extract prefix caching into headless Core. Recover missing session stores without reusing lost authority or allowing stale writers to replace the recovered binding; support the session picker too. Coalesce missed automation occurrences without overlap or replay, isolate corrupt siblings, and reconcile only the current runtime ownership scope. Use compact default metrics and consistent composer/rail geometry. Validation on exact source tree 77342d1: - Rust nextest: 13,281 passed, 0 failed, 20 skipped (Core/TUI/config/localization lib). - npm test: 521 passed, 0 failed (66 wrapper + 9 package + 446 web). - npm run check:web: passed. - cargo fmt --all -- --check: passed. An earlier 2-second compaction settlement watchdog failed under full load; 10 unchanged focused repetitions passed. Reuse the existing 10-second settlement watchdog while preserving all durable completion assertions. Installed-binary acceptance, hosted CI and release publication are separate.
1 parent 0660289 commit 66f022f

36 files changed

Lines changed: 2032 additions & 1124 deletions

.github/workflows/marketplace-sync.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
timeout-minutes: 10
2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
2828
with:
2929
path: core
3030
persist-credentials: false
@@ -44,15 +44,16 @@ jobs:
4444
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
4545
output.write(f'revision={revision}\n')
4646
PY
47-
- uses: actions/checkout@v4
47+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
4848
with:
4949
repository: Hmbown/codewhale-plugin-marketplace
5050
ref: ${{ steps.source.outputs.revision }}
5151
path: marketplace
5252
persist-credentials: false
53-
- uses: actions/setup-node@v4
53+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
5454
with:
5555
node-version: '22'
56+
package-manager-cache: false
5657
- name: Check catalog and real bundle manifests
5758
run: node marketplace/scripts/check-marketplace.mjs
5859
- name: Check bundled catalog snapshot

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config.example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ osc8_links = true # emit OSC 8 escapes around URLs (Cmd+click in iTer
11571157
# # compact keeps the posture chips (and the cap
11581158
# # warning) and drops the clocks, counts and hint;
11591159
# # hidden gives the row to the transcript.
1160-
# metrics_line = "full" # full | compact | hidden (default full)
1160+
# metrics_line = "compact" # full | compact | hidden (default compact)
11611161
# # compact keeps the route, context reading, cost
11621162
# # and balance and drops the telemetry and the
11631163
# # help hint; hidden gives the row to the transcript.

crates/core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ codewhale-protocol = { path = "../protocol", version = "0.9.13" }
2323
codewhale-state = { path = "../state", version = "0.9.13" }
2424
codewhale-tools = { path = "../tools", version = "0.9.13" }
2525
regex = "1.11"
26+
sha2.workspace = true
2627
serde_json = { workspace = true, features = ["preserve_order"] }
2728
tokio = { workspace = true, features = ["time"] }
2829
tracing.workspace = true

crates/core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod context_reference;
22
pub mod fragments;
33
pub mod ids;
44
pub mod journal;
5+
pub mod prefix_cache;
56
pub mod request;
67
pub mod role;
78
pub mod session;
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ use std::hash::{Hash, Hasher};
4141

4242
use serde::{Deserialize, Serialize};
4343

44-
use codewhale_models::{SystemPrompt, Tool};
44+
use crate::request::{SystemPrompt, Tool};
4545

4646
/// A snapshot of the immutable prefix's fingerprint.
4747
///
48-
/// Two snapshots with the same `combined` hash are guaranteed to
49-
/// produce the same byte prefix when serialized for the API.
48+
/// Matching hashes show stable system text and the normalized OpenAI-style
49+
/// tool catalog. They do not measure provider cache hits or fingerprint every
50+
/// provider-specific wire transformation; request replay tests cover those.
5051
#[derive(Debug, Clone, Serialize, Deserialize)]
5152
pub struct PrefixFingerprint {
5253
/// SHA-256 of the system prompt text.
@@ -730,7 +731,13 @@ fn tool_to_api_json(tool: &Tool) -> Option<String> {
730731

731732
/// Compute the SHA-256 hex digest of a byte slice.
732733
fn sha256_hex(bytes: &[u8]) -> String {
733-
crate::hashing::sha256_hex(bytes)
734+
use sha2::{Digest, Sha256};
735+
use std::fmt::Write;
736+
let mut hex = String::with_capacity(64);
737+
for byte in Sha256::digest(bytes) {
738+
let _ = write!(&mut hex, "{byte:02x}");
739+
}
740+
hex
734741
}
735742

736743
/// Bounded line delta between the session context the model last saw and a

0 commit comments

Comments
 (0)