Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ This file intentionally separates:

- `packages/junior/src/chat/slack/assistant-thread/title.ts`

5. Current delivery contract:

- `packages/junior/src/chat/slack/AGENTS.md`

## Audit Checklist

When changing code or guidance in this area, verify all of the following:
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/vercel-sandbox/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ For repo-local debugging in Junior, inspect:
- `packages/junior/src/chat/sandbox/session.ts` (reports each new ref through `onSandboxRefChanged`)
- `packages/junior/src/chat/providers/slack/turn.ts` and `packages/junior/src/chat/task-execution/conversation-turn.ts` (save it to thread state)
5. whether consumer-specific snapshots are being confused with Vercel product persistence:
- `packages/junior/src/chat/sandbox/AGENTS.md`
- `packages/junior/src/chat/sandbox/snapshot/`

## Step 6: Recommend the smallest correct fix

Expand Down
1 change: 0 additions & 1 deletion .agents/skills/vercel-sandbox/SOURCES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Selected profile: `references/examples/documentation-skill.md`
| `packages/junior/src/chat/agent/index.ts` | canonical | high | Turn timeout detection and abort behavior | Repo implementation |
| `packages/junior/src/chat/agent/resume.ts` | canonical | high | Timeout continuation persistence | Repo implementation |
| `packages/junior/src/chat/sandbox/session.ts` | canonical | high | Sandbox create/get/reuse logic, keepalive, and dependency-profile mismatch invalidation | Repo implementation |
| `packages/junior/src/chat/sandbox/AGENTS.md` | canonical | high | Runtime dependency snapshots vs sandbox workspace lifecycle | Sandbox ownership documentation |
| `https://github.com/getsentry/junior/issues/184` | secondary | medium | Concrete motivating failure report for workspace loss between turns | Problem report, not source of truth |

## Decisions
Expand Down
21 changes: 10 additions & 11 deletions .agents/skills/vercel-sandbox/references/api-surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ Do not recommend this path unless the repo has upgraded to the beta SDK and loca

This section is secondary. Use it only when the task is about Junior's Vercel Sandbox integration rather than Vercel Sandbox itself.

| File | Why it matters |
| ------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| `packages/junior/package.json` | Declares the `@vercel/sandbox` dependency used by the repo |
| `packages/junior/src/chat/sandbox/session.ts` | Main sandbox create/get/reuse/keepalive logic |
| `packages/junior/src/chat/runtime/thread-state.ts` | Persists `app_sandbox_id` and dependency profile hash into thread state |
| `packages/junior/src/chat/runtime/turn-preparation.ts` | Restores persisted sandbox metadata at the start of a turn |
| `packages/junior/src/chat/providers/slack/turn.ts` | Saves each new sandbox ref to thread state through `onSandboxRefChanged` |
| `packages/junior/src/chat/agent/index.ts` | Owns turn timeout detection and abort |
| `packages/junior/src/chat/agent/resume.ts` | Persists timeout continuation state |
| `packages/junior/src/chat/app/production.ts` | Wires production timeout and continuation behavior |
| `packages/junior/src/chat/sandbox/AGENTS.md` | Explains that snapshots are used for runtime dependency warmup, not task workspaces |
| File | Why it matters |
| ------------------------------------------------------ | ------------------------------------------------------------------------ |
| `packages/junior/package.json` | Declares the `@vercel/sandbox` dependency used by the repo |
| `packages/junior/src/chat/sandbox/session.ts` | Main sandbox create/get/reuse/keepalive logic |
| `packages/junior/src/chat/runtime/thread-state.ts` | Persists `app_sandbox_id` and dependency profile hash into thread state |
| `packages/junior/src/chat/runtime/turn-preparation.ts` | Restores persisted sandbox metadata at the start of a turn |
| `packages/junior/src/chat/providers/slack/turn.ts` | Saves each new sandbox ref to thread state through `onSandboxRefChanged` |
| `packages/junior/src/chat/agent/index.ts` | Owns turn timeout detection and abort |
| `packages/junior/src/chat/agent/resume.ts` | Persists timeout continuation state |
| `packages/junior/src/chat/app/production.ts` | Wires production timeout and continuation behavior |

## Local implementation facts worth checking in any consumer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Use this reference when the user reports broken behavior or conflicting document
| Need workspaces to survive stop/timeout boundaries | Stable Vercel Sandbox does not provide that durability model | Concepts docs, stable SDK docs, persistent-beta changelog | Externalize outputs, checkpoint work elsewhere, or migrate intentionally to persistent beta |
| App request timed out, but the sandbox may still be running | The embedding system's timeout is shorter than the sandbox timeout | Consumer timeout config, sandbox timeout config, stable docs | Persist sandbox identity separately so the app can reconnect to the active sandbox later |
| Turn fails even though the sandbox timeout is longer | Function or Junior turn timeout fired first | `packages/junior/src/chat/config.ts`, `packages/junior/src/chat/app/production.ts`, `packages/junior/src/chat/agent/index.ts` | Align function timeout, turn timeout, and sandbox timeout; persist sandbox identity before the app can be killed |
| Snapshot warmup exists, but repo edits still vanish between turns | Junior snapshots runtime dependencies, not task state | `packages/junior/src/chat/sandbox/AGENTS.md`, `packages/junior/src/chat/sandbox/snapshot/` | Keep using snapshots for dependency warmup; preserve task state elsewhere |
| Snapshot warmup exists, but repo edits still vanish between turns | Junior snapshots runtime dependencies, not task state | `packages/junior/src/chat/sandbox/snapshot/` | Keep using snapshots for dependency warmup; preserve task state elsewhere |
| Persistent beta docs seem to conflict with stable lifecycle docs | They describe different models and package generations | Installed types, stable docs, beta changelog | State explicitly which model the current environment uses before giving advice |
| Need more than the stable plan runtime ceiling | Plan limit reached even with a longer timeout configured | Pricing/limits docs | Reduce session duration, checkpoint externally, or change plan if appropriate |
| Next turn starts from a clean repo after a timeout in Junior | The consumer app died before `app_sandbox_id` was persisted, even though the sandbox may still have been alive | `packages/junior/src/chat/sandbox/session.ts`, `packages/junior/src/chat/runtime/thread-state.ts`, `packages/junior/src/chat/runtime/turn-preparation.ts` | Check that `onSandboxRefChanged` saves the new ref to thread state right away |
Expand Down
4 changes: 2 additions & 2 deletions .claude/commands/opsx/apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ Working on task 4/7: <task description>
- [x] Task 2
...

All tasks complete! Move any durable explanation into code, tests, policies, or
the owning AGENTS.md, then delete the completed change directory.
All tasks complete! Move any durable explanation into code, code comments,
tests, or policies, then delete the completed change directory.
```

**Output On Pause (Issue Encountered)**
Expand Down
4 changes: 2 additions & 2 deletions .cursor/commands/opsx-apply.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ Working on task 4/7: <task description>
- [x] Task 2
...

All tasks complete! Move any durable explanation into code, tests, policies, or
the owning AGENTS.md, then delete the completed change directory.
All tasks complete! Move any durable explanation into code, code comments,
tests, or policies, then delete the completed change directory.
```

**Output On Pause (Issue Encountered)**
Expand Down
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# CI records these eval fixtures. Collapse them in pull request diffs and
# keep them out of AI review. See "Recordings" in packages/junior-evals/AGENTS.md.
# keep them out of AI review.
packages/junior-evals/recordings/** linguist-generated=true
14 changes: 4 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Agent Instructions

Before you change code in a directory, read each `AGENTS.md` on the path from
the repo root. Read the reference files at the end when your work touches
their area.
Read the reference files at the end when your work touches their area.

## Rules

Expand All @@ -23,7 +21,9 @@ their area.
- Group files by feature. No feature-directory barrels.
- Exported functions get a brief JSDoc that states intent.
- Docs use ASD-STE100 English: common words, active voice, short sentences.
- Change an `AGENTS.md` or `README.md` only when intent, an invariant, or a
- This is the only `AGENTS.md`. Do not add one in a directory. Put intent in
a code comment next to the code that it governs.
- Change this file or a `README.md` only when intent, an invariant, or a
boundary changes. Delete completed plans. Plans in `openspec/changes/`
cannot override policy.

Expand Down Expand Up @@ -82,9 +82,3 @@ Split long files at a feature boundary. Do not compress formatting to pass.
- `policies/frontend-components.md`: dashboard UI ownership and styling.
- `policies/code-comments.md`: when and how to comment.
- `policies/documentation.md`: internal docs.
- `packages/junior/src/chat/AGENTS.md`: chat runtime.
- `packages/junior/tests/AGENTS.md`: test layout and fixtures.
- `packages/junior/migrations/AGENTS.md`: database migrations.
- `packages/junior-evals/AGENTS.md`: evals and recordings.
- `packages/junior-dashboard/AGENTS.md`: dashboard.
- `packages/junior-plugin-api/AGENTS.md`: plugin contracts.
2 changes: 1 addition & 1 deletion ast-grep/rules/no-eval-slack-actions-imports.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-eval-slack-actions-imports
language: TypeScript
severity: error
message: Evals must not import Slack action internals. Send input through @junior-evals/fixture/inputs and assert the replies, tool calls, reactions, or turn states of the returned Conversation. See "Agent Test Fixture" in packages/junior-evals/AGENTS.md.
message: Evals must not import Slack action internals. Send input through @junior-evals/fixture/inputs and assert the replies, tool calls, reactions, or turn states of the returned Conversation.
files:
- packages/junior-evals/evals/**/*.ts
- packages/junior-evals/evals/**/*.tsx
Expand Down
2 changes: 1 addition & 1 deletion ast-grep/rules/no-eval-slack-msw-helpers.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-eval-slack-msw-helpers
language: TypeScript
severity: error
message: Evals must not queue or read Slack API calls through the junior test MSW helpers. Assert the replies, tool calls, reactions, or turn states of the returned Conversation. See "Agent Test Fixture" in packages/junior-evals/AGENTS.md.
message: Evals must not queue or read Slack API calls through the junior test MSW helpers. Assert the replies, tool calls, reactions, or turn states of the returned Conversation.
files:
- packages/junior-evals/evals/**/*.ts
- packages/junior-evals/evals/**/*.tsx
Expand Down
2 changes: 1 addition & 1 deletion ast-grep/rules/no-queue-provider-module-imports.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-queue-provider-module-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/queue/provider.ts may import a queue provider module such as chat/queue/vercel.ts or chat/queue/bullmq.ts. Other code calls getQueueProvider(). See packages/junior/src/chat/queue/AGENTS.md.
message: Only packages/junior/src/chat/queue/provider.ts may import a queue provider module such as chat/queue/vercel.ts or chat/queue/bullmq.ts. Other code calls getQueueProvider().
files:
- packages/junior/src/**/*.ts
- packages/junior/src/**/*.tsx
Expand Down
12 changes: 6 additions & 6 deletions ast-grep/rules/no-sandbox-provider-module-imports.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-sandbox-provider-module-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider().
files:
- packages/junior/src/**/*.ts
- packages/junior/src/**/*.tsx
Expand All @@ -19,7 +19,7 @@ rule:
id: no-sandbox-provider-module-sibling-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider().
files:
- packages/junior/src/chat/sandbox/*.ts
ignores:
Expand All @@ -37,7 +37,7 @@ rule:
id: no-sandbox-provider-module-parent-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/vercel/. Other code calls getSandboxProvider().
files:
- packages/junior/src/chat/sandbox/*/**/*.ts
ignores:
Expand All @@ -54,7 +54,7 @@ rule:
id: no-docker-sandbox-provider-module-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider().
files:
- packages/junior/src/**/*.ts
- packages/junior/src/**/*.tsx
Expand All @@ -72,7 +72,7 @@ rule:
id: no-docker-sandbox-provider-module-sibling-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider().
files:
- packages/junior/src/chat/sandbox/*.ts
ignores:
Expand All @@ -90,7 +90,7 @@ rule:
id: no-docker-sandbox-provider-module-parent-imports
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider(). See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/provider.ts may import a sandbox provider module such as chat/sandbox/docker/. Other code calls getSandboxProvider().
files:
- packages/junior/src/chat/sandbox/*/**/*.ts
ignores:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-vercel-queue-sdk-outside-vercel-module
language: TypeScript
severity: error
message: Only packages/junior/src/chat/queue/vercel.ts may import @vercel/queue. Other code uses the provider-neutral queue functions and types. See packages/junior/src/chat/queue/AGENTS.md.
message: Only packages/junior/src/chat/queue/vercel.ts may import @vercel/queue. Other code uses the provider-neutral queue functions and types.
files:
- packages/junior/src/**/*.ts
- packages/junior/src/**/*.tsx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
id: no-vercel-sandbox-sdk-outside-vercel-module
language: TypeScript
severity: error
message: Only packages/junior/src/chat/sandbox/vercel/ may import @vercel/sandbox. Other code uses the provider-neutral sandbox functions and types. See packages/junior/src/chat/sandbox/AGENTS.md.
message: Only packages/junior/src/chat/sandbox/vercel/ may import @vercel/sandbox. Other code uses the provider-neutral sandbox functions and types.
files:
- packages/junior/src/**/*.ts
- packages/junior/src/**/*.tsx
Expand Down
4 changes: 2 additions & 2 deletions openspec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
current behavior and cannot override `../policies/`.
- Write a plan only when a change crosses many boundaries or needs a rollout
order.
- When the work is done, move lasting rules into code, types, tests, or the
owning `AGENTS.md`. Then delete the plan. Git history is the archive.
- When the work is done, move lasting rules into code, types, tests, code
comments, or policies. Then delete the plan. Git history is the archive.
2 changes: 1 addition & 1 deletion openspec/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema: spec-driven

# OpenSpec artifacts are temporary implementation plans. Current behavior is
# documented by code, policies, tests, and owning module/package AGENTS.md files.
# documented by code, code comments, policies, and tests.

# Project context (optional)
# This is shown to AI when creating artifacts.
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/content/docs/contribute/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ docker network prune -f --filter label=dev.junior.sandbox
docker image prune -a -f --filter label=dev.junior.sandbox=snapshot
```

The limits of this provider are in `packages/junior/src/chat/sandbox/AGENTS.md`.
This provider is for local development and QA only. Do not run untrusted workloads with it.

## Work in isolated branches

Expand Down
Loading
Loading