Skip to content

agents: dead-code sweep + shared agent setup form#1484

Merged
jonastemplestein merged 1 commit into
mainfrom
agents-cleanup
Jun 10, 2026
Merged

agents: dead-code sweep + shared agent setup form#1484
jonastemplestein merged 1 commit into
mainfrom
agents-cleanup

Conversation

@jonastemplestein

@jonastemplestein jonastemplestein commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

The last batch of outstanding work from the agents audit (after #1460, #1475, #1483): the section-3 dead-code sweep and the UI shrink. Net −188 lines (−503/+315).

One agent setup form

agents/new.tsx and agents/new-preset.tsx were ~270-line, ~90%-identical forms (provider/model/runOpts/system-prompt/custom-events fields plus the YAML preview pane). They now share one AgentSetupFormPage component; each route keeps only what genuinely differs — its path normalization, its preview builder, and its submit mutation:

<AgentSetupFormPage
  title="New Agent"
  pathLabel="Agent path"
  buildPreview={(values) => buildPreviewEvents({ projectId: project.id, values })}
  submitIdleLabel="Create agent"
  isPending={createAgent.isPending}
  onSubmit={({ preview }) => createAgent.mutate(preview)}
  ...
/>

The routes drop from ~270 lines each to ~125, and the next form tweak happens once instead of twice.

Legacy Slack preset filter deleted

agent-presets.ts carried isLegacyGeneratedSlackOpenAiPreset — a content-sniffing filter that suppressed an old auto-generated /agents/slack preset by matching its system-prompt text. Checked prd before deleting: the iterate project has zero stored presets, so the filter guards nothing. The intentional behavior next to it (Slack agents never inherit the generic /agents preset) stays, with its tests.

Stale migration headers

Every processor under apps/os/src/domains/{agents,slack}/stream-processors/ opened with "Migrated from packages/shared/src/stream-processors/..." — a directory that no longer exists. Those provenance paragraphs are gone. Where they carried a live constraint, the constraint survives in its own words:

// Appended event types, payload shapes, and idempotency-key derivations
// (`agent/<key>@<sourceOffset>`) are stable wire formats — changing them
// breaks dedup against events already committed to streams.

Audit bug status (no code change needed)

  • 2.4 zombie pendingTriggerCount — fixed by construction since streams: subscriber presence facts + reconciler homogenization #1460: the reconcilers guarantee dangling requests reach a terminal event, and a queued count only ever represents real user inputs whose follow-up turn rebuilds from full history.
  • 2.3 cancellation check-then-act race — still a theoretical window; closing it needs conditional appends (append-if-still-current at the stream layer), which is its own design, not a cleanup.

pnpm typecheck && pnpm lint && pnpm format && pnpm test all green.

🤖 Generated with Claude Code


Note

Low Risk
Mostly UI deduplication and comment edits; Slack preset selection is slightly broader if old auto-generated presets exist in storage, which the PR assumes is empty.

Overview
Introduces AgentSetupFormPage so New Agent and New Agent Preset share one form (provider, model, run options, system prompt, custom events YAML, live preview). Each route only keeps path handling, its preview builder, and submit logic—roughly halving page size.

Removes the legacy isLegacyGeneratedSlackOpenAiPreset filter and its test from agent-presets.ts. Slack agents still only match Slack-scoped presets; stored /agents/slack presets are no longer sniffed and ignored by prompt text.

Trims stale “migrated from packages/shared…” headers across agent and Slack stream-processor modules, leaving short notes where wire formats and idempotency keys must stay stable.

Reviewed by Cursor Bugbot for commit c9cf738. Bugbot is set up for automated code reviews on this repo. Configure here.

Environment Config Lease

No active environment config lease.

OS

Status: released
Commit: c9cf738
Preview: https://os.iterate-preview-4.com
Summary: Preview app released.
Workflow run
Updated: 2026-06-10T22:27:04.770Z

Remaining cleanup from the agents audit (tasks/agents-system-audit-and-
reconciler-design.md sections 3 and the UI shrink):

- Extract the ~90%-identical "new agent" / "new preset" forms into one
  AgentSetupFormPage component; the routes keep only their path
  normalization, preview building, and submit mutations.
- Delete the legacy generated-Slack-OpenAI preset filter in
  agent-presets.ts. It guarded against a preset shape that no longer
  exists in prd (the iterate project has zero presets), and we don't
  keep data-backcompat bridges.
- Drop the stale "Migrated from packages/shared/src/stream-processors"
  header comments across all processors — those source files were
  deleted. Where the old text carried a real constraint (event types,
  payloads, and idempotency-key derivations are stable wire formats),
  the constraint stays, stated on its own.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jonastemplestein jonastemplestein merged commit c88aa1c into main Jun 10, 2026
8 checks passed
@jonastemplestein jonastemplestein deleted the agents-cleanup branch June 10, 2026 22:25
jonastemplestein added a commit that referenced this pull request Jun 11, 2026
Post-merge grooming after the agents workstream landed (#1460, #1475,
#1483, #1484). Grooming rules (docs/tasks-grooming.md) say tasks are
deleted when done:

- **Deleted** `tasks/streams-core-processor-host-homogenization.md` —
the plan of record for what shipped in #1460.
- **Deleted** `tasks/agents-system-audit-and-reconciler-design.md` — the
audit knowledge dump; every verified bug and design direction in it is
now either shipped or carried by a live task file.
- **Updated** the two deferred follow-ups
(`streams-core-clock-durable-timers.md`,
`streams-event-kinds-metadata.md`) to drop their `dependsOn`/background
references to the deleted docs, pointing at the merged PRs instead.
- **Added** `tasks/streams-conditional-appends.md` — the one audit
finding that survived everything: the check-then-act window between a
provider's still-current check and its `agent/output-added` append.
Backlog, with the conditional-append direction written down so it isn't
lost with the audit doc.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only changes under `tasks/` with no runtime or API
impact.
> 
> **Overview**
> **Grooms the `tasks/` backlog** after agents/streams work landed in
#1460 and related PRs, per `docs/tasks-grooming.md` (delete tasks when
done).
> 
> **Removes** the shipped plan-of-record
(`streams-core-processor-host-homogenization.md`) and the umbrella
audit/knowledge dump (`agents-system-audit-and-reconciler-design.md`),
since their content is either merged or split elsewhere.
> 
> **Refreshes** deferred follow-ups:
`streams-core-clock-durable-timers.md` and
`streams-event-kinds-metadata.md` drop `dependsOn` on deleted tasks and
cite PR #1460 in background instead of dead links.
> 
> **Adds** `streams-conditional-appends.md` (backlog) to capture the
remaining audit item—the LLM output **check-then-act** race—and the
direction (stream-level conditional append / CAS), so it isn’t lost with
the audit doc.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
d9b9d7f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant