Skip to content

(CODUX-218) Harden base-update response extraction - #3015

Merged
numnx merged 1 commit into
feature/CODUX-218-fix-automatic-agent-update-parsingfrom
task/feature-codux-21-t01-codex-ca06158f-mrjbdy2i
Jul 13, 2026
Merged

(CODUX-218) Harden base-update response extraction#3015
numnx merged 1 commit into
feature/CODUX-218-fix-automatic-agent-update-parsingfrom
task/feature-codux-21-t01-codex-ca06158f-mrjbdy2i

Conversation

@numnx

@numnx numnx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Harden base-update response extraction

Automated task PR opened by Code UX for T01.

📋 Summary

Sprint: Sprint 218 · Fix automatic agent update parsing · Task: T01

Harden automatic agent-update response parsing while preserving strict payload validation, retry behavior, non-mutating failures, and synchronized documentation.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.6-sol

⏱️ Timing

Started 2026-07-13 14:25:15 UTC
Finished 2026-07-13 14:31:01 UTC
Duration 5m 45s

📊 Token Usage

Metric Value
Input tokens 93,691
Cached input tokens 1,327,872
Output tokens 12,722
Total tokens 1,434,285
Invocations 1
Tool calls 24
Active time 5m 16s

Included usage estimate (subscription/local login): $1.51

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

📝 Full Task Prompt
## Objective
Fix `AgentBaseUpdateService` so provider responses with harmless formatting or supported envelopes are parsed compatibly without weakening the exact `instructionMarkdown` contract.

## Scope
- `src/services/agent-base-update-service.ts`
- `tests/backend/services/agent-base-update-service.test.ts`
- `src/domain/llm/json-extraction.ts` as the existing extractor contract to consume, not redesign
- `AgentBaseUpdateService.parseUpdatePayload` and the `applyUpdate` parser callback

## Implementation Requirements
1. Replace the update-specific direct `JSON.parse` call with `extractJsonFromText`, preserving update-specific `ValidationError` messages for extraction and shape failures.
2. Continue requiring a non-array object with exactly one non-empty string property named `instructionMarkdown`, trimming only the accepted payload value.
3. Preserve selected-preset line-order validation, metadata immutability, and the rule that parsing or safety failures occur before `applyBaseAgentInstructionUpdate`.
4. Add focused coverage for raw JSON, fenced/noisy or supported wrapped JSON, malformed output, empty output, arrays, extra properties, and destructive instruction rewrites.

## Constraints
- Keep the change limited to automatic base-agent update behavior; do not alter routes, persistence schemas, provider runners, generic planning parsing, or the shared extractor algorithm.
- Do not accept arbitrary provider metadata or silently select an unrelated JSON object from the response.
- Preserve structured-provider retry behavior by throwing typed validation errors from the parser.

## Verification
- Run `pnpm exec vitest run tests/backend/services/agent-base-update-service.test.ts tests/backend/domain/llm/json-extraction.test.ts`.
- Run `pnpm run lint`.
- Confirm compatible presentation noise succeeds, invalid or destructive responses do not write the preset, and existing raw JSON behavior remains unchanged.
🌿 Branch Info

Base: feature/CODUX-218-fix-automatic-agent-update-parsing
Head: task/feature-codux-21-t01-codex-ca06158f-mrjbdy2i


🤖 Generated by Code UX

@numnx
numnx merged commit 56a67fd into feature/CODUX-218-fix-automatic-agent-update-parsing Jul 13, 2026
20 checks passed
@numnx
numnx deleted the task/feature-codux-21-t01-codex-ca06158f-mrjbdy2i branch July 13, 2026 14:37
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