fix: address PR review comments on stage 5 rollout (#119)
This commit is contained in:
parent
690242e379
commit
d3cf4ae3de
|
|
@ -224,11 +224,13 @@ function buildTransitionObservabilityData(
|
|||
newStatus: SessionStatus,
|
||||
evidence: string,
|
||||
detectingAttempts: number,
|
||||
statusTransition: boolean,
|
||||
reaction?: { key: string; result: ReactionResult | null },
|
||||
): Record<string, unknown> {
|
||||
return {
|
||||
oldStatus,
|
||||
newStatus,
|
||||
statusTransition,
|
||||
previousSessionState: previous.session.state,
|
||||
newSessionState: next.session.state,
|
||||
previousSessionReason: previous.session.reason,
|
||||
|
|
@ -1583,6 +1585,7 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan
|
|||
newStatus,
|
||||
assessment.evidence,
|
||||
assessment.detectingAttempts,
|
||||
true,
|
||||
),
|
||||
level: transitionLogLevel(newStatus),
|
||||
});
|
||||
|
|
@ -1635,6 +1638,7 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan
|
|||
newStatus,
|
||||
assessment.evidence,
|
||||
assessment.detectingAttempts,
|
||||
true,
|
||||
transitionReaction,
|
||||
),
|
||||
level: reactionResult.success ? "info" : "warn",
|
||||
|
|
@ -1669,7 +1673,7 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan
|
|||
updateSessionMetadata(session, { status: newStatus });
|
||||
observer.recordOperation({
|
||||
metric: "lifecycle_poll",
|
||||
operation: "lifecycle.transition",
|
||||
operation: "lifecycle.sync",
|
||||
outcome: "success",
|
||||
correlationId: createCorrelationId("lifecycle-sync"),
|
||||
projectId: session.projectId,
|
||||
|
|
@ -1682,6 +1686,7 @@ export function createLifecycleManager(deps: LifecycleManagerDeps): LifecycleMan
|
|||
newStatus,
|
||||
assessment.evidence,
|
||||
assessment.detectingAttempts,
|
||||
false,
|
||||
),
|
||||
level: transitionLogLevel(newStatus),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ import {
|
|||
getRuntimeTruthReasonLabel,
|
||||
getLifecycleGuidance,
|
||||
getLifecycleEvidence,
|
||||
isDashboardSessionTerminal,
|
||||
isDashboardRuntimeEnded,
|
||||
isDashboardSessionRestorable,
|
||||
} from "@/lib/types";
|
||||
import { CI_STATUS } from "@aoagents/ao-core/types";
|
||||
import { cn } from "@/lib/cn";
|
||||
|
|
@ -546,8 +547,11 @@ export function SessionDetail({
|
|||
const [sidebarCollapsed, setSidebarCollapsed] = useState(false);
|
||||
const [showTerminal, setShowTerminal] = useState(false);
|
||||
const pr = session.pr;
|
||||
const terminalEnded = isDashboardSessionTerminal(session);
|
||||
const isRestorable = terminalEnded && !NON_RESTORABLE_STATUSES.has(session.status);
|
||||
const terminalEnded = isDashboardRuntimeEnded(session);
|
||||
const isRestorable =
|
||||
!isOrchestrator &&
|
||||
isDashboardSessionRestorable(session) &&
|
||||
!NON_RESTORABLE_STATUSES.has(session.status);
|
||||
const activity = (session.activity && activityMeta[session.activity]) ?? {
|
||||
label: session.activity ?? "unknown",
|
||||
color: "var(--color-text-muted)",
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ import {
|
|||
type OrchestratorConfig,
|
||||
type PluginRegistry,
|
||||
} from "@aoagents/ao-core";
|
||||
import type {
|
||||
DashboardSession,
|
||||
DashboardPR,
|
||||
DashboardStats,
|
||||
DashboardOrchestratorLink,
|
||||
import {
|
||||
type DashboardSession,
|
||||
type DashboardPR,
|
||||
type DashboardStats,
|
||||
type DashboardOrchestratorLink,
|
||||
getAttentionLevel,
|
||||
} from "./types.js";
|
||||
import { getAttentionLevel } from "@/lib/types";
|
||||
import { TTLCache, prCache, prCacheKey, type PREnrichmentData } from "./cache";
|
||||
|
||||
/** Cache for issue titles (5 min TTL — issue titles rarely change) */
|
||||
|
|
|
|||
|
|
@ -316,6 +316,18 @@ export function isDashboardSessionTerminal(session: DashboardSession): boolean {
|
|||
);
|
||||
}
|
||||
|
||||
export function isDashboardRuntimeEnded(session: DashboardSession): boolean {
|
||||
if (session.lifecycle) {
|
||||
return (
|
||||
session.lifecycle.runtimeState === "missing" || session.lifecycle.runtimeState === "exited"
|
||||
);
|
||||
}
|
||||
return (
|
||||
TERMINAL_STATUSES.has(session.status) ||
|
||||
(session.activity !== null && TERMINAL_ACTIVITIES.has(session.activity))
|
||||
);
|
||||
}
|
||||
|
||||
export function isDashboardSessionRestorable(session: DashboardSession): boolean {
|
||||
if (!isDashboardSessionTerminal(session)) return false;
|
||||
return session.lifecycle?.prState !== "merged" && session.status !== "merged";
|
||||
|
|
|
|||
Loading…
Reference in New Issue