integration: batch 2 — priority drafts (#1824 #1779 #1770 #1769 #1678) - #1839
Merged
Conversation
…uided-gh57hs # Conflicts: # apps/api/src/routes/agent-credential-setup-sessions.ts
…mcp-tool-4wb8at # Conflicts: # apps/api/src/routes/triggers/crud.ts
…nshot-tell-t4p94s # Conflicts: # apps/api/src/routes/mcp/_helpers.ts # apps/api/src/services/diagnostic-incidents.ts # apps/api/tests/unit/routes/mcp-orchestration-comms.test.ts # apps/web/src/components/project-message-view/index.tsx # apps/web/src/lib/chat-session-utils.ts # apps/web/tests/unit/lib/chat-session-utils.test.ts # packages/vm-agent/internal/acp/session_host.go # packages/vm-agent/internal/acp/session_host_prompt.go # packages/vm-agent/internal/acp/session_host_prompt_state.go
Contributor
|
Contributor
Author
Staging Verification Evidence (orchestrator gate — 2026-08-16)Staging deploy run 31970325007 succeeded 20:38Z for exact head 680c526. Two-part independent Staging Validator (SAM tasks 01M064S8K7C13GRHCJJ13EJ6E7 + continuation 01M067KN6ETKM8RYBFWP6PG7A6 after the first validator's production runtime was externally deleted mid-run — see idea 01M069W82V937G67WGG1E93937). Verdict: PASS — safe to merge.
Environment notes (non-blocking): staging opencode provider at $30/month spending cap (billing, unrelated); first validator killed by the production workspace-reaping issue tracked in idea 01M069W82V937G67WGG1E93937. |
31 tasks
simple-agent-manager Bot
pushed a commit
that referenced
this pull request
Aug 16, 2026
…he remaining writer The task-completion-validator caught that recordTurnEnd's doc comment claimed to be "the single write path for every turn ending". That is not true: reconciliation.ts:cancelStalledPrompt (task-mode 409 stale-mirror repair) still writes idle via upsertActivityState plus a manual broadcast, so it records no provenance and skips both the delivery nudge and the idle re-arm that rule 57 requires of a terminal transition. That is pre-existing behaviour, not a regression from this change, and migrating it alters task-mode reconciliation semantics in a path PR #1839 just modified -- so it needs its own regression coverage rather than an unproven inline refactor at the staging gate. Deferred per rule 42 with a tracked backlog task referenced from BOTH ends: the recordTurnEnd doc comment and the bypassing writer itself. Also adds the rule-42 code reference for the deliberate activity='error' exclusion, and a Timeline subsection to the post-mortem (rule 02 template). Co-Authored-By: Claude <noreply@anthropic.com>
simple-agent-manager Bot
added a commit
that referenced
this pull request
Aug 16, 2026
… staleness bound (#1840) * task: add session activity state machine * task: activate session activity state machine * feat(api): reconciled session activity state machine with probe-backed staleness bound * test: update DO index count for migration 029 * docs(rules): add rule 57 — reconcile write-only cross-boundary state * docs(task): add post-mortem * fix(api): fail closed on ambiguous workspace tenancy in the activity probe * fix(api): address reviewer findings — rolling progress guard, probe lease, working-branch CAS, malformed-response handling, probe alarm scheduling * fix(api): honour the probe lease in alarm scheduling and CAS the unreachable attempts bump Round-2 specialist review (re-run against the final tree after the original agent's workspace was destroyed) found two defects the first round missed. [HIGH] computeSessionActivityProbeAlarmTime scanned only MIN(activity_at) and never activity_probe_at, so a claimed-but-unresolved candidate reported as due 'now' on every tick. The SELECT correctly returned nothing (the lease held) but the alarm had already re-armed, busy-looping the ENTIRE ProjectData alarm handler for the whole reconciliation episode with no log signal. Now scans MIN(MAX(activity_at + threshold, COALESCE(activity_probe_at,0) + leaseMs)) and floors on the existing minReconciliationAlarmDelayMs knob, matching the clamp computeReconciliationAlarmTime already used (.claude/rules/47). [MEDIUM] The unreachable attempts bump was the module's only write path without a compare-and-set, letting a stale probe outcome charge an attempt against a newer prompt epoch and silently shrink its retry budget. Now scoped with the same working-state + activity_at <= observedAt guard as the other branches. [LOW] chat.ts cancel-failure log now uses serializeError(err) instead of a raw err.message, matching the codebase's sanitization convention. Both regression tests verified discriminating: each fails on the pre-fix code. Co-Authored-By: Claude <noreply@anthropic.com> * docs(api): correct the overstated single-write-path claim and track the remaining writer The task-completion-validator caught that recordTurnEnd's doc comment claimed to be "the single write path for every turn ending". That is not true: reconciliation.ts:cancelStalledPrompt (task-mode 409 stale-mirror repair) still writes idle via upsertActivityState plus a manual broadcast, so it records no provenance and skips both the delivery nudge and the idle re-arm that rule 57 requires of a terminal transition. That is pre-existing behaviour, not a regression from this change, and migrating it alters task-mode reconciliation semantics in a path PR #1839 just modified -- so it needs its own regression coverage rather than an unproven inline refactor at the staging gate. Deferred per rule 42 with a tracked backlog task referenced from BOTH ends: the recordTurnEnd doc comment and the bypassing writer itself. Also adds the rule-42 code reference for the deliberate activity='error' exclusion, and a Timeline subsection to the post-mortem (rule 02 template). Co-Authored-By: Claude <noreply@anthropic.com> * fix(api): satisfy AST sql-injection allowlist and split the cancel route out of chat.ts Two CI Code Quality failures, both introduced by this branch: 1. quality:ast-checks flagged the new CAS UPDATE's `${attemptPlaceholders}` interpolation. scripts/quality/ast-checks.ts allowlists a fixed set of identifiers for `.map(() => '?').join(', ')` IN-clause expansion, and `placeholders` is the sanctioned name. This is the same safe expansion over a compile-time const array used elsewhere in the file, so it is renamed (with a comment recording why the name matters) rather than suppressed. 2. quality:file-sizes: the cancel handler pushed apps/api/src/routes/chat.ts from 782 to 805 lines, past the 800-line hard limit in rule 18. Extracted the handler into apps/api/src/routes/chat-cancel.ts following the established sibling pattern (registerChatStopRoute / chat-stop.ts), which brings chat.ts to 739. Routing is unchanged -- the existing cancel route tests still pass against the mounted route, which is what proves the extraction preserved behaviour. Also drops the two imports left unused in chat.ts by the extraction. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Raphaël Titsworth-Morin <raphael@raphaeltm.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Integration vehicle — DO NOT MERGE until the parent PR-backlog orchestrator completes the batch staging validation window. Do not touch or close the constituent PRs from this PR.
This branch combines the authorized batch 2 priority-draft PRs on top of current
origin/maincb6c485c42efbcaea9c95a2c4a7dd5ea12b8e08b(ccecf8935f84ff3aca4ef3a1aad81651d5871722at initial branch creation, then current-main #1836 merged before final push).Constituent PRs:
0819e5184102659f2d2acca6a60d037d47ecf0db--no-ff; no textual conflicts.f9b3c85e59b45ff752009d3fb9b1d17bb5be20dd--no-ff; no textual conflicts.112259dbbe934152b14c2f9e2ee3c47d83c7f27clist_triggersMCP tool--no-ff; auto-merged shared env/docs/helper files.ca30aa0f60f866569788e4c0329cb8c846e079c4--no-ff; auto-merged docs/config references.bac2702c0967b854fe6fa9ca760be0ece1594bdd--no-ff; auto-merged env/docs references. Note: current PR #1678 head had moved, so this branch used the exact pinned commit.Integration-only fix:
7cddd524e1a594ebe4aaeefd8147bd9372654305—apps/web/src/components/project-message-view/index.tsxinput-expiredlifecycle card still inherited the project-chat shell's red failure glow.classifyFailure(...)for the same diagnosable-vs-lifecycle distinction asFailureCard.680c526567c92852ce71d985a75629c7b2b65879—apps/api/src/db/migrations/0114_credential_setup_exchanging_status.sqlorigin/mainadvanced to Fix session snapshot direct upload wake pipeline #1836, current main owned0112_session_snapshot_direct_upload_authorization.sqland0113_session_snapshot_capture_error.sql.0112_credential_setup_exchanging_status.sqlto0114_credential_setup_exchanging_status.sqlwith 100% identical SQL content.Merge conflict and compatibility log
apps/api/src/services/workspace-placement.ts,apps/api/src/durable-objects/task-runner/workspace-branch.ts,apps/api/src/durable-objects/task-runner/workspace-steps.ts, andapps/api/src/scheduled/node-cleanup/*. #1779's exactly-once force-stop completion, lifecycle classification, and correlation bindings remain inapps/api/src/routes/mcp/orchestration-comms.ts,apps/api/src/services/vm-error-correlation.ts,packages/shared/src/failure-classification.ts, andpackages/vm-agent/internal/acp/session_host*.go.pnpm quality:wrangler-bindingsand docs/config quality checks passed.mainorigin/mainand renumbered the unmerged #1678 migration to0114_credential_setup_exchanging_status.sql; SQL content is unchanged andpnpm quality:migration-orderingpasses.Conflict-marker scan after all merges and the integration-only fix:
rg -n '^(<<<<<<<|=======|>>>>>>>)' -g '!pnpm-lock.yaml' .returned no matches.Union fidelity check
origin/mainmerged the five exact pinned heads in the requested order withgit merge --no-ff; its tree matched the five-merge integration tree before the UI compatibility fix.apps/web/src/components/project-message-view/index.tsx(12 insertions, 3 deletions) in commit7cddd524e1a594ebe4aaeefd8147bd9372654305.apps/api/src/db/migrations/0114_credential_setup_exchanging_status.sql, renamed from fix: forward Claude guided login verification code #1678's0112_credential_setup_exchanging_status.sqlwith no SQL content changes in commit680c526567c92852ce71d985a75629c7b2b65879, required because currentorigin/mainnow owns migration prefixes0112and0113.Candidate sweep/cron cost note
#1824 changes scheduler lifecycle and node-cleanup arbitration. Expected candidate volume and cost:
Validation
pnpm lint— covered bypnpm check:fastpnpm typecheckpnpm test.claude/rules/47-control-loop-io-budget.md)Local validation results:
pnpm install --frozen-lockfile— PASSnode_modules; lockfile unchanged.pnpm check:fast— PASS after the integration-only fixes and current-main mergepnpm format.pnpm typecheck— PASS after the integration-only fixes and current-main mergepnpm --filter @simple-agent-manager/api test— PASS after the integration-only fixes and current-main mergepnpm --filter @simple-agent-manager/web test— PASS after the integration-only fixes and current-main mergegobinary on PATH.packages/vm-agent:go vet ./...,go build ./..., andgo test ./...— PASS withgo version go1.26.6 linux/amd64.pnpm quality:no-tracked-stale-binariespnpm quality:scripts:testpnpm quality:wrangler-bindingspnpm quality:agent-install-manifestpnpm quality:migration-safetypnpm quality:migration-orderingpnpm quality:do-migration-safetypnpm quality:ast-checkspnpm quality:file-sizespnpm quality:stale-artifactspnpm quality:repo-visibility— report-only, completedpnpm quality:source-contract-testspnpm quality:dependency-governancepnpm quality:workspace-test-surfacespnpm quality:direct-dependency-evidencepnpm quality:runtime-boundary-semanticspnpm exec vitest run --config scripts/quality/vitest.config.ts ci-quality-program.test.ts ci-worker-suite.test.tspnpm exec vitest run --config scripts/quality/vitest.config.ts check-migration-ordering.test.ts ci-quality-program.test.ts ci-worker-suite.test.tspnpm quality:gitleaks:current— PASS with pinned Gitleaks 8.30.1, 54 reviewed findings / 0 newpnpm quality:gitleaks:pr— PASS with pinned Gitleaks 8.30.1, 0 reviewed findings / 0 newpnpm quality:govulncheck-diff— PASS, no Go module files changedpnpm --filter @simple-agent-manager/web exec playwright test --config=playwright.config.ts tests/playwright/frontend-cache-audit.spec.ts tests/playwright/agent-guided-connect-audit.spec.ts tests/playwright/failure-card-audit.spec.ts tests/playwright/project-chat-recoverable-error-audit.spec.tsRemote CI validation results:
680c526567c92852ce71d985a75629c7b2b65879.Staging Verification (REQUIRED for all code changes — merge-blocking)
This scoped integration-build subtask intentionally does not deploy or validate staging. The parent PR-backlog orchestrator owns the staging deployment and validation window.
Staging Verification Evidence
Pending parent deploy+validation window. Not performed here by explicit task scope: integration-build only, no staging deployment, no merge.
UI Compliance Checklist (Required for UI changes)
.codex/tmp/playwright-screenshots/(see.claude/rules/17-ui-visual-testing.md)Notes: affected local audit specs passed after the integration-only fix. Live staging UI verification remains pending the parent orchestrator's deploy+validation window.
End-to-End Verification (Required for multi-component changes)
.claude/rules/10-e2e-verification.md)Data Flow Trace
apps/api/src/durable-objects/task-runner/workspace-steps.tsdelegates placement decisions throughapps/api/src/services/workspace-placement.ts; cleanup arbitration remains inapps/api/src/scheduled/node-cleanup/shared.tsandnode-phases.ts; race coverage is inapps/api/tests/simulation/scheduler-lifecycle-simulation.test.tsandapps/api/tests/workers/scheduler-lifecycle-races.test.ts.apps/api/src/routes/mcp/orchestration-comms.tsdrives hard-stop/persist/cleanup ordering;apps/api/src/services/vm-error-correlation.tsbinds VM incidents to authoritative node/workspace/session/task state; coverage includesapps/api/tests/integration/mcp-stop-subtask-lifecycle.test.ts,apps/api/tests/integration/observability-ingestion.test.ts, andapps/api/tests/unit/services/vm-error-correlation.test.ts.list_triggers: MCP tool definitions inapps/api/src/routes/mcp/tool-definitions-trigger-tools.tsroute toapps/api/src/routes/mcp/trigger-list-tool.ts, which usesapps/api/src/services/trigger-read.ts; coverage includesapps/api/tests/unit/routes/mcp-list-triggers.test.tsandapps/api/tests/workers/mcp-trigger-tools.test.ts.apps/web/src/hooks/useProjectData.ts,apps/web/src/lib/query-options.ts,apps/web/src/lib/project-query-config.ts, andapps/web/src/hooks/useProjectIntentPrefetch.tspreserve project data during responsive navigation; coverage includesapps/web/tests/unit/hooks/useProjectData.test.tsx,apps/web/tests/unit/ProjectPrefetch.test.tsx, andapps/web/tests/playwright/frontend-cache-audit.spec.ts.apps/api/src/durable-objects/credential-setup-session/index.ts,apps/api/src/routes/agent-credential-setup-sessions.ts,apps/web/src/components/CodexConnectModal.tsx, andapps/api/scripts/claude-setup-token.mjsforward Claude verification codes through the setup session; coverage includesapps/api/tests/workers/agent-credential-setup-native-vertical.test.ts,apps/api/tests/unit/scripts/claude-setup-token.test.ts, andapps/web/tests/playwright/agent-guided-connect-audit.spec.ts.apps/web/src/components/project-message-view/index.tsxnow applies the sameclassifyFailure(...)diagnosable/lifecycle distinction used byapps/web/src/components/debug/FailureCard.tsx;apps/web/tests/playwright/project-chat-recoverable-error-audit.spec.tscovers neutral input-expiry shell styling in the real chat shell.Untested Gaps
Staging/live verification intentionally remains unperformed by this scoped branch-build task. Parent orchestrator owns the consolidated staging pass and merge decision.
Post-Mortem (Required for bug fix PRs)
What broke
This PR is an integration vehicle, not a single constituent bug-fix PR. Local integration UI validation exposed that non-diagnosable
input-expiredlifecycle cards inherited the outer project-chat red failure glow.Root cause
The inner
FailureCardused the shared classifier to distinguish diagnosable failures from lifecycle outcomes, but the outer project-chat shell applied red failure styling unconditionally whenever a task had an error message.Class of bug
Cross-component display-state mismatch: inner classification semantics were not propagated to an outer UI shell.
Why it wasn't caught
The unit test covered lifecycle label/actions, but the shell glow class lives in
apps/web/src/components/project-message-view/index.tsxand required the real chat-shell Playwright audit to catch.Process fix included in this PR
The existing
apps/web/tests/playwright/project-chat-recoverable-error-audit.spec.tsnow passes on the integrated tree and prevents regression for neutral lifecycle shell styling.Post-mortem file
N/A: integration vehicle. Constituent task records are included under
tasks/active/andtasks/archive/.Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to humanpackages/vm-agentscope; Go 1.26.6go vet ./...,go build ./..., andgo test ./...passed.Exceptions (If any)
Agent Preflight (Required)
Classification
External References
N/A: no external API behavior was designed in this integration branch. References consulted were repository/GitHub PR context: #1830, #1824, #1779, #1770, #1769, and #1678.
Codebase Impact Analysis
The integration branch crosses
apps/api,apps/web,apps/www,packages/shared,packages/vm-agent,.github/workflows,.claude/rules,.claude/skills, andtasks/. Highest-risk paths areapps/api/src/durable-objects/task-runner/workspace-steps.ts,apps/api/src/services/workspace-placement.ts,apps/api/src/scheduled/node-cleanup/shared.ts,apps/api/src/routes/mcp/orchestration-comms.ts,apps/api/src/services/vm-error-correlation.ts,packages/vm-agent/internal/acp/session_host*.go,apps/web/src/components/project-message-view/index.tsx, andapps/web/src/components/CodexConnectModal.tsx.Documentation & Specs
Docs/task/rule updates included from constituents:
.claude/rules/23-cross-boundary-contract-tests.md,.claude/rules/48-stale-while-revalidate-ui.md,.claude/skills/env-reference/SKILL.md,apps/www/src/content/docs/docs/guides/agents.md,apps/www/src/content/docs/docs/guides/recent-product-changes.md,apps/www/src/content/docs/docs/reference/configuration.md,apps/www/src/content/blog/agents-managing-agents.md, and task records undertasks/active/,tasks/archive/, andtasks/backlog/.Constitution & Risk Check
Checked Principle XI/no-hardcoded-values and cross-boundary risk. The integration-only fix introduces no new URL, timeout, limit, or deployment identifier. Lifecycle and cleanup risks are handled by preserving #1824's placement-vs-cleanup arbitration and #1779's exactly-once stop/correlation behavior. Staging risk is explicitly deferred to the parent orchestrator per task scope.