Skip to content

[v0.8 Prompts P01] preserve typed system-prompt provenance - #1177

Open
sethkarten wants to merge 22 commits into
mainfrom
v080/prompts
Open

[v0.8 Prompts P01] preserve typed system-prompt provenance#1177
sethkarten wants to merge 22 commits into
mainfrom
v080/prompts

Conversation

@sethkarten

@sethkarten sethkarten commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Preserve typed system-prompt provenance through resource loading and session rebuilds.
  • Treat an explicitly empty caller prompt as custom instead of falling back to the built-in prompt.
  • Fail closed when prompt provenance is unknown.
  • Keep the new ResourceLoader method optional for existing SDK loaders and export SystemPromptSource from the package root.

Cleanup

  • Merged the current main branch without rewriting published history.
  • Removed unrelated control-loop and clear-prose prompt policy changes.
  • Removed the test-only provenance override, unused diagnostics, duplicate validation, and overlapping copy-based tests.
  • Retained behavioral coverage for loader distinction, root replacement, child creation/reload, and unknown provenance.

Validation

  • npm run check
  • npx tsx ../../node_modules/vitest/dist/cli.js --run test/agent-session-runtime-events.test.ts test/suite/agent-session-runtime.test.ts test/system-prompt.test.ts — 55 passed
  • npx tsx ../../node_modules/vitest/dist/cli.js --run test/resource-loader.test.ts -t "distinguishes an absent system prompt" — 1 passed
  • Independent review approved the final diff.

Note

Preserve typed system prompt provenance to prevent empty custom prompts from falling back to built-in defaults

  • Introduces a SystemPromptSource discriminated union (built_in | custom | unknown) in system-prompt.ts to track where a system prompt originated.
  • Updates buildSystemPrompt to respect provenance: unknown sources return an empty string, custom sources (including empty strings) are used as-is without appending the default prompt.
  • Adds getSystemPromptSource() to the ResourceLoader interface and DefaultResourceLoader so callers can retrieve structured provenance rather than a raw string.
  • Updates AgentSession to prefer getSystemPromptSource() when available, falling back to resolveSystemPromptSourceFromValue() for loaders that don't implement it.
  • Behavioral Change: caller-configured empty system prompts now persist through session rebuilds instead of being replaced by the built-in agent description.

Macroscope summarized b54903c.

samsja and others added 8 commits August 10, 2026 14:33
Add an IPYTHON_CONTROL_PROMPT line instructing the agent to never block the
kernel with time.sleep() loops or long sleeps to await slow external work
(background runs, sandboxes, sub-agents, remote jobs). A blocked cell holds
the turn open, wastes wall-clock, and prevents user interaction. The agent
should kick off the work, record its handle/output location, end the turn,
and check results on a later turn.

Update system-prompt.test.ts exact-match block and add a toContain assertion.
@sethkarten

Copy link
Copy Markdown
Contributor Author

v0.8 stack checkpoint — 2026-08-11 15:50 UTC

This draft PR remains the GitHub Prompts stack surface and will be kept current.

  • Parent Core candidate: 41ef592f8474a1d67b25ee6e495df24be3ab804e (feat(coding-agent): finalize v0.8 Core lifecycle and project MCP hardening #1224), exact CI green.
  • Latest independently reviewed local prompt candidate: 839e06651165255e4802215c69ff7a5a49e082b0 (nine exact prompt/test paths).
  • Active next step: semantic reconstruction of that reviewed tree onto Core 41ef, full prompt/resource/system tests, typecheck, nonwriting Biome, fresh review, then append-only/non-force advancement of this PR branch.

The current remote tip is historical until that verified successor lands; this is not a readiness claim.

@sethkarten sethkarten changed the title [v0.8 Prompts 1/2] add nonblocking and plain-language defaults [v0.8 Prompts P01] preserve typed system-prompt provenance Aug 11, 2026
@sethkarten
sethkarten changed the base branch from main to v080/final-core-main-project-mcp-hardened August 11, 2026 16:58
@macroscopeapp

macroscopeapp Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Macroscope has since reviewed this pull request. An earlier review was skipped by a cost limit; a review has now completed, so that notice no longer applies.

@sethkarten
sethkarten changed the base branch from v080/final-core-main-project-mcp-hardened to main August 11, 2026 18:11
@sethkarten sethkarten closed this Aug 11, 2026
Comment thread packages/coding-agent/src/core/agent-session.ts
@sethkarten sethkarten reopened this Aug 11, 2026
@sethkarten
sethkarten marked this pull request as ready for review August 11, 2026 18:22
@sethkarten
sethkarten requested review from alexzhang13, skirsten and snimu and removed request for skirsten August 11, 2026 18:23

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b54903c. Configure here.

getThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] };
getAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };
getSystemPrompt(): string | undefined;
getSystemPromptSource?(): SystemPromptSource;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provenance migration scaffolding remains

Low Severity

P01 keeps transitional dual APIs after the provenance migration: optional getSystemPromptSource?() with a string-fallback helper, plus retained customPrompt beside systemPromptSource. That staging surface duplicates resolution logic and leaves compatibility vocabulary in the completed P01 change.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: Review rules

Reviewed by Cursor Bugbot for commit b54903c. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants