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

Show long prompt additions whole instead of cutting them at 20,000 characters

Claude4932da615121
diff --git a/server/lib/modelInput.js b/server/lib/modelInput.js
index 81c8bbb86b..c1c1a0cad1 100644
--- a/server/lib/modelInput.js
+++ b/server/lib/modelInput.js
@@ -11,12 +11,15 @@ import { z } from 'zod';
* the fact even when nothing showed it before the send (autopilot, batch).
*/
-const ADDITION_TEXT_MAX = 20000;
+// A request-size guard for additions a client sends back, not a display cap: a chip
+// always holds its block whole (a long production bible included), so the server
+// never cuts one and only refuses a request too large to be a real addition.
+const ADDITION_TEXT_MAX = 1_000_000;
/** One labeled block PortOS adds to a model's input, or null when it adds nothing. */
export function promptAddition(id, label, text) {
const trimmed = typeof text === 'string' ? text.trim() : '';
- return trimmed ? { id, label, text: trimmed.slice(0, ADDITION_TEXT_MAX) } : null;
+ return trimmed ? { id, label, text: trimmed } : null;
}
/** The additions a request already carries (from the composer that built it). */
diff --git a/server/lib/modelInput.test.js b/server/lib/modelInput.test.js
index 1f3a5f72f5..2b1545413a 100644
--- a/server/lib/modelInput.test.js
+++ b/server/lib/modelInput.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
-import { agentInstructionsAddition, promptAdditionsSchema, sentPromptRecord } from './modelInput.js';
+import { agentInstructionsAddition, promptAddition, promptAdditionsSchema, sentPromptRecord } from './modelInput.js';
describe('promptAdditionsSchema', () => {
// A multipart image request (an uploaded reference) carries the list as one JSON string.
@@ -16,6 +16,16 @@ describe('promptAdditionsSchema', () => {
});
});
+describe('promptAddition', () => {
+ // #11317: a chip used to stop at 20,000 characters, so a long bible showed cut off.
+ it('keeps a long block whole and round-trips it through the request schema', () => {
+ const text = 'b'.repeat(50000);
+ const addition = promptAddition('bible', 'Production bible', text);
+ expect(addition.text).toHaveLength(50000);
+ expect(promptAdditionsSchema.parse([addition])[0].text).toHaveLength(50000);
+ });
+});
+
describe('sentPromptRecord', () => {
it('keeps carried additions ahead of the backend ones and drops empty ones', () => {
const carried = [{ id: 'style', label: 'Style preset', text: 'film grain' }];