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

address review (codex): refetch after generate so the client honors the per-issue cap

[._.]/ Adam Eivyf36dd8b143a6
diff --git a/client/src/components/pipeline/stages/PovRewritePanel.jsx b/client/src/components/pipeline/stages/PovRewritePanel.jsx
index c78ac4557a..8edea377b5 100644
--- a/client/src/components/pipeline/stages/PovRewritePanel.jsx
+++ b/client/src/components/pipeline/stages/PovRewritePanel.jsx
@@ -202,8 +202,14 @@ export default function PovRewritePanel({ issue, series }) {
const handleGenerate = async () => {
const result = await runGenerate();
if (!result?.rewrite) return;
- setData((prev) => ({ ...prev, rewrites: [result.rewrite, ...(prev?.rewrites || [])] }));
toast.success(`Rewrote in ${result.rewrite.povCharacterName}'s POV`);
+ // Refetch rather than optimistically prepend — the server caps stored
+ // rewrites per issue, so a blind prepend could show a row the server just
+ // pruned (which would then refuse to delete). The refetch also carries the
+ // authoritative stale flags. Generate doesn't touch issue.stages, so the
+ // source-change effect won't fire on its own.
+ const res = await getPipelinePerspectiveRewrites(issue.id, { silent: true }).catch(() => null);
+ if (res) setData(res);
};
const handleDelete = (rewriteId) =>
diff --git a/client/src/components/pipeline/stages/PovRewritePanel.test.jsx b/client/src/components/pipeline/stages/PovRewritePanel.test.jsx
index 340c72e8e7..34d9451c88 100644
--- a/client/src/components/pipeline/stages/PovRewritePanel.test.jsx
+++ b/client/src/components/pipeline/stages/PovRewritePanel.test.jsx
@@ -50,11 +50,12 @@ beforeEach(() => {
describe('PovRewritePanel', () => {
it('loads cast + rewrites and generates a new POV rewrite', async () => {
- getPipelinePerspectiveRewrites.mockResolvedValue({
- cast: [{ id: 'char-ada', name: 'Ada', role: 'protagonist' }, { id: 'char-bly', name: 'Bly', role: 'rival' }],
- rewrites: [],
- hasContent: true,
- });
+ const cast = [{ id: 'char-ada', name: 'Ada', role: 'protagonist' }, { id: 'char-bly', name: 'Bly', role: 'rival' }];
+ // Initial load: empty. After generate, the panel refetches (server-
+ // authoritative, capped) — return the new rewrite on subsequent calls.
+ getPipelinePerspectiveRewrites
+ .mockResolvedValueOnce({ cast, rewrites: [], hasContent: true })
+ .mockResolvedValue({ cast, rewrites: [REWRITE], hasContent: true });
createPipelinePerspectiveRewrite.mockResolvedValue({ status: 'complete', rewrite: REWRITE });
render(<PovRewritePanel issue={ISSUE} series={{}} />);
@@ -68,7 +69,7 @@ describe('PovRewritePanel', () => {
'iss-1',
expect.objectContaining({ povCharacterId: 'char-ada' }),
));
- // newly generated rewrite appears
+ // newly generated rewrite appears via the post-generate refetch
await waitFor(() => expect(screen.getByText('Ada')).toBeInTheDocument());
});