Skip to content

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

feat: Story Builder 'Lock & continue' auto-advances to the next step

Adam Eivy88e7d11d3433
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index 4015fbbb38..fdcc768e25 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -650,7 +650,17 @@ function StoryBuilderDetail({ storyId, stepParam }) {
const lock = useLockToggle({
patchFn: (next) => (next ? lockStoryStep(storyId, activeStepId, { silent: true }) : unlockStoryStep(storyId, activeStepId, { silent: true })),
- onSuccess: () => reload(),
+ onSuccess: (_updated, next) => {
+ reload();
+ // "Lock & continue" should actually continue — on a successful LOCK,
+ // auto-advance to the next step (the just-locked step makes it reachable;
+ // the server re-gates the pointer move). Unlocking stays put.
+ if (next && activeIdx >= 0 && activeIdx < stepIds.length - 1) {
+ const nextId = stepIds[activeIdx + 1];
+ setStoryCurrentStep(storyId, nextId, { silent: true }).catch(() => {});
+ navigate(`/story-builder/${storyId}/${nextId}`);
+ }
+ },
lockedMessage: `${activeStep?.label || 'Step'} locked`,
unlockedMessage: `${activeStep?.label || 'Step'} unlocked`,
errorMessage: 'Failed to update lock',
diff --git a/client/src/pages/StoryBuilder.test.jsx b/client/src/pages/StoryBuilder.test.jsx
index 2817a0775a..37fd7ee252 100644
--- a/client/src/pages/StoryBuilder.test.jsx
+++ b/client/src/pages/StoryBuilder.test.jsx
@@ -183,6 +183,20 @@ describe('StoryBuilder — detail stepper', () => {
expect(next.disabled).toBe(true);
});
+ it('"Lock & continue" locks the step AND auto-advances to the next', async () => {
+ const { fireEvent } = await import('@testing-library/react');
+ api.getStorySession.mockResolvedValue({
+ id: 'stb-1', title: 'Salt Run', currentStep: 'idea', seedIdea: 'seed',
+ universeId: 'u1', seriesId: 's1', steps: mkSteps(), staleSteps: [], llm: { provider: '', model: '' },
+ });
+ renderAt('/story-builder/stb-1/idea');
+ await waitFor(() => expect(screen.getByRole('heading', { name: 'Idea' })).toBeTruthy());
+ fireEvent.click(screen.getByText('Lock & continue'));
+ await waitFor(() => expect(api.lockStoryStep).toHaveBeenCalledWith('stb-1', 'idea', expect.anything()));
+ // …then advances the current-step pointer to the next step (universeAesthetic).
+ await waitFor(() => expect(api.setStoryCurrentStep).toHaveBeenCalledWith('stb-1', 'universeAesthetic', expect.anything()));
+ });
+
it('persists the provider/model picker choice to session.llm', async () => {
const { fireEvent } = await import('@testing-library/react');
api.getStorySession.mockResolvedValue({