Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: reject unresolved step references from exotic stepIds (#2773)
[._.]/ Adam Eivy71b555094570
diff --git a/server/services/creativeDirector/planAdvance.js b/server/services/creativeDirector/planAdvance.jsindex 5f387fc5c4..ab72c81c98 100644--- a/server/services/creativeDirector/planAdvance.js+++ b/server/services/creativeDirector/planAdvance.js@@ -205,6 +205,15 @@ export function resolvePlanStepArgs(step, plan) {};const resolvedArgs = resolveValue(args);+ // Belt-and-suspenders: the plan schema permits stepIds the reference grammar+ // (`[\w-]+`) can't parse (a dot, colon, space, or Unicode char). Such a+ // reference matches the sentinel but not STEP_REF_*, so it would survive+ // resolution as a literal and dispatch unresolved. If any `{{steps.…}}` is left+ // after a clean pass, fail the step (→ re-plan) instead — never dispatch a+ // literal placeholder. Skip when errors already fired (they carry the real cause).+ if (!errors.length && STEP_REF_SENTINEL.test(JSON.stringify(resolvedArgs))) {+ errors.push('contains an unresolved step reference — use the form {{steps.<stepId>.result.<key>}} with a word/hyphen stepId');+ }return { args: resolvedArgs, error: errors.length ? `Step "${step?.stepId}" ${errors.join('; ')}` : null };}diff --git a/server/services/creativeDirector/planAdvance.test.js b/server/services/creativeDirector/planAdvance.test.jsindex 939a140c85..19bdf8bed8 100644--- a/server/services/creativeDirector/planAdvance.test.js+++ b/server/services/creativeDirector/planAdvance.test.js@@ -146,6 +146,15 @@ describe('resolvePlanStepArgs (pure) — cross-step result references (#2773)',expect(out.error).toMatch(/not complete/);});+ it('errors (never dispatches a literal) on a reference to an exotic stepId the grammar cannot parse', () => {+ // The plan schema allows a dotted stepId; the reference grammar does not, so+ // the placeholder survives unmatched — the leftover-check must fail the step.+ const plan = { steps: [{ stepId: 'create.series', status: 'done', result: { id: 'ser-1' } }] };+ const out = resolvePlanStepArgs({ stepId: 'run', args: { seriesId: '{{steps.create.series.result.id}}' } }, plan);+ expect(out.error).toMatch(/unresolved step reference/);+ expect(out.args.seriesId).toBe('{{steps.create.series.result.id}}'); // literal, but the error blocks dispatch+ });+it('errors on a missing result key', () => {const plan = donePlan({ name: 'Nova' }); // no `id`const out = resolvePlanStepArgs({ stepId: 'run', args: { seriesId: '{{steps.create-series.result.id}}' } }, plan);