sf snapshot: uncommitted changes after 30m inactivity
This commit is contained in:
parent
da0c41d375
commit
4442400d11
1 changed files with 39 additions and 4 deletions
|
|
@ -1344,10 +1344,45 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt, options) {
|
|||
prompt,
|
||||
promptCacheSplit,
|
||||
);
|
||||
await pi.sendMessage(
|
||||
{ customType: "sf-auto", content: messageContent, display: s.verbose },
|
||||
{ triggerTurn: true },
|
||||
);
|
||||
// #sf-mp8d3hfc-0rccrj: pi.sendMessage was previously awaited bare. If it
|
||||
// threw, the error propagated but with no contextual marker about which
|
||||
// stage failed (model selection / RPC bridge / agent receive). If it
|
||||
// resolved but the RPC child never processed the message, the unit froze
|
||||
// at iteration 1 with no user message in the session JSONL and no
|
||||
// diagnostic trail. Wrap both sides for visibility.
|
||||
const sendStartedAt = Date.now();
|
||||
debugLog("runUnit", {
|
||||
phase: "send-message-start",
|
||||
unitType,
|
||||
unitId,
|
||||
messageContentLength:
|
||||
typeof messageContent === "string"
|
||||
? messageContent.length
|
||||
: JSON.stringify(messageContent).length,
|
||||
});
|
||||
try {
|
||||
await pi.sendMessage(
|
||||
{ customType: "sf-auto", content: messageContent, display: s.verbose },
|
||||
{ triggerTurn: true },
|
||||
);
|
||||
} catch (e) {
|
||||
debugLog("runUnit", {
|
||||
phase: "send-message-failed",
|
||||
unitType,
|
||||
unitId,
|
||||
error: e && typeof e === "object" && "message" in e ? e.message : String(e),
|
||||
stack:
|
||||
e && typeof e === "object" && "stack" in e ? String(e.stack) : undefined,
|
||||
elapsedMs: Date.now() - sendStartedAt,
|
||||
});
|
||||
throw e;
|
||||
}
|
||||
debugLog("runUnit", {
|
||||
phase: "send-message-accepted",
|
||||
unitType,
|
||||
unitId,
|
||||
elapsedMs: Date.now() - sendStartedAt,
|
||||
});
|
||||
} finally {
|
||||
if (savedTools) {
|
||||
pi.setActiveTools(savedTools);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue