Preserve source trace for laned build-order strings

This commit is contained in:
OpenClaw Bot
2026-05-27 00:58:30 +02:00
parent 1f8739444c
commit b8c518f7cb
3 changed files with 10 additions and 4 deletions
+5 -3
View File
@@ -674,7 +674,8 @@ function nonGoalConflicts(optionText, decisionContext = {}) {
}
function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSourceSection = '', defaultRecommendedLane = '') {
const raw = typeof item === 'string' || typeof item === 'number' ? { action: String(item) } : objectFrom(item);
const rawValue = typeof item === 'string' || typeof item === 'number' ? String(item) : '';
const raw = rawValue ? { action: rawValue } : objectFrom(item);
const title = cleanText(raw.title || raw.name || raw.action || raw.move || raw.experiment || raw.testName || raw.hypothesis || raw.label || '', 140);
const proofSteps = cleanTextList(raw.proofSteps || raw.proof || raw.validationSteps || raw.steps || raw.method, 5, 180);
const dependencies = cleanTextList(raw.dependencies || raw.blockedBy, 5, 120);
@@ -687,9 +688,10 @@ function normalizeFeatureOption(item, index, fallbackId = 'feature', defaultSour
const rawLane = cleanText(raw.lane || '', 40);
const laneLooksLikeHint = Boolean(normalizeLaneHint(rawLane));
const sourceSection = cleanText(raw.sourceSection || raw.section || raw.origin || (!laneLooksLikeHint ? rawLane : '') || defaultSourceSection, 80);
const sourceId = cleanText(raw.sourceId || raw.sourceArtifactId || raw.sourceItemId || raw.traceId || raw.id || '', 120);
const explicitSourceId = cleanText(raw.sourceId || raw.sourceArtifactId || raw.sourceItemId || raw.traceId || '', 120);
const sourceId = explicitSourceId || cleanText(raw.id || (sourceSection ? `${sourceSection}#${index + 1}` : ''), 120);
const sourceTitle = cleanText(raw.sourceTitle || raw.sourceHeading || raw.lensTitle || raw.heading || '', 140);
const sourceQuote = cleanMultiline(raw.sourceQuote || raw.sourceExcerpt || raw.evidenceQuote || raw.quote || raw.originalText || raw.rawText || '', 420);
const sourceQuote = cleanMultiline(raw.sourceQuote || raw.sourceExcerpt || raw.evidenceQuote || raw.quote || raw.originalText || raw.rawText || rawValue, 420);
const recommendedLane = cleanText(raw.recommendedLane || raw.laneHint || raw.suggestedLane || (laneLooksLikeHint ? rawLane : '') || defaultRecommendedLane || '', 40).toLowerCase();
const descriptionParts = [
raw.description || raw.brief || (raw.hypothesis && raw.hypothesis !== title ? `Hypothesis: ${raw.hypothesis}` : ''),