Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: agent tools env (#3728)

teo43084c2d6431
diff --git a/infra/packages/shared/src/ai_tools.ts b/infra/packages/shared/src/ai_tools.ts
index 240ad9e0e5..d0c14d921d 100644
--- a/infra/packages/shared/src/ai_tools.ts
+++ b/infra/packages/shared/src/ai_tools.ts
@@ -93,6 +93,10 @@ export function getAiToolsInfra(): AiToolsInfra {
name: 'INTERNAL_API_SECRET_KEY',
value: pulumi.interpolate`${internalAuthKey}`,
},
+ {
+ name: 'DOCUMENT_STORAGE_SERVICE_AUTH_KEY',
+ value: pulumi.interpolate`${internalAuthKey}`,
+ },
{
name: ServiceUrl.DOCUMENT_STORAGE_SERVICE_URL,
value: getServiceUrl(ServiceUrl.DOCUMENT_STORAGE_SERVICE_URL),
diff --git a/rust/cloud-storage/ai_tools/src/build_context.rs b/rust/cloud-storage/ai_tools/src/build_context.rs
index eba5b44756..b0d98242f9 100644
--- a/rust/cloud-storage/ai_tools/src/build_context.rs
+++ b/rust/cloud-storage/ai_tools/src/build_context.rs
@@ -46,6 +46,7 @@ use sync_service_client::SyncServiceClient;
env_var! {
struct ToolContextEnvVars {
DocumentStorageServiceUrl,
+ DocumentStorageServiceAuthKey,
EmailServiceUrl,
SyncServiceUrl,
SyncServiceAuthKey,
@@ -61,7 +62,6 @@ env_var! {
maybe_env_var! {
struct ToolContextMaybeEnvVars {
- InternalApiSecretKey,
LexicalServiceUrl,
NotificationQueue,
}
@@ -77,14 +77,13 @@ maybe_env_var! {
///
/// Required env vars: `DOCUMENT_STORAGE_SERVICE_URL`, `EMAIL_SERVICE_URL`,
/// `SYNC_SERVICE_URL`, `SYNC_SERVICE_AUTH_KEY`,
-/// `STATIC_FILE_SERVICE_URL`, `DOCUMENT_STORAGE_BUCKET`,
-/// `DOCX_DOCUMENT_UPLOAD_BUCKET`, `EMAIL_SCHEDULED_QUEUE`,
+/// `DOCUMENT_STORAGE_SERVICE_AUTH_KEY`, `STATIC_FILE_SERVICE_URL`,
+/// `DOCUMENT_STORAGE_BUCKET`, `DOCX_DOCUMENT_UPLOAD_BUCKET`, `EMAIL_SCHEDULED_QUEUE`,
/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_DISTRIBUTION_URL`,
/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PUBLIC_KEY_ID`,
/// `DOCUMENT_STORAGE_SERVICE_CLOUDFRONT_SIGNER_PRIVATE_KEY_SECRET_NAME`.
///
/// Optional env vars (with fallbacks for local dev):
-/// - `INTERNAL_API_SECRET_KEY` (defaults to `"local"`)
/// - `LEXICAL_SERVICE_URL` (defaults to `http://localhost:8096`)
/// - `NOTIFICATION_QUEUE` (if omitted, notification status updates skip push clearing)
#[tracing::instrument(skip(pool), err)]
@@ -95,11 +94,6 @@ pub async fn build_tool_service_context_from_env(
let maybe_env = ToolContextMaybeEnvVars::new();
let environment = Environment::new_or_prod();
- let internal_api_secret_key: Arc<str> = maybe_env
- .internal_api_secret_key
- .map(|v| v.as_arc())
- .context("expected INTERNAL_API_SECRET_KEY")?;
-
let lexical_service_url: Arc<str> = maybe_env
.lexical_service_url
.map(|v| v.as_arc())
@@ -139,7 +133,7 @@ pub async fn build_tool_service_context_from_env(
.to_string();
let search_client = Arc::new(SearchServiceClient::new(
- internal_api_secret_key.to_string(),
+ env.document_storage_service_auth_key.to_string(),
env.document_storage_service_url.to_string(),
));
let sync_client = Arc::new(SyncServiceClient::new(
diff --git a/rust/cloud-storage/document_cognition_service/src/config.rs b/rust/cloud-storage/document_cognition_service/src/config.rs
index 3a7d968f09..382b839f4a 100644
--- a/rust/cloud-storage/document_cognition_service/src/config.rs
+++ b/rust/cloud-storage/document_cognition_service/src/config.rs
@@ -22,6 +22,8 @@ pub struct Config {
pub document_storage_bucket: String,
/// document storage service url
pub document_storage_service_url: String,
+ /// document storage service auth key
+ pub document_storage_service_auth_key: String,
/// The sqs queue to send document text extract jobs to
pub document_text_extractor_queue: String,
/// The sqs queue to send chat delete jobs
@@ -66,6 +68,7 @@ env_var!(
pub EmailScheduledQueue,
pub NotificationQueue,
pub DocumentStorageServiceUrl,
+ pub DocumentStorageServiceAuthKey,
pub SearchEventQueue,
pub SyncServiceUrl,
pub SyncServiceAuthKey,
@@ -113,6 +116,7 @@ impl Config {
email_scheduled_queue,
notification_queue,
document_storage_service_url,
+ document_storage_service_auth_key,
search_event_queue,
sync_service_url,
sync_service_auth_key,
@@ -137,6 +141,7 @@ impl Config {
document_batch_limit,
document_storage_bucket: document_storage_bucket.to_string(),
document_storage_service_url: document_storage_service_url.to_string(),
+ document_storage_service_auth_key: document_storage_service_auth_key.to_string(),
document_text_extractor_queue: document_text_extractor_queue.to_string(),
chat_delete_queue: chat_delete_queue.to_string(),
email_scheduled_queue: email_scheduled_queue.to_string(),
@@ -171,6 +176,7 @@ impl Config {
document_batch_limit: Default::default(),
document_storage_bucket: Default::default(),
document_storage_service_url: Default::default(),
+ document_storage_service_auth_key: Default::default(),
document_text_extractor_queue: Default::default(),
chat_delete_queue: Default::default(),
email_scheduled_queue: Default::default(),
diff --git a/rust/cloud-storage/document_cognition_service/src/main.rs b/rust/cloud-storage/document_cognition_service/src/main.rs
index db04a0841e..ad0e51aac0 100644
--- a/rust/cloud-storage/document_cognition_service/src/main.rs
+++ b/rust/cloud-storage/document_cognition_service/src/main.rs
@@ -98,7 +98,7 @@ async fn main() -> anyhow::Result<()> {
);
let document_storage_client = DocumentStorageServiceClient::new(
- internal_auth_key.as_ref().to_string(),
+ config.document_storage_service_auth_key.clone(),
config.document_storage_service_url.clone(),
);
@@ -119,7 +119,7 @@ async fn main() -> anyhow::Result<()> {
tracing::info!("initialized sync service client");
let search_service_client = SearchServiceClient::new(
- internal_auth_key.as_ref().to_string(),
+ config.document_storage_service_auth_key.clone(),
config.document_storage_service_url.clone(),
);
diff --git a/rust/cloud-storage/mcp_service/src/context.rs b/rust/cloud-storage/mcp_service/src/context.rs
index 8606000b8e..033898f917 100644
--- a/rust/cloud-storage/mcp_service/src/context.rs
+++ b/rust/cloud-storage/mcp_service/src/context.rs
@@ -45,6 +45,7 @@ env_var!(
DatabaseUrl,
EmailScheduledQueue,
DocumentStorageServiceUrl,
+ DocumentStorageServiceAuthKey,
SyncServiceUrl,
SyncServiceAuthKey,
LexicalServiceUrl,
@@ -119,6 +120,10 @@ pub async fn build_context() -> anyhow::Result<McpContext> {
&secretsmanager_client,
sqs_client,
internal_auth_key.as_ref().to_string(),
+ env_vars
+ .document_storage_service_auth_key
+ .as_ref()
+ .to_owned(),
sync_service_auth_key.as_ref().to_owned(),
)
.await?;
@@ -146,12 +151,14 @@ async fn build_tool_context(
secretsmanager_client: &secretsmanager_client::SecretsManager,
sqs_client: sqs_client::SQS,
internal_auth_key: String,
+ document_storage_service_auth_key: String,
sync_service_auth_key: String,
) -> anyhow::Result<ToolServiceContext> {
let dss_url: String = env_vars.document_storage_service_url.as_ref().to_owned();
let sync_service_url: String = env_vars.sync_service_url.as_ref().to_owned();
- let search_service_client = SearchServiceClient::new(internal_auth_key.clone(), dss_url);
+ let search_service_client =
+ SearchServiceClient::new(document_storage_service_auth_key, dss_url);
let lexical_client = Arc::new(lexical_client::LexicalClient::new(
internal_auth_key.clone(),