Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

Merge remote-tracking branch 'upstream/main' into codex/issue-3468

lizzjinc605a5ca8c55
diff --cc packages/maker-core/src/agents/pi/index.ts
index 42e34c2f36,30ef1e84a4..725d371e2f
--- a/packages/maker-core/src/agents/pi/index.ts
+++ b/packages/maker-core/src/agents/pi/index.ts
@@@ -5483,10 -5160,8 +5487,11 @@@ export class PiAgent extends BaseAgent
? await readPiUserEntryIds()
: null;
if (!managedPackageRoute.accepted) rejectIfCancelled(sendOpts, 'send');
+ const pendingTurnStartToken = markPiHostTurnStartPending(ctx);
promptRequestStarted = true;
+ const firstModelRequestStartedAt = firstModelRequestLogged ? undefined : Date.now();
+ if (firstModelRequestStartedAt !== undefined) firstModelRequestLogged = true;
+ let firstModelRequestStatus: 'ok' | 'degraded' = 'degraded';
try {
doctorCommandActivity.enter(isDoctorCommand);
const resp = await runExclusivePiRpc(() => proc.request(command, {
@@@ -5497,8 -5172,8 +5502,9 @@@
refreshTimeoutOnEvent: (event) =>
PI_PROMPT_ACCEPTANCE_PROGRESS_EVENTS.has(event.type),
}));
+ firstModelRequestStatus = resp.success ? 'ok' : 'degraded';
if (!resp.success) {
+ rollbackPiHostTurnStart(ctx, pendingTurnStartToken);
if (managedPackageRoute.accepted) {
// The host-owned package mutation and its deterministic visible
// receipt already crossed the dispatch boundary. The follow-up
diff --cc packages/maker-core/src/agents/pi/pi-subagent-runs.ts
index 2c0cd8517e,5e3f88e94b..80b361b422
--- a/packages/maker-core/src/agents/pi/pi-subagent-runs.ts
+++ b/packages/maker-core/src/agents/pi/pi-subagent-runs.ts
@@@ -1022,14 -1024,9 +1024,14 @@@ export function piSubagentRuntimeOwnerI
/** Wall-clock second this process started, in the form the owner id records. */
function ownProcessStartTimeSec(): number {
- return Math.round(Date.now() / 1000 - process.uptime());
+ return OWN_PROCESS_START_TIME_SEC;
}
+/** Process-incarnation stamp shared by other host-owned Pi runtime records. */
+export function piHostProcessStartTimeSec(): number {
+ return ownProcessStartTimeSec();
+}
+
export interface PiSubagentOwnerIdentity {
pid: number;
/** Absent on ids written before the start time was recorded. */