Name: [ADD] Phase 3.9 Cognitive Wave-1: Memory + Skill + KG temporal + Pulse + CoWork bundle

State: Failed finished in 14m

PR State: closed

PR Author: David Tran

PR Author Email:

PR: #53

Committer: David Tran

Committer Email: davidtran.hp@gmail.com

Commit: 6a72459a8e51cc8c770831891c0e0997be6219c1

Description:

                                            [FIX] viin_ai cluster: Cognitive Wave-1 review remediation (10 HIGH + MED)

End-of-wave code review (6 modules) found 0 CRITICAL, 10 HIGH, 14 MED.
This pass fixes all 10 HIGH plus the cheap in-file MED, verified by a real
Odoo native test run (all fix-target tests RED-before-green, now GREEN).

Runtime / security HIGH:
- viin_ai_memory: _bump_reference iterated to fix "Expected singleton" crash
  on a multi-record (L0|L1) recall set.
- viin_ai_memory: L0 identity text now wrapped via wrap_untrusted_context()
  before system-prompt injection (prompt-injection surface, AGENTS.md #10).
- viin_ai_base: google_native response normalizer now extracts functionCall
  parts (Gemini tool calls were silently dropped despite WI-H sending tools).

Test-integrity HIGH (fixed in-scope, not deferred):
- viin_ai_base: replaced tautological constraint-embed assertion with a real
  '[constraints:' check; removed a vendor-free test that never called
  production code and relocated it to viin_ai_agent calling the real
  _tool_schema(); restored the real copy-before-normalize mutate-guard
  (3 protocols, self-contained).
- viin_ai_skill: removed TestCoworkBundleWebQueryToolExists (always-FAIL CI
  gate not controlled by the module under test).
- viin_brain: added TestBrainLinkTemporalSupersession covering create/write
  auto-stamp + idempotency.

Perf / seam HIGH:
- viin_brain: batched _stamp_superseded_at (was N+1 writes).
- viin_ai_agent: _recall_memory gains trace_id param (passed at both run /
  run_streaming call sites) so Memory stamps observations under the run trace
  without a second agent.py touch; removed a hasattr() presence probe on a
  hard-dependency method.

MED: model-ordering (_sql_constraints before fields in skill/pulse), memory
cron noupdate + child_of->in company_ids + promotion.log owner rule + decay
date pre-filter, skill group_ids now enforced in the resolver (+test),
pulse @api.depends + PASS-branch sync comment, google_native combiner
stripping, brain partial index columns (from_page_id, valid_from).
                                            

Branch: 17.0

Instance ID: 0

Age:

Up-time: