Skip to content

Improvement on debug logs #409

Description

@ijpq

Two things I think you need to add into logs.

  1. if turn in flight flag is true, logs are supposed to record this, since it's valuable for debugging, especially when debug mode on (if codeg has)

    if s.turn_in_flight {
    return Err(AcpError::TurnInProgress);
    }

  2. read updates until turn complete.

loop {
tokio::select! {
update = session.read_update() => {
let update = match update {
Ok(u) => u,
Err(e) => {
// Silent-drop site #1 (transport/decode).
// Record it: an agent whose output we
// couldn't decode looks identical to one
// that said nothing, and the two need
// completely different fixes.
probe.note_dropped(DropSite::Decode, &e);
tracing::warn!("[ACP] Ignoring unrecognized session update: {e}");
continue;
}
};
match update {

while reading updates, there is a fallback if any condition doesn't match. but it failed to tell user what's going on. and then logs didn't reveal anything. i think this should be recored.

for example, if user send another msg while turn didn't finish , log should record this behavior at least.

code might be:

Some(ConnectionCommand::Prompt { .. }) => {
    tracing::warn!("[ACP] in-turn Prompt DROPPED (a turn is still running)");
}

what's your opinion? if this two problems is meaningful , i'd like to PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions