Skip to content

Feat files - #2

Closed
arantespp wants to merge 27 commits into
mainfrom
feat-files
Closed

Feat files#2
arantespp wants to merge 27 commits into
mainfrom
feat-files

Conversation

@arantespp

Copy link
Copy Markdown
Member

No description provided.

arantespp added a commit that referenced this pull request Jun 24, 2026
…y embedding docs (#252)

Fix #2 — memory_name in knowledge results:
- Add memoryName to MemoryKnowledgeResult (both semantic and non-search
  paths in knowledgeMemory.ts); the Memory association is already loaded, so
  no extra query.
- Add required memory_name to the OpenAPI MemoryKnowledgeResult schema;
  regenerate SDK/CLI (generated files are gitignored, rebuilt in CI).
- Inject context label now uses the human name: [Memory: <name>] instead of
  the opaque [Memory: <id>] (agentKnowledge.ts).
- Tests: assert memory_name in REST knowledge search; label test expects the
  memory name.

Fix #1 — memory embedding resilience (docs only):
- The code already aligns memory to documents (MemoryEntry.embedding is
  nullable and writeMemoryEntry is non-fatal on embedding failure). The PRD
  was stale: correct prd-memories.md (NOT NULL -> NULL, write-algorithm
  STEP 1 non-fatal note, design-principle wording).

Docs: prd-knowledge.md response examples and knowledge.md data model gain
memory_name.

Verified: pnpm --filter @soat/server typecheck, eslint --fix, and the full
test suite (76 suites / 1641 tests) pass against a local Postgres + pgvector.


Claude-Session: https://claude.ai/code/session_01ErUBchseZrpYysrq5rZMNF

Co-authored-by: Claude <noreply@anthropic.com>
arantespp added a commit that referenced this pull request Jun 28, 2026
…n fields, trace_id) (#294)

* fix(agents): address UX/docs issues from issue #293

- Fix #1: parseBedrockSecret now treats plain ABSK strings as
  { apiKey: value } instead of silently discarding them

- Fix #2: buildBedrockModel now falls back to config.apiKey when
  no secret is linked, so api_key in the provider config object
  is honoured instead of being silently ignored

- Fix #3: Add PATCH /agents/:agent_id as an alias for PUT, so
  both HTTP methods work for partial agent updates; update OpenAPI
  spec accordingly and regenerate SDK + CLI manifest

- Fix #4: POST and PUT/PATCH /agents reject unknown request body
  fields with 400 "Unknown field(s): ..." to prevent silent data
  loss (e.g. sending prompt instead of instructions)

- Fix #5: recordGenerationFailure now wraps non-DomainErrors in a
  new GENERATION_FAILED DomainError that carries generation_id and
  trace_id in meta, so 500 responses from /agents/:id/generate
  include a trace_id the caller can query for the root cause

- Update ai-providers docs with JSON-format warning and config.api_key note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTwheo15iV5tcGGWjk8V1z

* test(generationLifecycle): cover non-Error thrown value to fix branch threshold

Add a test that passes a plain object (not an Error or DomainError) to
recordGenerationFailure, covering the false branch of the instanceof Error
ternary that was sitting below the 70% branch coverage threshold.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTwheo15iV5tcGGWjk8V1z

---------

Co-authored-by: Claude <noreply@anthropic.com>
arantespp pushed a commit that referenced this pull request Jul 18, 2026
…ation

Restores global function coverage to 100%:
- exercise emitApproval's create-time unique-violation backstop via a
  sanctioned force-failure spy (tests.md exception #2)
- make runToolCallContinuation self-contained (never rejects) so the resume
  handler needs no separate .catch arrow; cover the swallow path

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWGkJE9gG4tdJkaPxmtEFT
arantespp added a commit that referenced this pull request Jul 18, 2026
…ace (Milestone 1) (#581)

* feat(agents,approvals): tool-call approval interception on every surface (Milestone 1)

Milestone 1 of the manage-by-exception roadmap — extends the approval queue
from orchestrated (DAG) runs to every execution surface (chat sessions,
direct generations, MCP) via an `approval_policy` enforced in the platform
tool-dispatch path. Task 1.0 (canonical tool_bindings + approval_policy
validation) shipped earlier; this implements tasks 1.1–1.5.

- 1.1 Policy evaluation in the dispatch path. A new pure module
  (`agentToolApproval.ts`) evaluates a binding's allow / require_approval /
  deny policy (JSON Logic over `{ action, arguments }`, first match wins) and
  gates each resolved tool's `execute`. Threaded into the resolver via a
  `ResolverApprovalContext` built at the generation entry point (and recovery
  path); zero-overhead when no binding declares a policy.
- 1.2 Return-pending. `require_approval` freezes the call into an approval
  item and returns `{ status: "pending_approval", approval_id, expires_at }`
  as the tool result — the turn completes normally, no `requires_action`
  pause. The optional `approval_reasoning` / `approval_evidence` /
  `approval_predicted_impact` justification fields are injected into the
  model-visible schema (http/pipeline/inline), stripped from executed args,
  and frozen onto the item.
- 1.3 Continuation on resolution. A tool-call resume handler
  (`agentToolApprovalContinuation.ts`, registered at startup) executes the
  frozen (or edited) action on approval, populates `DecisionOutput.result`,
  and fires a continuation generation linked via `initiator_generation_id` —
  routed into the originating session thread when there was one, else a
  standalone linked generation. Rejection/expiry carry the decision and
  execute nothing.
- 1.4 Dedup. A `(project, agent, tool, action, args)` digest returns the
  existing pending item on re-proposal; the partial unique index backs the
  concurrent-emit race.
- 1.5 `origin: tool_call` wired end-to-end; the lifecycle never branches on it.

Model: `ApprovalItem` gains `session_id` and `proposed_action.action`;
OpenAPI + docs (`approvals.md`, `agents.md`) updated; smoke-test flow added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWGkJE9gG4tdJkaPxmtEFT

* fix(postgresdb): format ApprovalItem proposedAction type (lint)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWGkJE9gG4tdJkaPxmtEFT

* test(approvals): cover dedup-race backstop and self-contained continuation

Restores global function coverage to 100%:
- exercise emitApproval's create-time unique-violation backstop via a
  sanctioned force-failure spy (tests.md exception #2)
- make runToolCallContinuation self-contained (never rejects) so the resume
  handler needs no separate .catch arrow; cover the swallow path

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWGkJE9gG4tdJkaPxmtEFT

* refactor(approvals): address PR review — gate semantics, provenance, registration

- evaluateApprovalEffect: use plain JS truthiness for rule matching, so a
  `when` yielding 0/''/null/NaN is falsy (matches the JSON Logic convention
  used by orchestrationPollNode), instead of firing on 0.
- Freeze the effective (preset-merged) arguments the policy evaluated onto the
  item (and dedup key), so the approver sees the full call and the platform
  re-executes exactly what was decided.
- gateResolvedTools: spread the resolved tool in the schema-injection branch so
  properties beyond description/inputSchema/execute survive gating; fix the
  JSDoc to match localInjectableSchema (http/pipeline + inline http).
- Register the tool-call resume handler from the approval expiry sweeper too,
  not only the REST router, so a scheduler-only process still fires
  continuations for items it expires.
- Clarify the session-continuation provenance in JSDoc (thread linkage today;
  initiator_generation_id FK-threading through the session stack is a follow-up).
- Document the inline-policy ordering invariant shared with deriveLegacyToolFields.
- Add an end-to-end test that resolves an item through the real notifyResume
  path and asserts the registered handler fires the continuation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWGkJE9gG4tdJkaPxmtEFT

---------

Co-authored-by: Claude <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