Skip to content

Commit bbebd0d

Browse files
committed
Disable TUI turn-end weak-point digest
1 parent 274a80d commit bbebd0d

2 files changed

Lines changed: 26 additions & 84 deletions

File tree

‎crates/jcode-tui/src/tui/app/input.rs‎

Lines changed: 8 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,53 +1578,15 @@ impl App {
15781578
|| self.schedule_overnight_poke_followup_if_needed()
15791579
}
15801580

1581-
/// Deliver this turn's deferred quality-check reminder, if anything is
1582-
/// still unresolved. Returns true when a continuation was queued.
1583-
///
1584-
/// Delivered at most once per turn: the reminder asks the model to verify
1585-
/// weak points, and re-asking after it has done so would loop. The
1586-
/// observation log is cleared either way, so the next turn starts clean.
1587-
fn deliver_deferred_gate_digest_if_needed(&mut self) -> bool {
1588-
if self.todo_gate_digest_delivered {
1589-
return false;
1590-
}
1591-
// In a remote client `self.session` is the local wrapper session, while
1592-
// todo tools execute against the remote session. Reading the wrapper's
1593-
// files makes every persisted remote assessment appear to be missing.
1594-
let session_id = self
1581+
pub(super) fn schedule_auto_poke_followup_if_needed(&mut self) -> bool {
1582+
// Aggregated weak-point digests are disabled. Discard legacy observations
1583+
// without queuing a continuation or notice, including for remote sessions.
1584+
let observation_session_id = self
15951585
.remote_session_id
15961586
.as_deref()
1597-
.unwrap_or_else(|| self.session_id())
1598-
.to_string();
1599-
let observations = crate::todo::load_gate_observations(&session_id).unwrap_or_default();
1600-
if observations.is_empty() {
1601-
return false;
1602-
}
1603-
let plan = crate::todo::load_plan(&session_id).unwrap_or_default();
1604-
let goals = crate::todo::load_goals(&session_id).unwrap_or_default();
1605-
let digest = crate::todo::build_gate_digest(&observations, &plan, &goals);
1606-
let _ = crate::todo::clear_gate_observations(&session_id);
1607-
let Some(digest) = digest else {
1608-
crate::logging::info(&format!(
1609-
"TODO_GATE_DIGEST action=skip reason=nothing_to_report observations={}",
1610-
observations.len()
1611-
));
1612-
return false;
1613-
};
1614-
self.todo_gate_digest_delivered = true;
1615-
crate::logging::info(&format!(
1616-
"TODO_GATE_DIGEST action=queue observations={}",
1617-
observations.len()
1618-
));
1619-
self.push_display_message(DisplayMessage::system(
1620-
"🔎 We asked the agent to double-check this turn's weak points.",
1621-
));
1622-
self.queued_messages.push(digest);
1623-
self.pending_queued_dispatch = true;
1624-
true
1625-
}
1587+
.unwrap_or_else(|| self.session_id());
1588+
let _ = crate::todo::clear_gate_observations(observation_session_id);
16261589

1627-
pub(super) fn schedule_auto_poke_followup_if_needed(&mut self) -> bool {
16281590
// The completion-gate circuit breaker clears auto_poke_incomplete_todos,
16291591
// and it can only trip while every todo is complete, so the restore in
16301592
// the all-complete branch never runs for an agent that adds open work
@@ -1658,8 +1620,8 @@ impl App {
16581620
serde_json::to_string(&(&todo_session_id, &todos, &plan, &goals)).ok();
16591621
if self.final_response_todo_fingerprint.is_some() {
16601622
if self.final_response_todo_fingerprint == todo_fingerprint {
1661-
// Check before timed reviews and deferred digests too: neither
1662-
// elapsed time nor a stale observation starts a new todo cycle.
1623+
// Check before timed reviews too: elapsed time alone does not
1624+
// start a new todo cycle.
16631625
return false;
16641626
}
16651627
self.final_response_todo_fingerprint = None;
@@ -1702,14 +1664,6 @@ impl App {
17021664
self.last_todo_ownership_fingerprint = None;
17031665
return false;
17041666
}
1705-
// Deferred quality checks land here, once, instead of interrupting
1706-
// every todo write during the turn. Every point recorded during the
1707-
// turn is raised, including ones whose score later climbed: work
1708-
// done while the score was low never benefited from the assessment
1709-
// that arrived after it.
1710-
if self.deliver_deferred_gate_digest_if_needed() {
1711-
return true;
1712-
}
17131667
let ownership_needs_followup =
17141668
!crate::todo::completed_groups_have_sufficient_delivery(&todos, &goals);
17151669
let gate_budget_left =

‎crates/jcode-tui/src/tui/app/tests/remote_events_reload_05.rs‎

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -863,17 +863,16 @@ fn test_repeated_guardrail_refusals_stop_auto_poke_loop() {
863863
});
864864
}
865865

866-
/// The deferred quality review must fire at turn end, and must re-arm when the
867-
/// auto-poke cycle finishes. Without the re-arm a session could only ever
868-
/// deliver one digest, so later work would silently lose the review.
866+
/// Legacy gate observations must never queue a digest or weak-point notice.
867+
/// Normal completion still requests a final response and ends the poke cycle.
869868
#[test]
870-
fn test_gate_digest_is_delivered_at_turn_end_and_rearms_next_cycle() {
869+
fn test_gate_digest_is_disabled_at_turn_end() {
871870
with_temp_jcode_home(|| {
872871
let mut app = create_test_app();
873872
app.auto_poke_incomplete_todos = true;
874873

875-
// Completed work with validated confidence, so the completion gate is
876-
// satisfied and the digest is the only thing left to say.
874+
// Completed work with validated confidence satisfies the completion gate.
875+
// A stale observation must not delay the normal final-response handoff.
877876
crate::todo::save_todos(
878877
&app.session.id,
879878
&[crate::todo::TodoItem {
@@ -923,40 +922,29 @@ fn test_gate_digest_is_delivered_at_turn_end_and_rearms_next_cycle() {
923922

924923
assert!(
925924
app.schedule_auto_poke_followup_if_needed(),
926-
"an unresolved review point should schedule the digest"
925+
"normal completion should still request the final response"
927926
);
928-
let digest = app
929-
.queued_messages
930-
.last()
931-
.expect("digest should be queued")
932-
.clone();
933-
assert!(digest.starts_with(crate::todo::TODO_GATE_DIGEST_PREFIX));
934-
assert!(app.todo_gate_digest_delivered);
935-
// Consumed, so the same points cannot be raised twice.
927+
assert_eq!(
928+
app.queued_messages,
929+
vec![crate::todo::TODO_FINAL_RESPONSE_CONTINUATION_MESSAGE.to_string()]
930+
);
931+
assert!(!app.todo_gate_digest_delivered);
932+
assert!(app.display_messages().iter().all(|message| {
933+
!message.content.contains("double-check this turn's weak points")
934+
}));
935+
// Discarded without delivering a review.
936936
assert!(
937937
crate::todo::load_gate_observations(&app.session.id)
938938
.expect("reload")
939939
.is_empty()
940940
);
941941

942-
// Simulate the turn running, then the cycle completing.
943-
app.queued_messages.clear();
944-
app.pending_queued_dispatch = false;
945-
assert!(
946-
app.schedule_auto_poke_followup_if_needed(),
947-
"with nothing left outstanding the final response should be requested"
948-
);
949-
assert_eq!(
950-
app.queued_messages,
951-
vec![crate::todo::TODO_FINAL_RESPONSE_CONTINUATION_MESSAGE.to_string()]
952-
);
942+
// Simulate the final-response turn completing. No extra turn is queued.
953943
app.queued_messages.clear();
954944
app.pending_queued_dispatch = false;
955945
assert!(!app.schedule_auto_poke_followup_if_needed());
956-
assert!(
957-
!app.todo_gate_digest_delivered,
958-
"a finished cycle must re-arm the review for later work"
959-
);
946+
assert!(app.queued_messages.is_empty());
947+
assert!(!app.todo_gate_digest_delivered);
960948
});
961949
}
962950

0 commit comments

Comments
 (0)